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 | |
---|
10 | namespace 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 vector<Child*>& getChildList(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 | |
---|
49 | virtual void parse(xml::CXMLNode & node); |
---|
50 | virtual void parse(xml::CXMLNode & node, bool withAttr); |
---|
51 | virtual void parseChild(xml::CXMLNode & node); |
---|
52 | |
---|
53 | /// Test /// |
---|
54 | virtual bool hasChild(void) const; |
---|
55 | |
---|
56 | /// Accesseurs statiques /// |
---|
57 | static StdString GetName(void); |
---|
58 | static StdString GetDefName(void); |
---|
59 | |
---|
60 | /// Traitements /// |
---|
61 | virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); |
---|
62 | void solveRefInheritance(void); |
---|
63 | |
---|
64 | |
---|
65 | U* createChild(const string& id="") ; |
---|
66 | |
---|
67 | void addChild(U* child) ; |
---|
68 | V* createChildGroup(const string& id="") ; |
---|
69 | void addChildGroup(V* childGroup) ; |
---|
70 | static bool dispatchEvent(CEventServer& event) ; |
---|
71 | void sendCreateChild(const string& id="") ; |
---|
72 | void sendCreateChild(const string& id, CContextClient* client) ; |
---|
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, Child* > childMap; |
---|
95 | vector<Child*> childList; |
---|
96 | |
---|
97 | xios_map<StdString,Group* > groupMap; |
---|
98 | vector<Group* > groupList; |
---|
99 | |
---|
100 | }; // class CGroupTemplate |
---|
101 | } // namespace xios |
---|
102 | |
---|
103 | //#include "group_template_impl.hpp" |
---|
104 | |
---|
105 | #endif // __XIOS_CGroupTemplate__ |
---|