source: XIOS3/trunk/src/group_template.hpp

Last change on this file was 2614, checked in by ymipsl, 4 months ago
  • Permit now usage of contex_group into xml file for more modularity
  • Src path is now relative to parent file, except if path is an absolute path

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