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