source: XIOS/dev/branch_yushan_merged/src/duration.hpp @ 1205

Last change on this file since 1205 was 1105, checked in by mhnguyen, 7 years ago

Adding comparison operator between objects of XIOS.
Two objects of a same type are considered equal if they have same non-empty
attributes which have same values

+) Add operator== to class CArray
+) Add comparison operator to some basic attribute classes
+) Add operator== to date and duration (It seems that they don't serve much)

Test
+) On Curie
+) No Unit tests but test with transformation work (the next commit)

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 1.5 KB
Line 
1#ifndef __XIOS_CDuration__
2#define __XIOS_CDuration__
3
4/// XIOS headers ///
5#include "xios_spl.hpp"
6#include "exception.hpp"
7
8namespace xios
9{
10      /// ////////////////////// Déclarations ////////////////////// ///
11      typedef long long int Time;
12      class CCalendar;
13
14      ///---------------------------------------------------------------
15
16      struct CDuration
17      {
18         public: /* static */
19            static CDuration FromString(const StdString& str);
20
21         public:
22            /// Opérateurs ///
23            CDuration& operator=(const CDuration& duration);
24            bool operator==(const CDuration& duration);
25
26            friend StdOStream& operator<<(StdOStream& out, const CDuration& duration);
27            friend StdIStream& operator>>(StdIStream& in , CDuration& duration);
28
29            /// Test ///
30            bool isNone(void) const;
31
32            /// Traitement ///
33            CDuration& resolve(const CCalendar& calendar, bool noNegativeTime = false);
34            CDuration& solveTimeStep(const CCalendar& c);
35            /// Autres ///
36            StdString toString(void) const;
37            StdString toStringUDUnits(void) const;
38
39            /// Propriétés publiques ///
40            double year, month, day, hour, minute, second, timestep;
41      };
42
43      ///---------------------------------------------------------------
44
45      const extern CDuration Year, Month,  Week,   Day,
46                             Hour, Minute, Second, TimeStep, NoneDu;
47} // namespace xios
48
49#endif // __XIOS_CDuration__
Note: See TracBrowser for help on using the repository browser.