1 | /* ************************************************************************** * |
---|
2 | * Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011 * |
---|
3 | * ************************************************************************** */ |
---|
4 | |
---|
5 | #ifndef __GROUP_TEMPLATE_HPP__ |
---|
6 | #define __GROUP_TEMPLATE_HPP__ |
---|
7 | |
---|
8 | #ifndef __XIOS_NO_EXTERN |
---|
9 | |
---|
10 | // C++ standard headers |
---|
11 | #include <string> |
---|
12 | #include <iostream> |
---|
13 | #include <vector> |
---|
14 | |
---|
15 | // Boost headers |
---|
16 | #include <boost/shared_ptr.hpp> |
---|
17 | |
---|
18 | #endif // __XIOS_NO_EXTERN |
---|
19 | |
---|
20 | // XMLIOServer headers |
---|
21 | #include "xmlioserver_spl.hpp" |
---|
22 | #include "declare_attribute.hpp" |
---|
23 | #include "attribute_map.hpp" |
---|
24 | #include "xml_node.hpp" |
---|
25 | |
---|
26 | // ////////////////////////////// Déclarations ///////////////////////////// // |
---|
27 | |
---|
28 | namespace xmlioserver |
---|
29 | { |
---|
30 | template <class U, class V, class W> |
---|
31 | class CGroupTemplate |
---|
32 | : public CObjectTemplate<V>, public virtual W |
---|
33 | { |
---|
34 | public : // Classe amie |
---|
35 | |
---|
36 | friend class CGroupFactory; |
---|
37 | |
---|
38 | public : // // Définition de types |
---|
39 | |
---|
40 | typedef U Child; |
---|
41 | typedef V Derived, Group; |
---|
42 | typedef W SuperClassAttribute; |
---|
43 | typedef CObjectTemplate<V> SuperClass; |
---|
44 | |
---|
45 | public : // Attribut spécifique des groupes |
---|
46 | |
---|
47 | DECLARE_ATTRIBUTE(std::string, group_ref) |
---|
48 | |
---|
49 | public : // Accesseurs |
---|
50 | |
---|
51 | const xios_map<std::string, |
---|
52 | boost::shared_ptr<Group> > & getGroupMap(void) const; |
---|
53 | const std::vector<boost::shared_ptr<Child> > & getChildList(void) const; |
---|
54 | |
---|
55 | void getAllChildren(std::vector<boost::shared_ptr<Child> > & _allc) const; |
---|
56 | std::vector<boost::shared_ptr<Child> > getAllChildren(void) const; |
---|
57 | |
---|
58 | public : // Autres |
---|
59 | |
---|
60 | virtual std::string toString(void) const; |
---|
61 | virtual void fromString(const std::string & _str); |
---|
62 | |
---|
63 | virtual void toBinary (std::ostream & _os) const; |
---|
64 | virtual void fromBinary(std::istream & _is); |
---|
65 | |
---|
66 | virtual void parse(xml::CXMLNode & _node); |
---|
67 | inline void parse(xml::CXMLNode & _node, bool _withAttr); |
---|
68 | |
---|
69 | public : // Test |
---|
70 | |
---|
71 | virtual bool hasChild(void) const; |
---|
72 | |
---|
73 | public : // Accesseurs statiques |
---|
74 | |
---|
75 | static inline std::string GetName(void); |
---|
76 | static inline std::string GetDefName(void); |
---|
77 | |
---|
78 | public : // Traitements |
---|
79 | |
---|
80 | virtual void solveDescInheritance(const tree::CAttributeMap * const _parent = 0); |
---|
81 | void solveRefInheritance(void); |
---|
82 | |
---|
83 | public : // Destructeur |
---|
84 | |
---|
85 | virtual ~CGroupTemplate(void); |
---|
86 | |
---|
87 | protected : // Constructeurs |
---|
88 | |
---|
89 | CGroupTemplate(void); |
---|
90 | CGroupTemplate(const std::string & _id); |
---|
91 | CGroupTemplate(const CGroupTemplate<U, V, W> & _group_ref, |
---|
92 | bool _withAttrList = true, bool _withId = true); // Not implemented yet. |
---|
93 | CGroupTemplate(const CGroupTemplate<U, V, W> * const _group_ptr); // Not implemented yet. |
---|
94 | |
---|
95 | private : // Propriétés |
---|
96 | |
---|
97 | xios_map<std::string, |
---|
98 | boost::shared_ptr<Child> > childMap; |
---|
99 | std::vector<boost::shared_ptr<Child> > childList; |
---|
100 | |
---|
101 | xios_map<std::string, |
---|
102 | boost::shared_ptr<Group> > groupMap; |
---|
103 | std::vector<boost::shared_ptr<Group> > groupList; |
---|
104 | |
---|
105 | }; // class CGroupTemplate |
---|
106 | } // namespace xmlioserver |
---|
107 | |
---|
108 | #endif // __GROUP_TEMPLATE_HPP__ |
---|