[219] | 1 | #ifndef __XMLIO_CFile__ |
---|
| 2 | #define __XMLIO_CFile__ |
---|
| 3 | |
---|
[335] | 4 | /// xios headers /// |
---|
[219] | 5 | #include "xmlioserver_spl.hpp" |
---|
| 6 | #include "field.hpp" |
---|
[300] | 7 | #include "data_output.hpp" |
---|
[219] | 8 | #include "declare_group.hpp" |
---|
[318] | 9 | #include "date.hpp" |
---|
[219] | 10 | |
---|
| 11 | |
---|
[300] | 12 | |
---|
[335] | 13 | namespace xios { |
---|
[219] | 14 | namespace tree { |
---|
| 15 | |
---|
| 16 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 17 | |
---|
| 18 | class CFileGroup; |
---|
| 19 | class CFileAttributes; |
---|
| 20 | class CFile; |
---|
| 21 | |
---|
| 22 | ///-------------------------------------------------------------- |
---|
| 23 | |
---|
| 24 | // Declare/Define CFileAttribute |
---|
| 25 | BEGIN_DECLARE_ATTRIBUTE_MAP(CFile) |
---|
| 26 | # include "file_attribute.conf" |
---|
| 27 | END_DECLARE_ATTRIBUTE_MAP(CFile) |
---|
| 28 | |
---|
| 29 | ///-------------------------------------------------------------- |
---|
| 30 | |
---|
| 31 | class CFile |
---|
| 32 | : public CObjectTemplate<CFile> |
---|
| 33 | , public CFileAttributes |
---|
| 34 | { |
---|
| 35 | /// typedef /// |
---|
| 36 | typedef CObjectTemplate<CFile> SuperClass; |
---|
| 37 | typedef CFileAttributes SuperClassAttribute; |
---|
[300] | 38 | |
---|
[219] | 39 | public : |
---|
[300] | 40 | enum EEventId |
---|
| 41 | { |
---|
| 42 | EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP |
---|
| 43 | } ; |
---|
| 44 | |
---|
[219] | 45 | typedef CFileAttributes RelAttributes; |
---|
| 46 | typedef CFileGroup RelGroup; |
---|
| 47 | |
---|
| 48 | /// Constructeurs /// |
---|
| 49 | CFile(void); |
---|
| 50 | explicit CFile(const StdString & id); |
---|
| 51 | CFile(const CFile & file); // Not implemented yet. |
---|
| 52 | CFile(const CFile * const file); // Not implemented yet. |
---|
| 53 | |
---|
| 54 | /// Accesseurs /// |
---|
| 55 | boost::shared_ptr<io::CDataOutput> getDataOutput(void) const; |
---|
| 56 | boost::shared_ptr<CFieldGroup> getVirtualFieldGroup(void) const; |
---|
| 57 | std::vector<boost::shared_ptr<CField> > getAllFields(void) const; |
---|
| 58 | |
---|
| 59 | std::vector<boost::shared_ptr<CField> > |
---|
| 60 | getEnabledFields(int default_outputlevel = 5, |
---|
| 61 | int default_level = 1, |
---|
| 62 | bool default_enabled = true); |
---|
| 63 | |
---|
| 64 | public : |
---|
| 65 | |
---|
| 66 | /// Mutateurs /// |
---|
| 67 | void setVirtualFieldGroup(boost::shared_ptr<CFieldGroup> newVFieldGroup); |
---|
[300] | 68 | void setVirtualFieldGroup(void); |
---|
[219] | 69 | |
---|
[300] | 70 | void createHeader(void); |
---|
[286] | 71 | void close(void) ; |
---|
| 72 | |
---|
[219] | 73 | /// Traitements /// |
---|
| 74 | virtual void solveDescInheritance(const CAttributeMap * const parent = 0); |
---|
| 75 | void solveFieldRefInheritance(void); |
---|
| 76 | void solveEFGridRef(void); |
---|
| 77 | void solveEFOperation(void); |
---|
| 78 | |
---|
| 79 | /// Destructeur /// |
---|
| 80 | virtual ~CFile(void); |
---|
| 81 | |
---|
| 82 | /// Autres /// |
---|
| 83 | virtual void parse(xml::CXMLNode & node); |
---|
| 84 | virtual StdString toString(void) const; |
---|
| 85 | |
---|
| 86 | virtual void toBinary (StdOStream & os) const; |
---|
| 87 | virtual void fromBinary(StdIStream & is); |
---|
| 88 | |
---|
| 89 | /// Accesseurs statiques /// |
---|
| 90 | static StdString GetName(void); |
---|
| 91 | static StdString GetDefName(void); |
---|
| 92 | |
---|
| 93 | static ENodeType GetType(void); |
---|
[300] | 94 | |
---|
| 95 | bool AllDomainEmpty ; |
---|
| 96 | shared_ptr<CField> addField(const string& id="") ; |
---|
| 97 | shared_ptr<CFieldGroup> addFieldGroup(const string& id="") ; |
---|
| 98 | void sendAddField(const string& id="") ; |
---|
| 99 | void sendAddFieldGroup(const string& id="") ; |
---|
| 100 | static void recvAddField(CEventServer& event) ; |
---|
| 101 | void recvAddField(CBufferIn& buffer) ; |
---|
| 102 | static void recvAddFieldGroup(CEventServer& event) ; |
---|
| 103 | void recvAddFieldGroup(CBufferIn& buffer) ; |
---|
| 104 | static bool dispatchEvent(CEventServer& event) ; |
---|
[318] | 105 | bool isSyncTime(void) ; |
---|
[321] | 106 | bool checkSplit(void) ; |
---|
| 107 | bool checkSync(void) ; |
---|
| 108 | void checkFile(void) ; |
---|
| 109 | void initFile(void) ; |
---|
[318] | 110 | date::CDate* lastSync ; |
---|
[321] | 111 | date::CDate* lastSplit ; |
---|
[318] | 112 | date::CDuration syncFreq ; |
---|
[321] | 113 | date::CDuration splitFreq ; |
---|
| 114 | date::CDuration outputFreq ; |
---|
[318] | 115 | int nbDomain ; |
---|
[321] | 116 | bool isOpen ; |
---|
[219] | 117 | private : |
---|
| 118 | |
---|
| 119 | /// Propriétés privées /// |
---|
| 120 | boost::shared_ptr<CFieldGroup> vFieldGroup; |
---|
| 121 | boost::shared_ptr<io::CDataOutput> data_out; |
---|
| 122 | std::vector<boost::shared_ptr<CField> > enabledFields; |
---|
| 123 | |
---|
| 124 | }; // class CFile |
---|
| 125 | |
---|
| 126 | ///-------------------------------------------------------------- |
---|
| 127 | |
---|
| 128 | // Declare/Define CFileGroup and CFileDefinition |
---|
| 129 | DECLARE_GROUP(CFile); |
---|
| 130 | |
---|
| 131 | ///-------------------------------------------------------------- |
---|
| 132 | |
---|
| 133 | } // namespace tree |
---|
[335] | 134 | } // namespace xios |
---|
[219] | 135 | |
---|
| 136 | #endif // __XMLIO_CFile__ |
---|