[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); |
---|
[459] | 70 | void processEnabledFile(void) ; |
---|
| 71 | void processEnabledFields(void) ; |
---|
[300] | 72 | void createHeader(void); |
---|
[286] | 73 | void close(void) ; |
---|
| 74 | |
---|
[219] | 75 | /// Traitements /// |
---|
[445] | 76 | virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); |
---|
| 77 | void solveFieldRefInheritance(bool apply); |
---|
[219] | 78 | void solveEFGridRef(void); |
---|
| 79 | void solveEFOperation(void); |
---|
[459] | 80 | void solveEFExpression(void); |
---|
[219] | 81 | |
---|
| 82 | /// Destructeur /// |
---|
| 83 | virtual ~CFile(void); |
---|
| 84 | |
---|
| 85 | /// Autres /// |
---|
| 86 | virtual void parse(xml::CXMLNode & node); |
---|
| 87 | virtual StdString toString(void) const; |
---|
| 88 | |
---|
[369] | 89 | // virtual void toBinary (StdOStream & os) const; |
---|
| 90 | // virtual void fromBinary(StdIStream & is); |
---|
[219] | 91 | |
---|
| 92 | /// Accesseurs statiques /// |
---|
| 93 | static StdString GetName(void); |
---|
| 94 | static StdString GetDefName(void); |
---|
| 95 | |
---|
| 96 | static ENodeType GetType(void); |
---|
[300] | 97 | |
---|
[379] | 98 | bool allDomainEmpty ; |
---|
[347] | 99 | CField* addField(const string& id="") ; |
---|
| 100 | CFieldGroup* addFieldGroup(const string& id="") ; |
---|
[300] | 101 | void sendAddField(const string& id="") ; |
---|
| 102 | void sendAddFieldGroup(const string& id="") ; |
---|
| 103 | static void recvAddField(CEventServer& event) ; |
---|
| 104 | void recvAddField(CBufferIn& buffer) ; |
---|
| 105 | static void recvAddFieldGroup(CEventServer& event) ; |
---|
| 106 | void recvAddFieldGroup(CBufferIn& buffer) ; |
---|
| 107 | static bool dispatchEvent(CEventServer& event) ; |
---|
[318] | 108 | bool isSyncTime(void) ; |
---|
[321] | 109 | bool checkSplit(void) ; |
---|
| 110 | bool checkSync(void) ; |
---|
| 111 | void checkFile(void) ; |
---|
| 112 | void initFile(void) ; |
---|
[343] | 113 | CDate* lastSync ; |
---|
| 114 | CDate* lastSplit ; |
---|
| 115 | CDuration syncFreq ; |
---|
| 116 | CDuration splitFreq ; |
---|
| 117 | CDuration outputFreq ; |
---|
[318] | 118 | int nbDomain ; |
---|
[321] | 119 | bool isOpen ; |
---|
[379] | 120 | MPI_Comm fileComm ; |
---|
[219] | 121 | private : |
---|
| 122 | |
---|
| 123 | /// Propriétés privées /// |
---|
[347] | 124 | CFieldGroup* vFieldGroup; |
---|
[337] | 125 | boost::shared_ptr<CDataOutput> data_out; |
---|
[347] | 126 | std::vector<CField*> enabledFields; |
---|
[219] | 127 | |
---|
| 128 | }; // class CFile |
---|
| 129 | |
---|
| 130 | ///-------------------------------------------------------------- |
---|
| 131 | |
---|
| 132 | // Declare/Define CFileGroup and CFileDefinition |
---|
| 133 | DECLARE_GROUP(CFile); |
---|
| 134 | |
---|
| 135 | ///-------------------------------------------------------------- |
---|
| 136 | |
---|
[335] | 137 | } // namespace xios |
---|
[219] | 138 | |
---|
| 139 | #endif // __XMLIO_CFile__ |
---|