source: XIOS/trunk/src/node/file.hpp @ 345

Last change on this file since 345 was 345, checked in by ymipsl, 12 years ago

removed "tree" namespace

YM

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