source: XIOS/trunk/src/node/context.hpp @ 459

Last change on this file since 459 was 459, checked in by ymipsl, 10 years ago

Add new parsing expression functionnalities
(modified files)

YM

File size: 4.9 KB
RevLine 
[219]1#ifndef __XMLIO_CContext__
2#define __XMLIO_CContext__
3
[335]4/// xios headers ///
[219]5#include "xmlioserver_spl.hpp"
[352]6//#include "node_type.hpp"
[219]7#include "calendar.hpp"
8
9#include "declare_group.hpp"
[300]10//#include "context_client.hpp"
11//#include "context_server.hpp"
12#include "data_output.hpp"
[219]13
[382]14#include "mpi.hpp"
[300]15
[219]16
[335]17namespace xios {
[300]18   class CContextClient ;
19   class CContextServer ;
20   
[219]21   
22   /// ////////////////////// Déclarations ////////////////////// ///
23   class CContextGroup;
24   class CContextAttributes;
25   class CContext;
[352]26   class CFile;
[219]27   ///--------------------------------------------------------------
28
29   // Declare/Define CFileAttribute
30   BEGIN_DECLARE_ATTRIBUTE_MAP(CContext)
31#  include "context_attribute.conf"
32   END_DECLARE_ATTRIBUTE_MAP(CContext)
33
34   ///--------------------------------------------------------------
35
36   class CContext
37      : public CObjectTemplate<CContext>
38      , public CContextAttributes
39   {
[300]40         public :
41         enum EEventId
42         {
43           EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR,
44           EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE
45         } ;
46         
[219]47         /// typedef ///
48         typedef CObjectTemplate<CContext>   SuperClass;
49         typedef CContextAttributes SuperClassAttribute;
50
51      public :
52
53         typedef CContextAttributes RelAttributes;
54         typedef CContext           RelGroup;
55
56         //---------------------------------------------------------
57
58      public :
59
60         /// Constructeurs ///
61         CContext(void);
62         explicit CContext(const StdString & id);
63         CContext(const CContext & context);       // Not implemented yet.
64         CContext(const CContext * const context); // Not implemented yet.
65
66         /// Destructeur ///
67         virtual ~CContext(void);
68
69         //---------------------------------------------------------
70
71      public :
72     
73         /// Mutateurs ///
[343]74         void setCalendar(boost::shared_ptr<CCalendar> newCalendar);
[219]75     
76         /// Accesseurs ///
[343]77         boost::shared_ptr<CCalendar>      getCalendar(void) const;
[219]78
79         /// Accesseurs statiques ///
80         static StdString GetName(void);
81         static StdString GetDefName(void);         
82         static ENodeType GetType(void);         
83
[347]84         static CContextGroup* GetContextGroup(void);
[219]85
86      public :
87
88         /// Traitements ///
[445]89         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
90         void solveFieldRefInheritance(bool apply);
[219]91         void solveCalendar(void);
92
93         /// Autres méthodes statiques ///
94         static void ShowTree(StdOStream & out = std::clog);
95         static void CleanTree(void);
96
97         /// Test ///
98         virtual bool hasChild(void) const;
[300]99
100         bool eventLoop(void) ;
101         bool serverLoop(void) ;
102         void clientLoop(void) ;
103         void initServer(MPI_Comm intraComm, MPI_Comm interComm) ;
104         void initClient(MPI_Comm intraComm, MPI_Comm interComm) ;
105         CContextServer* server ;
106         CContextClient* client ;
107         bool hasClient ;
108         bool hasServer ;
109         void finalize(void) ;
110         void closeDefinition(void) ;
111         void findAllEnabledFields(void);
[459]112         void processEnabledFiles(void) ;
[300]113         void solveAllGridRef(void);
114         void solveAllOperation(void);
[459]115         void solveAllExpression(void);
[445]116         void solveAllInheritance(bool apply=true) ;
[300]117         void findEnabledFiles(void);
118         void closeAllFile(void) ;
119         void updateCalendar(int step) ;
120         void createFileHeader(void ) ;
121      // dispatch event
122         static bool dispatchEvent(CEventServer& event) ;
123         void sendCloseDefinition(void) ;
124         void sendUpdateCalendar(int step) ;
125         void sendCreateFileHeader(void) ;
126         static void recvUpdateCalendar(CEventServer& event) ;
127         void recvUpdateCalendar(CBufferIn& buffer) ;
128         static void recvCloseDefinition(CEventServer& event) ;
129         static void recvCreateFileHeader(CEventServer& event) ;
130         void recvCreateFileHeader(CBufferIn& buffer) ;
[347]131         static CContext* getCurrent(void) ;
132         static CContextGroup* getRoot(void) ;
[346]133         static void setCurrent(const string& id) ;
[347]134         static CContext* create(const string& id = "") ;
[219]135         
136      public :
137     
138         /// Autres ///
139         virtual void parse(xml::CXMLNode & node);
140
141         virtual StdString toString(void) const;
[369]142//         virtual void toBinary  (StdOStream & os) const;
143//         virtual void fromBinary(StdIStream & is);
[219]144         
[300]145      public :
[219]146     
[343]147         boost::shared_ptr<CCalendar>      calendar;
[300]148 
[347]149         std::vector<CFile*> enabledFiles;
[346]150         static shared_ptr<CContextGroup> root ;
[219]151
[300]152
[219]153   }; // class CContext
154
155   ///--------------------------------------------------------------
156
157   // Declare/Define CContextGroup and CContextDefinition
158   DECLARE_GROUP(CContext);
159
160   ///--------------------------------------------------------------
161
[335]162} // namespace xios
[219]163
164#endif // __XMLIO_CContext__
Note: See TracBrowser for help on using the repository browser.