[591] | 1 | #ifndef __XIOS_CCalendarWrapper__ |
---|
| 2 | #define __XIOS_CCalendarWrapper__ |
---|
[549] | 3 | |
---|
[591] | 4 | /// XIOS headers /// |
---|
| 5 | #include "xios_spl.hpp" |
---|
[549] | 6 | #include "attribute_enum.hpp" |
---|
| 7 | #include "attribute_enum_impl.hpp" |
---|
[550] | 8 | #include "attribute_array.hpp" |
---|
[549] | 9 | #include "declare_attribute.hpp" |
---|
| 10 | #include "object_template.hpp" |
---|
| 11 | |
---|
| 12 | #include "calendar.hpp" |
---|
| 13 | |
---|
| 14 | namespace xios { |
---|
| 15 | |
---|
| 16 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 17 | class CCalendarWrapperAttributes; |
---|
| 18 | class CCalendarWrapper; |
---|
| 19 | ///-------------------------------------------------------------- |
---|
| 20 | |
---|
| 21 | // Declare/Define CFileAttribute |
---|
| 22 | BEGIN_DECLARE_ATTRIBUTE_MAP(CCalendarWrapper) |
---|
| 23 | #include "calendar_wrapper_attribute.conf" |
---|
| 24 | END_DECLARE_ATTRIBUTE_MAP(CCalendarWrapper) |
---|
| 25 | |
---|
| 26 | ///-------------------------------------------------------------- |
---|
| 27 | /*! |
---|
| 28 | \class CCalendarWrapper |
---|
| 29 | This class a simple wrapper for the calendar |
---|
| 30 | */ |
---|
| 31 | class CCalendarWrapper |
---|
| 32 | : public CObjectTemplate<CCalendarWrapper> |
---|
| 33 | , public CCalendarWrapperAttributes |
---|
| 34 | { |
---|
| 35 | public : |
---|
| 36 | |
---|
| 37 | /// typedef /// |
---|
| 38 | typedef CObjectTemplate<CCalendarWrapper> SuperClass; |
---|
| 39 | typedef CCalendarWrapperAttributes SuperClassAttribute; |
---|
| 40 | |
---|
| 41 | //--------------------------------------------------------- |
---|
| 42 | |
---|
| 43 | public : |
---|
| 44 | |
---|
| 45 | /// Constructeurs /// |
---|
| 46 | CCalendarWrapper(void); |
---|
| 47 | explicit CCalendarWrapper(const StdString& id); |
---|
| 48 | |
---|
| 49 | /// Destructeur /// |
---|
| 50 | virtual ~CCalendarWrapper(void); |
---|
| 51 | |
---|
| 52 | /// Accesseurs statiques /// |
---|
| 53 | static StdString GetName(void); |
---|
| 54 | static StdString GetDefName(void); |
---|
| 55 | static ENodeType GetType(void); |
---|
| 56 | |
---|
| 57 | //--------------------------------------------------------- |
---|
| 58 | |
---|
| 59 | public : |
---|
| 60 | // Parse xml calendar node |
---|
| 61 | virtual void parse(xml::CXMLNode& node); |
---|
| 62 | // Try to create the calendar from the current attributes |
---|
| 63 | void createCalendar(void); |
---|
| 64 | // Try to update the timestep of the calendar with the corresponding attribute |
---|
| 65 | void updateTimestep(void); |
---|
| 66 | |
---|
| 67 | public : |
---|
| 68 | /// Accesseurs /// |
---|
[1542] | 69 | std::shared_ptr<CCalendar> getCalendar(bool checkValid = false) const; |
---|
[549] | 70 | |
---|
| 71 | const CDate& getInitDate() const; |
---|
| 72 | const CDate& getTimeOrigin() const; |
---|
| 73 | |
---|
| 74 | /// Mutateurs /// |
---|
| 75 | void setInitDate(const CDate& initDate); |
---|
| 76 | void setTimeOrigin(const CDate& timeOrigin); |
---|
| 77 | |
---|
| 78 | private: |
---|
| 79 | // Calendar of context |
---|
[1542] | 80 | std::shared_ptr<CCalendar> calendar; |
---|
[549] | 81 | |
---|
| 82 | }; // class CCalendarWrapper |
---|
| 83 | |
---|
| 84 | typedef CCalendarWrapper CCalendarWrapperDefinition; |
---|
| 85 | } // namespace xios |
---|
| 86 | |
---|
[591] | 87 | #endif // __XIOS_CCalendarWrapper__ |
---|