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 | |
---|
9 | namespace 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 sendCreateChildGroup(const string& id="") ; |
---|
75 | static void recvCreateChild(CEventServer& event) ; |
---|
76 | void recvCreateChild(CBufferIn& buffer) ; |
---|
77 | static void recvCreateChildGroup(CEventServer& event) ; |
---|
78 | void recvCreateChildGroup(CBufferIn& buffer) ; |
---|
79 | |
---|
80 | /// Destructeur /// |
---|
81 | virtual ~CGroupTemplate(void); |
---|
82 | |
---|
83 | protected : |
---|
84 | |
---|
85 | /// Constructeurs /// |
---|
86 | CGroupTemplate(void); |
---|
87 | CGroupTemplate(const StdString & id); |
---|
88 | CGroupTemplate(const CGroupTemplate<U, V, W> & group, |
---|
89 | bool withAttrList = true, bool withId = true); // Not implemented yet. |
---|
90 | CGroupTemplate(const CGroupTemplate<U, V, W> * const group); // Not implemented yet. |
---|
91 | |
---|
92 | private : |
---|
93 | |
---|
94 | /// Propriétés /// |
---|
95 | xios_map<StdString, Child* > childMap; |
---|
96 | vector<Child*> childList; |
---|
97 | |
---|
98 | xios_map<StdString,Group* > groupMap; |
---|
99 | vector<Group* > groupList; |
---|
100 | |
---|
101 | }; // class CGroupTemplate |
---|
102 | } // namespace xios |
---|
103 | |
---|
104 | //#include "group_template_impl.hpp" |
---|
105 | |
---|
106 | #endif // __XMLIO_CGroupTemplate__ |
---|