source: XIOS/trunk/src/group_template.hpp @ 346

Last change on this file since 346 was 346, checked in by ymipsl, 12 years ago

Suppress access to CObjectFactory class and CTreeManager.

YM

File size: 3.6 KB
Line 
1#ifndef __XMLIO_CGroupTemplate__
2#define __XMLIO_CGroupTemplate__
3
4#include "xmlioserver_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,
38                           boost::shared_ptr<Group> >& getGroupMap(void) const;
39         const std::vector<boost::shared_ptr<Child> >& getChildList(void) const;
40
41         void getAllChildren(std::vector<boost::shared_ptr<Child> > & allc) const;
42         std::vector<boost::shared_ptr<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         
54         /// Test ///
55         virtual bool hasChild(void) const;
56
57         /// Accesseurs statiques ///
58         static inline StdString GetName(void);
59         static inline StdString GetDefName(void);
60
61         /// Traitements ///
62         virtual void solveDescInheritance(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         boost::shared_ptr<U> createChild(const string& id="") ; 
68         void addChild(shared_ptr<U> child) ; 
69         boost::shared_ptr<V> createChildGroup(const string& id="") ; 
70         void addChildGroup(shared_ptr<V> childGroup) ; 
71         static bool dispatchEvent(CEventServer& event) ;
72         void sendCreateChild(const string& id="") ;
73         void sendCreateChildGroup(const string& id="") ;
74         static void recvCreateChild(CEventServer& event) ;
75         void recvCreateChild(CBufferIn& buffer) ;
76         static void recvCreateChildGroup(CEventServer& event) ;
77         void recvCreateChildGroup(CBufferIn& buffer) ;
78         
79         /// Destructeur ///
80         virtual ~CGroupTemplate(void);
81
82      protected :
83
84         /// Constructeurs ///
85         CGroupTemplate(void);
86         CGroupTemplate(const StdString & id);
87         CGroupTemplate(const CGroupTemplate<U, V, W> & group,
88                        bool withAttrList = true, bool withId = true); // Not implemented yet.
89         CGroupTemplate(const CGroupTemplate<U, V, W> * const group);  // Not implemented yet.
90
91      private :
92
93         /// Propriétés ///
94         xios_map<StdString,
95                     boost::shared_ptr<Child> > childMap;
96         std::vector<boost::shared_ptr<Child> > childList;
97
98         xios_map<StdString,
99                     boost::shared_ptr<Group> > groupMap;
100         std::vector<boost::shared_ptr<Group> > groupList;
101
102   }; // class CGroupTemplate
103} // namespace xios
104
105//#include "group_template_impl.hpp"
106
107#endif // __XMLIO_CGroupTemplate__
Note: See TracBrowser for help on using the repository browser.