1 | #ifndef __XIOS_CDuration__ |
---|
2 | #define __XIOS_CDuration__ |
---|
3 | |
---|
4 | /// XIOS headers /// |
---|
5 | #include "xios_spl.hpp" |
---|
6 | #include "exception.hpp" |
---|
7 | |
---|
8 | namespace 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 | CDuration(double year=0.0, double month=0.0, double day=0.0, double hour=0.0, double minute=0.0, double second=0.0, double timestep=0.0); |
---|
23 | |
---|
24 | /// Opérateurs /// |
---|
25 | CDuration& operator=(const CDuration& duration); |
---|
26 | bool operator==(const CDuration& duration); |
---|
27 | |
---|
28 | friend StdOStream& operator<<(StdOStream& out, const CDuration& duration); |
---|
29 | friend StdIStream& operator>>(StdIStream& in , CDuration& duration); |
---|
30 | |
---|
31 | /// Test /// |
---|
32 | bool isNone(void) const; |
---|
33 | |
---|
34 | /// Traitement /// |
---|
35 | CDuration& resolve(const CCalendar& calendar, bool noNegativeTime = false); |
---|
36 | CDuration& solveTimeStep(const CCalendar& c); |
---|
37 | /// Autres /// |
---|
38 | StdString toString(void) const; |
---|
39 | StdString toStringUDUnits(void) const; |
---|
40 | |
---|
41 | /// Propriétés publiques /// |
---|
42 | double year, month, day, hour, minute, second, timestep; |
---|
43 | }; |
---|
44 | |
---|
45 | ///--------------------------------------------------------------- |
---|
46 | |
---|
47 | const extern CDuration Year, Month, Week, Day, |
---|
48 | Hour, Minute, Second, TimeStep, NoneDu; |
---|
49 | } // namespace xios |
---|
50 | |
---|
51 | #endif // __XIOS_CDuration__ |
---|