[591] | 1 | #ifndef __XIOS_CGroupTemplate__ |
---|
| 2 | #define __XIOS_CGroupTemplate__ |
---|
[219] | 3 | |
---|
[591] | 4 | #include "xios_spl.hpp" |
---|
[219] | 5 | #include "declare_attribute.hpp" |
---|
[300] | 6 | #include "event_server.hpp" |
---|
| 7 | #include "object_template.hpp" |
---|
[1021] | 8 | #include "context_client.hpp" |
---|
[219] | 9 | |
---|
[335] | 10 | namespace xios |
---|
[219] | 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 : |
---|
[300] | 28 | |
---|
| 29 | enum EEventId |
---|
| 30 | { |
---|
| 31 | EVENT_ID_CREATE_CHILD=200, EVENT_ID_CREATE_CHILD_GROUP |
---|
| 32 | } ; |
---|
[219] | 33 | |
---|
| 34 | /// Spécifique /// |
---|
| 35 | DECLARE_ATTRIBUTE(StdString, group_ref) |
---|
| 36 | |
---|
| 37 | /// Accesseurs /// |
---|
[347] | 38 | const xios_map<StdString,Group*>& getGroupMap(void) const; |
---|
| 39 | const vector<Child*>& getChildList(void) const; |
---|
[219] | 40 | |
---|
[347] | 41 | void getAllChildren(vector<Child*> & allc) const; |
---|
| 42 | vector<Child*> getAllChildren(void) const; |
---|
[219] | 43 | |
---|
| 44 | /// Autres /// |
---|
| 45 | virtual StdString toString(void) const; |
---|
| 46 | virtual void fromString(const StdString & str); |
---|
| 47 | |
---|
[369] | 48 | // virtual void toBinary (StdOStream & os) const; |
---|
| 49 | // virtual void fromBinary(StdIStream & is); |
---|
[219] | 50 | |
---|
| 51 | virtual void parse(xml::CXMLNode & node); |
---|
[274] | 52 | virtual void parse(xml::CXMLNode & node, bool withAttr); |
---|
[472] | 53 | virtual void parseChild(xml::CXMLNode & node); |
---|
| 54 | |
---|
[219] | 55 | /// Test /// |
---|
| 56 | virtual bool hasChild(void) const; |
---|
| 57 | |
---|
| 58 | /// Accesseurs statiques /// |
---|
[354] | 59 | static StdString GetName(void); |
---|
| 60 | static StdString GetDefName(void); |
---|
[219] | 61 | |
---|
| 62 | /// Traitements /// |
---|
[445] | 63 | virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); |
---|
[219] | 64 | void solveRefInheritance(void); |
---|
[300] | 65 | // static bool has(const string & id); |
---|
[1542] | 66 | // static std::shared_ptr<V> get(const string& id) ; |
---|
| 67 | // static std::shared_ptr<V> create(const string& id=string("")) ; |
---|
[347] | 68 | U* createChild(const string& id="") ; |
---|
| 69 | |
---|
| 70 | void addChild(U* child) ; |
---|
| 71 | V* createChildGroup(const string& id="") ; |
---|
| 72 | void addChildGroup(V* childGroup) ; |
---|
[300] | 73 | static bool dispatchEvent(CEventServer& event) ; |
---|
| 74 | void sendCreateChild(const string& id="") ; |
---|
[1021] | 75 | void sendCreateChild(const string& id, CContextClient* client) ; |
---|
[300] | 76 | void sendCreateChildGroup(const string& id="") ; |
---|
| 77 | static void recvCreateChild(CEventServer& event) ; |
---|
| 78 | void recvCreateChild(CBufferIn& buffer) ; |
---|
| 79 | static void recvCreateChildGroup(CEventServer& event) ; |
---|
| 80 | void recvCreateChildGroup(CBufferIn& buffer) ; |
---|
| 81 | |
---|
[219] | 82 | /// Destructeur /// |
---|
| 83 | virtual ~CGroupTemplate(void); |
---|
| 84 | |
---|
| 85 | protected : |
---|
| 86 | |
---|
| 87 | /// Constructeurs /// |
---|
| 88 | CGroupTemplate(void); |
---|
| 89 | CGroupTemplate(const StdString & id); |
---|
| 90 | CGroupTemplate(const CGroupTemplate<U, V, W> & group, |
---|
| 91 | bool withAttrList = true, bool withId = true); // Not implemented yet. |
---|
| 92 | CGroupTemplate(const CGroupTemplate<U, V, W> * const group); // Not implemented yet. |
---|
| 93 | |
---|
| 94 | private : |
---|
| 95 | |
---|
| 96 | /// Propriétés /// |
---|
[347] | 97 | xios_map<StdString, Child* > childMap; |
---|
| 98 | vector<Child*> childList; |
---|
[219] | 99 | |
---|
[347] | 100 | xios_map<StdString,Group* > groupMap; |
---|
| 101 | vector<Group* > groupList; |
---|
[219] | 102 | |
---|
| 103 | }; // class CGroupTemplate |
---|
[335] | 104 | } // namespace xios |
---|
[219] | 105 | |
---|
[300] | 106 | //#include "group_template_impl.hpp" |
---|
| 107 | |
---|
[591] | 108 | #endif // __XIOS_CGroupTemplate__ |
---|