source: XIOS/branchs/xios-1.0/src/node/context.hpp @ 504

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

Add licence copyright to all file ond directory src using the command :
svn propset -R copyright -F header_licence src

XIOS is now officialy under CeCILL licence

YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 5.0 KB
Line 
1#ifndef __XMLIO_CContext__
2#define __XMLIO_CContext__
3
4/// xios headers ///
5#include "xmlioserver_spl.hpp"
6//#include "node_type.hpp"
7#include "calendar.hpp"
8
9#include "declare_group.hpp"
10//#include "context_client.hpp"
11//#include "context_server.hpp"
12#include "data_output.hpp"
13
14#include "mpi.hpp"
15
16
17namespace xios {
18   class CContextClient ;
19   class CContextServer ;
20   
21   
22   /// ////////////////////// Déclarations ////////////////////// ///
23   class CContextGroup;
24   class CContextAttributes;
25   class CContext;
26   class CFile;
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   {
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         
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 ///
74         void setCalendar(boost::shared_ptr<CCalendar> newCalendar);
75     
76         /// Accesseurs ///
77         boost::shared_ptr<CCalendar>      getCalendar(void) const;
78
79         /// Accesseurs statiques ///
80         static StdString GetName(void);
81         static StdString GetDefName(void);         
82         static ENodeType GetType(void);         
83
84         static CContextGroup* GetContextGroup(void);
85
86      public :
87
88         /// Traitements ///
89         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
90         void solveFieldRefInheritance(bool apply);
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;
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         bool isInitialized(void) ;
106         CContextServer* server ;
107         CContextClient* client ;
108         bool hasClient ;
109         bool hasServer ;
110         void finalize(void) ;
111         void closeDefinition(void) ;
112         void findAllEnabledFields(void);
113         void processEnabledFiles(void) ;
114         void solveAllGridRef(void);
115         void solveAllOperation(void);
116         void solveAllExpression(void);
117         void solveAllInheritance(bool apply=true) ;
118         void findEnabledFiles(void);
119         void closeAllFile(void) ;
120         void updateCalendar(int step) ;
121         void createFileHeader(void ) ;
122      // dispatch event
123         static bool dispatchEvent(CEventServer& event) ;
124         void sendCloseDefinition(void) ;
125         void sendUpdateCalendar(int step) ;
126         void sendCreateFileHeader(void) ;
127         static void recvUpdateCalendar(CEventServer& event) ;
128         void recvUpdateCalendar(CBufferIn& buffer) ;
129         static void recvCloseDefinition(CEventServer& event) ;
130         static void recvCreateFileHeader(CEventServer& event) ;
131         void recvCreateFileHeader(CBufferIn& buffer) ;
132         static CContext* getCurrent(void) ;
133         static CContextGroup* getRoot(void) ;
134         static void setCurrent(const string& id) ;
135         static CContext* create(const string& id = "") ;
136         
137      public :
138     
139         /// Autres ///
140         virtual void parse(xml::CXMLNode & node);
141
142         virtual StdString toString(void) const;
143//         virtual void toBinary  (StdOStream & os) const;
144//         virtual void fromBinary(StdIStream & is);
145         
146      public :
147     
148         boost::shared_ptr<CCalendar>      calendar;
149 
150         std::vector<CFile*> enabledFiles;
151         static shared_ptr<CContextGroup> root ;
152
153
154   }; // class CContext
155
156   ///--------------------------------------------------------------
157
158   // Declare/Define CContextGroup and CContextDefinition
159   DECLARE_GROUP(CContext);
160
161   ///--------------------------------------------------------------
162
163} // namespace xios
164
165#endif // __XMLIO_CContext__
Note: See TracBrowser for help on using the repository browser.