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

Last change on this file since 359 was 347, checked in by ymipsl, 12 years ago
  • Supress lot of shared_ptr
  • instrument code for vampir-trace and timer diagnostic

YM

File size: 4.0 KB
RevLine 
[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]13namespace xios {
[219]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;
[300]37     
[219]38      public :
[300]39         enum EEventId
40         {
41           EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP
42         } ;
43         
[219]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 ///
[337]54         boost::shared_ptr<CDataOutput> getDataOutput(void) const;
[347]55         CFieldGroup* getVirtualFieldGroup(void) const;
56         std::vector<CField*> getAllFields(void) const;
[219]57
[347]58         std::vector<CField* > getEnabledFields(int default_outputlevel = 5,
59                                                int default_level = 1,
60                                                bool default_enabled = true);
[219]61
62      public :
63
64         /// Mutateurs ///
[347]65         void setVirtualFieldGroup(CFieldGroup* newVFieldGroup);
[300]66         void setVirtualFieldGroup(void);
[219]67
[300]68         void createHeader(void);
[286]69         void close(void) ;
70         
[219]71         /// Traitements ///
72         virtual void solveDescInheritance(const CAttributeMap * const parent = 0);
73         void solveFieldRefInheritance(void);
74         void solveEFGridRef(void);
75         void solveEFOperation(void);
76
77         /// Destructeur ///
78         virtual ~CFile(void);
79
80         /// Autres ///
81         virtual void parse(xml::CXMLNode & node);
82         virtual StdString toString(void) const;
83         
84         virtual void toBinary  (StdOStream & os) const;
85         virtual void fromBinary(StdIStream & is);
86
87         /// Accesseurs statiques ///
88         static StdString GetName(void);
89         static StdString GetDefName(void);
90         
91         static ENodeType GetType(void);
[300]92         
93         bool AllDomainEmpty ;
[347]94         CField* addField(const string& id="") ;
95         CFieldGroup* addFieldGroup(const string& id="") ;
[300]96         void sendAddField(const string& id="") ;
97         void sendAddFieldGroup(const string& id="") ;
98         static void recvAddField(CEventServer& event) ;
99         void recvAddField(CBufferIn& buffer) ;
100         static void recvAddFieldGroup(CEventServer& event) ;
101         void recvAddFieldGroup(CBufferIn& buffer) ;
102         static bool dispatchEvent(CEventServer& event) ;
[318]103         bool isSyncTime(void) ;
[321]104         bool checkSplit(void) ;
105         bool checkSync(void) ;
106         void checkFile(void) ;
107         void initFile(void) ;
[343]108         CDate* lastSync ;
109         CDate* lastSplit ;
110         CDuration syncFreq ;
111         CDuration splitFreq ;
112         CDuration outputFreq ;
[318]113         int nbDomain ;
[321]114         bool isOpen ;
[219]115      private :
116
117         /// Propriétés privées ///
[347]118         CFieldGroup* vFieldGroup;
[337]119         boost::shared_ptr<CDataOutput> data_out;
[347]120         std::vector<CField*> enabledFields;
[219]121
122   }; // class CFile
123
124   ///--------------------------------------------------------------
125
126   // Declare/Define CFileGroup and CFileDefinition
127   DECLARE_GROUP(CFile);
128
129   ///--------------------------------------------------------------
130
[335]131} // namespace xios
[219]132
133#endif // __XMLIO_CFile__
Note: See TracBrowser for help on using the repository browser.