[591] | 1 | #ifndef __XIOS_CDuration__ |
---|
| 2 | #define __XIOS_CDuration__ |
---|
[219] | 3 | |
---|
[591] | 4 | /// XIOS headers /// |
---|
| 5 | #include "xios_spl.hpp" |
---|
[219] | 6 | #include "exception.hpp" |
---|
| 7 | |
---|
[335] | 8 | namespace xios |
---|
[219] | 9 | { |
---|
| 10 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 11 | typedef long long int Time; |
---|
| 12 | class CCalendar; |
---|
| 13 | |
---|
| 14 | ///--------------------------------------------------------------- |
---|
[550] | 15 | |
---|
| 16 | struct CDuration |
---|
[219] | 17 | { |
---|
[550] | 18 | public: /* static */ |
---|
| 19 | static CDuration FromString(const StdString& str); |
---|
[219] | 20 | |
---|
[550] | 21 | public: |
---|
[1472] | 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 | |
---|
[219] | 24 | /// Opérateurs /// |
---|
[550] | 25 | CDuration& operator=(const CDuration& duration); |
---|
[1158] | 26 | bool operator==(const CDuration& duration); |
---|
[219] | 27 | |
---|
[550] | 28 | friend StdOStream& operator<<(StdOStream& out, const CDuration& duration); |
---|
| 29 | friend StdIStream& operator>>(StdIStream& in , CDuration& duration); |
---|
[219] | 30 | |
---|
| 31 | /// Test /// |
---|
| 32 | bool isNone(void) const; |
---|
| 33 | |
---|
| 34 | /// Traitement /// |
---|
[550] | 35 | CDuration& resolve(const CCalendar& calendar, bool noNegativeTime = false); |
---|
| 36 | CDuration& solveTimeStep(const CCalendar& c); |
---|
[219] | 37 | /// Autres /// |
---|
| 38 | StdString toString(void) const; |
---|
[612] | 39 | StdString toStringUDUnits(void) const; |
---|
[219] | 40 | |
---|
| 41 | /// Propriétés publiques /// |
---|
[424] | 42 | double year, month, day, hour, minute, second, timestep; |
---|
[550] | 43 | }; |
---|
[219] | 44 | |
---|
| 45 | ///--------------------------------------------------------------- |
---|
| 46 | |
---|
[550] | 47 | const extern CDuration Year, Month, Week, Day, |
---|
| 48 | Hour, Minute, Second, TimeStep, NoneDu; |
---|
[335] | 49 | } // namespace xios |
---|
[219] | 50 | |
---|
[591] | 51 | #endif // __XIOS_CDuration__ |
---|