source: XIOS/dev/dev_olga/src/group_template.hpp @ 1009

Last change on this file since 1009 was 1009, checked in by oabramkina, 7 years ago

First working version with compression by secondary servers.

  • 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: 3.5 KB
Line 
1#ifndef __XIOS_CGroupTemplate__
2#define __XIOS_CGroupTemplate__
3
4#include "xios_spl.hpp"
5#include "declare_attribute.hpp"
6#include "event_server.hpp"
7#include "object_template.hpp"
8
9namespace xios
10{
11
12   /// ////////////////////// Déclarations ////////////////////// ///
13   template <class U, class V, class W>
14      class CGroupTemplate
15         : public CObjectTemplate<V>, public virtual W
16   {
17         /// Friend ///
18         friend class CGroupFactory;
19
20         /// Typedef ///
21         typedef U Child;
22         typedef V Derived, Group;
23         typedef W SuperClassAttribute;
24         typedef CObjectTemplate<V> SuperClass;
25
26      public :
27     
28         enum EEventId
29         {
30           EVENT_ID_CREATE_CHILD=200, EVENT_ID_CREATE_CHILD_GROUP
31         } ;
32
33         /// Spécifique ///
34         DECLARE_ATTRIBUTE(StdString, group_ref)
35
36         /// Accesseurs ///
37         const xios_map<StdString,Group*>& getGroupMap(void) const;
38         const vector<Child*>& getChildList(void) const;
39
40         void getAllChildren(vector<Child*> & allc) const;
41         vector<Child*> getAllChildren(void) const;
42
43         /// Autres ///
44         virtual StdString toString(void) const;
45         virtual void fromString(const StdString & str);
46         
47//         virtual void toBinary  (StdOStream & os) const;
48//         virtual void fromBinary(StdIStream & is);
49
50         virtual void parse(xml::CXMLNode & node);
51         virtual void parse(xml::CXMLNode & node, bool withAttr);
52         virtual void parseChild(xml::CXMLNode & node);
53       
54         /// Test ///
55         virtual bool hasChild(void) const;
56
57         /// Accesseurs statiques ///
58         static StdString GetName(void);
59         static StdString GetDefName(void);
60
61         /// Traitements ///
62         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
63         void solveRefInheritance(void);
64//         static bool has(const string & id);
65//         static boost::shared_ptr<V> get(const string& id) ;
66//         static boost::shared_ptr<V> create(const string& id=string("")) ;
67         U* createChild(const string& id="") ;
68         
69         void addChild(U* child) ; 
70         V* createChildGroup(const string& id="") ; 
71         void addChildGroup(V* childGroup) ; 
72         static bool dispatchEvent(CEventServer& event) ;
73         void sendCreateChild(const string& id="") ;
74         void sendCreateChild(const string& id, const int srvPool) ;
75         void sendCreateChildGroup(const string& id="") ;
76         static void recvCreateChild(CEventServer& event) ;
77         void recvCreateChild(CBufferIn& buffer) ;
78         static void recvCreateChildGroup(CEventServer& event) ;
79         void recvCreateChildGroup(CBufferIn& buffer) ;
80         
81         /// Destructeur ///
82         virtual ~CGroupTemplate(void);
83
84      protected :
85
86         /// Constructeurs ///
87         CGroupTemplate(void);
88         CGroupTemplate(const StdString & id);
89         CGroupTemplate(const CGroupTemplate<U, V, W> & group,
90                        bool withAttrList = true, bool withId = true); // Not implemented yet.
91         CGroupTemplate(const CGroupTemplate<U, V, W> * const group);  // Not implemented yet.
92
93      private :
94
95         /// Propriétés ///
96         xios_map<StdString, Child* > childMap;
97         vector<Child*> childList;
98
99         xios_map<StdString,Group* > groupMap;
100         vector<Group* > groupList;
101
102   }; // class CGroupTemplate
103} // namespace xios
104
105//#include "group_template_impl.hpp"
106
107#endif // __XIOS_CGroupTemplate__
Note: See TracBrowser for help on using the repository browser.