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

Last change on this file since 318 was 318, checked in by ymipsl, 12 years ago
  • Adding new file attribut : sync_freq : flush file for a given frequency
  • Now, when a file has a single domain, domain id is not anymore appended to the coordinate name.

YM

File size: 3.9 KB
Line 
1#ifndef __XMLIO_CFile__
2#define __XMLIO_CFile__
3
4/// xmlioserver 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 xmlioserver {
14namespace 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;
38     
39      public :
40         enum EEventId
41         {
42           EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP
43         } ;
44         
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);
68         void setVirtualFieldGroup(void);
69
70         void createHeader(void);
71         void close(void) ;
72         
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);
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) ;
105         bool isSyncTime(void) ;
106         date::CDate* lastSync ;
107         date::CDuration syncFreq ;
108         int nbDomain ;
109      private :
110
111         /// Propriétés privées ///
112         boost::shared_ptr<CFieldGroup> vFieldGroup;
113         boost::shared_ptr<io::CDataOutput> data_out;
114         std::vector<boost::shared_ptr<CField> > enabledFields;
115
116   }; // class CFile
117
118   ///--------------------------------------------------------------
119
120   // Declare/Define CFileGroup and CFileDefinition
121   DECLARE_GROUP(CFile);
122
123   ///--------------------------------------------------------------
124
125} // namespace tree
126} // namespace xmlioserver
127
128#endif // __XMLIO_CFile__
Note: See TracBrowser for help on using the repository browser.