source: XIOS/dev/common/src/group_template.hpp @ 1512

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

nouvelle version de developpement de xios

  • nouvelle interface fortran
  • recodage complet de la couche de communication
  • et bien d'autres choses...

YM

File size: 3.6 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 xmlioserver
10{
11   using namespace tree;
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,
39                           boost::shared_ptr<Group> >& getGroupMap(void) const;
40         const std::vector<boost::shared_ptr<Child> >& getChildList(void) const;
41
42         void getAllChildren(std::vector<boost::shared_ptr<Child> > & allc) const;
43         std::vector<boost::shared_ptr<Child> > getAllChildren(void) const;
44
45         /// Autres ///
46         virtual StdString toString(void) const;
47         virtual void fromString(const StdString & str);
48         
49         virtual void toBinary  (StdOStream & os) const;
50         virtual void fromBinary(StdIStream & is);
51
52         virtual void parse(xml::CXMLNode & node);
53         virtual void parse(xml::CXMLNode & node, bool withAttr);
54         
55         /// Test ///
56         virtual bool hasChild(void) const;
57
58         /// Accesseurs statiques ///
59         static inline StdString GetName(void);
60         static inline StdString GetDefName(void);
61
62         /// Traitements ///
63         virtual void solveDescInheritance(const CAttributeMap * const parent = 0);
64         void solveRefInheritance(void);
65//         static bool has(const string & id);
66//         static boost::shared_ptr<V> get(const string& id) ;
67//         static boost::shared_ptr<V> create(const string& id=string("")) ;
68         boost::shared_ptr<U> createChild(const string& id="") ; 
69         boost::shared_ptr<V> createChildGroup(const string& id="") ; 
70         static bool dispatchEvent(CEventServer& event) ;
71         void sendCreateChild(const string& id="") ;
72         void sendCreateChildGroup(const string& id="") ;
73         static void recvCreateChild(CEventServer& event) ;
74         void recvCreateChild(CBufferIn& buffer) ;
75         static void recvCreateChildGroup(CEventServer& event) ;
76         void recvCreateChildGroup(CBufferIn& buffer) ;
77         
78         /// Destructeur ///
79         virtual ~CGroupTemplate(void);
80
81      protected :
82
83         /// Constructeurs ///
84         CGroupTemplate(void);
85         CGroupTemplate(const StdString & id);
86         CGroupTemplate(const CGroupTemplate<U, V, W> & group,
87                        bool withAttrList = true, bool withId = true); // Not implemented yet.
88         CGroupTemplate(const CGroupTemplate<U, V, W> * const group);  // Not implemented yet.
89
90      private :
91
92         /// Propriétés ///
93         xios_map<StdString,
94                     boost::shared_ptr<Child> > childMap;
95         std::vector<boost::shared_ptr<Child> > childList;
96
97         xios_map<StdString,
98                     boost::shared_ptr<Group> > groupMap;
99         std::vector<boost::shared_ptr<Group> > groupList;
100
101   }; // class CGroupTemplate
102} // namespace xmlioserver
103
104//#include "group_template_impl.hpp"
105
106#endif // __XMLIO_CGroupTemplate__
Note: See TracBrowser for help on using the repository browser.