1 | #ifndef __XMLIO_CCalendar__ |
---|
2 | #define __XMLIO_CCalendar__ |
---|
3 | |
---|
4 | /// xios headers /// |
---|
5 | #include "xmlioserver_spl.hpp" |
---|
6 | #include "exception.hpp" |
---|
7 | #include "date.hpp" |
---|
8 | |
---|
9 | namespace xios |
---|
10 | { |
---|
11 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
12 | |
---|
13 | typedef enum _monthEnum |
---|
14 | { JAN = 1, FEB = 2, MAR = 3, APR = 4 , MAY = 5 , JUN = 6 , |
---|
15 | JUL = 7, AUG = 8, SEP = 9, OCT = 10, NOV = 11, DEC = 12 } MonthEnum; |
---|
16 | |
---|
17 | ///--------------------------------------------------------------- |
---|
18 | |
---|
19 | class CDate; |
---|
20 | |
---|
21 | class CCalendar : public CObject |
---|
22 | { |
---|
23 | /// Typedef /// |
---|
24 | typedef CObject SuperClass; |
---|
25 | |
---|
26 | public : |
---|
27 | |
---|
28 | /// Destructeur /// |
---|
29 | virtual ~CCalendar(void); |
---|
30 | |
---|
31 | protected : |
---|
32 | |
---|
33 | /// Constructeurs /// |
---|
34 | CCalendar(void); |
---|
35 | CCalendar(const StdString & id) ; |
---|
36 | CCalendar(const StdString & id, |
---|
37 | int yr, int mth, int d, |
---|
38 | int hr = 0, int min = 0, int sec = 0); |
---|
39 | CCalendar(const StdString & id, const StdString & dateStr); |
---|
40 | CCalendar(const StdString & id, const StdString & dateStr, const StdString & timeOrigin); |
---|
41 | |
---|
42 | CCalendar(const CCalendar & calendar); // Not implemented yet. |
---|
43 | CCalendar(const CCalendar * const calendar); // Not implemented yet. |
---|
44 | |
---|
45 | public : |
---|
46 | |
---|
47 | //------------------------------------------------------------ |
---|
48 | |
---|
49 | /// Autres /// |
---|
50 | virtual StdString toString(void) const; |
---|
51 | virtual void fromString(const StdString & str); |
---|
52 | |
---|
53 | /// Mutateur /// |
---|
54 | void setTimeStep(const CDuration & duration); |
---|
55 | |
---|
56 | /// Traitemants /// |
---|
57 | CDate & update(int step); |
---|
58 | |
---|
59 | /// Accesseurs /// |
---|
60 | const CDuration & getTimeStep(void) const; |
---|
61 | const CDate & getInitDate(void) const; |
---|
62 | const CDate & getTimeOrigin(void) const; |
---|
63 | CDate & getCurrentDate(void); |
---|
64 | |
---|
65 | public : |
---|
66 | |
---|
67 | //------------------------------------------------------------ |
---|
68 | virtual int getMonthLength(const CDate & date) const ; |
---|
69 | |
---|
70 | virtual StdString getType(void) const; |
---|
71 | |
---|
72 | virtual int getYearTotalLength(const CDate & date) const ; // Retourne la durée d'une année en seconde. |
---|
73 | |
---|
74 | virtual int getYearLength (void) const; // Retourne la durée d'une année en mois. |
---|
75 | virtual int getDayLength (void) const; // Retourne la durée d'un jour en heures. |
---|
76 | virtual int getHourLength (void) const; // Retourne la durée d'une heure en minute. |
---|
77 | virtual int getMinuteLength(void) const; // Retourne la durée d'une minute en secondes. |
---|
78 | |
---|
79 | virtual int getNbSecond(const CDate & date) const; |
---|
80 | virtual StdString getMonthName(int month_id) const; |
---|
81 | |
---|
82 | virtual const StdString getMonthShortName(int month_id) const; |
---|
83 | void initializeDate(int yr, int mth, int d, int hr = 0, int min = 0, int sec = 0) ; |
---|
84 | void initializeDate(const StdString & dateStr); |
---|
85 | void initializeDate(const StdString & dateStr, const StdString & timeOrigin); |
---|
86 | |
---|
87 | //------------------------------------------------------------ |
---|
88 | |
---|
89 | private : |
---|
90 | |
---|
91 | /// Propriétés privées /// |
---|
92 | CDate initDate; |
---|
93 | CDate timeOrigin; |
---|
94 | CDate currentDate; |
---|
95 | CDuration timestep; |
---|
96 | |
---|
97 | }; // class CCalendar |
---|
98 | |
---|
99 | } // namespace xios |
---|
100 | |
---|
101 | #endif // __XMLIO_CCalendar__ |
---|