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

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

removed "tree" namespace

YM

File size: 3.5 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         boost::shared_ptr<V> createChildGroup(const string& id="") ; 
69         static bool dispatchEvent(CEventServer& event) ;
70         void sendCreateChild(const string& id="") ;
71         void sendCreateChildGroup(const string& id="") ;
72         static void recvCreateChild(CEventServer& event) ;
73         void recvCreateChild(CBufferIn& buffer) ;
74         static void recvCreateChildGroup(CEventServer& event) ;
75         void recvCreateChildGroup(CBufferIn& buffer) ;
76         
77         /// Destructeur ///
78         virtual ~CGroupTemplate(void);
79
80      protected :
81
82         /// Constructeurs ///
83         CGroupTemplate(void);
84         CGroupTemplate(const StdString & id);
85         CGroupTemplate(const CGroupTemplate<U, V, W> & group,
86                        bool withAttrList = true, bool withId = true); // Not implemented yet.
87         CGroupTemplate(const CGroupTemplate<U, V, W> * const group);  // Not implemented yet.
88
89      private :
90
91         /// Propriétés ///
92         xios_map<StdString,
93                     boost::shared_ptr<Child> > childMap;
94         std::vector<boost::shared_ptr<Child> > childList;
95
96         xios_map<StdString,
97                     boost::shared_ptr<Group> > groupMap;
98         std::vector<boost::shared_ptr<Group> > groupList;
99
100   }; // class CGroupTemplate
101} // namespace xios
102
103//#include "group_template_impl.hpp"
104
105#endif // __XMLIO_CGroupTemplate__
Note: See TracBrowser for help on using the repository browser.