source: XIOS/dev/dev_olga/src/group_template.hpp @ 1620

Last change on this file since 1620 was 1542, checked in by oabramkina, 6 years ago

Replacing Boost's unordered_map and shared_pointer by its STL counterparts.

Two notes for Curie:

  • one can see the content of unordered_map with ddt only if XIOS has been compiled with gnu
  • XIOS will not compile any more with pgi (all available versions use old STL which are not up to the c++11 norms)
  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 3.5 KB
Line 
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
10namespace 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//         virtual void toBinary  (StdOStream & os) const;
49//         virtual void fromBinary(StdIStream & is);
50
51         virtual void parse(xml::CXMLNode & node);
52         virtual void parse(xml::CXMLNode & node, bool withAttr);
53         virtual void parseChild(xml::CXMLNode & node);
54       
55         /// Test ///
56         virtual bool hasChild(void) const;
57
58         /// Accesseurs statiques ///
59         static StdString GetName(void);
60         static StdString GetDefName(void);
61
62         /// Traitements ///
63         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0);
64         void solveRefInheritance(void);
65//         static bool has(const string & id);
66//         static std::shared_ptr<V> get(const string& id) ;
67//         static std::shared_ptr<V> create(const string& id=string("")) ;
68         U* createChild(const string& id="") ;
69         
70         void addChild(U* child) ; 
71         V* createChildGroup(const string& id="") ; 
72         void addChildGroup(V* childGroup) ; 
73         static bool dispatchEvent(CEventServer& event) ;
74         void sendCreateChild(const string& id="") ;
75         void sendCreateChild(const string& id, CContextClient* client) ;
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         
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 ///
97         xios_map<StdString, Child* > childMap;
98         vector<Child*> childList;
99
100         xios_map<StdString,Group* > groupMap;
101         vector<Group* > groupList;
102
103   }; // class CGroupTemplate
104} // namespace xios
105
106//#include "group_template_impl.hpp"
107
108#endif // __XIOS_CGroupTemplate__
Note: See TracBrowser for help on using the repository browser.