[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" |
---|
[219] | 8 | |
---|
[335] | 9 | namespace xios |
---|
[219] | 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 : |
---|
[300] | 27 | |
---|
| 28 | enum EEventId |
---|
| 29 | { |
---|
| 30 | EVENT_ID_CREATE_CHILD=200, EVENT_ID_CREATE_CHILD_GROUP |
---|
| 31 | } ; |
---|
[219] | 32 | |
---|
| 33 | /// Spécifique /// |
---|
| 34 | DECLARE_ATTRIBUTE(StdString, group_ref) |
---|
| 35 | |
---|
| 36 | /// Accesseurs /// |
---|
[347] | 37 | const xios_map<StdString,Group*>& getGroupMap(void) const; |
---|
| 38 | const vector<Child*>& getChildList(void) const; |
---|
[219] | 39 | |
---|
[347] | 40 | void getAllChildren(vector<Child*> & allc) const; |
---|
| 41 | vector<Child*> getAllChildren(void) const; |
---|
[219] | 42 | |
---|
| 43 | /// Autres /// |
---|
| 44 | virtual StdString toString(void) const; |
---|
| 45 | virtual void fromString(const StdString & str); |
---|
| 46 | |
---|
[369] | 47 | // virtual void toBinary (StdOStream & os) const; |
---|
| 48 | // virtual void fromBinary(StdIStream & is); |
---|
[219] | 49 | |
---|
| 50 | virtual void parse(xml::CXMLNode & node); |
---|
[274] | 51 | virtual void parse(xml::CXMLNode & node, bool withAttr); |
---|
[472] | 52 | virtual void parseChild(xml::CXMLNode & node); |
---|
| 53 | |
---|
[219] | 54 | /// Test /// |
---|
| 55 | virtual bool hasChild(void) const; |
---|
| 56 | |
---|
| 57 | /// Accesseurs statiques /// |
---|
[354] | 58 | static StdString GetName(void); |
---|
| 59 | static StdString GetDefName(void); |
---|
[219] | 60 | |
---|
| 61 | /// Traitements /// |
---|
[445] | 62 | virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); |
---|
[219] | 63 | void solveRefInheritance(void); |
---|
[300] | 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("")) ; |
---|
[347] | 67 | U* createChild(const string& id="") ; |
---|
| 68 | |
---|
| 69 | void addChild(U* child) ; |
---|
| 70 | V* createChildGroup(const string& id="") ; |
---|
| 71 | void addChildGroup(V* childGroup) ; |
---|
[300] | 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 | |
---|
[219] | 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 /// |
---|
[347] | 95 | xios_map<StdString, Child* > childMap; |
---|
| 96 | vector<Child*> childList; |
---|
[219] | 97 | |
---|
[347] | 98 | xios_map<StdString,Group* > groupMap; |
---|
| 99 | vector<Group* > groupList; |
---|
[219] | 100 | |
---|
| 101 | }; // class CGroupTemplate |
---|
[335] | 102 | } // namespace xios |
---|
[219] | 103 | |
---|
[300] | 104 | //#include "group_template_impl.hpp" |
---|
| 105 | |
---|
[591] | 106 | #endif // __XIOS_CGroupTemplate__ |
---|