1 | #ifndef __XMLIO_CObjectTemplate_impl__ |
---|
2 | #define __XMLIO_CObjectTemplate_impl__ |
---|
3 | |
---|
4 | namespace xmlioserver |
---|
5 | { |
---|
6 | /// ////////////////////// Définitions ////////////////////// /// |
---|
7 | template <class T> |
---|
8 | xios_map<StdString, |
---|
9 | xios_map<StdString, |
---|
10 | boost::shared_ptr<T> > > CObjectTemplate<T>::AllMapObj; |
---|
11 | |
---|
12 | template <class T> |
---|
13 | xios_map<StdString, |
---|
14 | std::vector<boost::shared_ptr<T> > > CObjectTemplate<T>::AllVectObj; |
---|
15 | |
---|
16 | template <class T> |
---|
17 | xios_map<StdString,long int> CObjectTemplate<T>::GenId; |
---|
18 | |
---|
19 | template <class T> |
---|
20 | CObjectTemplate<T>::CObjectTemplate(void) |
---|
21 | : tree::CAttributeMap() |
---|
22 | , CObject() |
---|
23 | { /* Ne rien faire de plus */ } |
---|
24 | |
---|
25 | template <class T> |
---|
26 | CObjectTemplate<T>::CObjectTemplate(const StdString & id) |
---|
27 | : tree::CAttributeMap() |
---|
28 | , CObject(id) |
---|
29 | { /* Ne rien faire de plus */ } |
---|
30 | |
---|
31 | template <class T> |
---|
32 | CObjectTemplate<T>::CObjectTemplate |
---|
33 | (const CObjectTemplate<T> & object, bool withAttrList, bool withId) |
---|
34 | : tree::CAttributeMap() |
---|
35 | , CObject() |
---|
36 | { |
---|
37 | if (object.hasId() && withId) |
---|
38 | this->setId(object.getId()); |
---|
39 | ERROR("CObjectTemplate<T> construtor 3", << "Not completly implemented yet !"); |
---|
40 | } |
---|
41 | |
---|
42 | template <class T> |
---|
43 | CObjectTemplate<T>::~CObjectTemplate(void) |
---|
44 | { /* Ne rien faire de plus */ } |
---|
45 | |
---|
46 | ///-------------------------------------------------------------- |
---|
47 | |
---|
48 | template <class T> |
---|
49 | std::vector<boost::shared_ptr<T> > & |
---|
50 | CObjectTemplate<T>::GetAllVectobject(const StdString & contextId) |
---|
51 | { |
---|
52 | return (CObjectTemplate<T>::AllVectObj[contextId]); |
---|
53 | } |
---|
54 | |
---|
55 | //--------------------------------------------------------------- |
---|
56 | |
---|
57 | template <class T> |
---|
58 | StdString CObjectTemplate<T>::toString(void) const |
---|
59 | { |
---|
60 | StdOStringStream oss; |
---|
61 | oss << "<" << T::GetName(); |
---|
62 | if (this->hasId()) |
---|
63 | oss << " id=\"" << this->getId() << "\""; |
---|
64 | oss << " " << SuperClassMap::toString() << "/>"; |
---|
65 | return (oss.str()); |
---|
66 | } |
---|
67 | |
---|
68 | template <class T> |
---|
69 | void CObjectTemplate<T>::fromString(const StdString & str) |
---|
70 | { |
---|
71 | ERROR("CObjectTemplate<T>::fromString(str)", |
---|
72 | << "[ str = " << str << "] Not implemented yet !"); |
---|
73 | } |
---|
74 | |
---|
75 | //--------------------------------------------------------------- |
---|
76 | |
---|
77 | template <class T> |
---|
78 | void CObjectTemplate<T>::toBinary(StdOStream & os) const |
---|
79 | { |
---|
80 | SuperClassMap::toBinary(os); |
---|
81 | } |
---|
82 | |
---|
83 | template <class T> |
---|
84 | void CObjectTemplate<T>::fromBinary(StdIStream & is) |
---|
85 | { |
---|
86 | SuperClassMap::fromBinary(is); |
---|
87 | } |
---|
88 | |
---|
89 | //--------------------------------------------------------------- |
---|
90 | |
---|
91 | template <class T> |
---|
92 | void CObjectTemplate<T>::parse(xml::CXMLNode & node) |
---|
93 | { |
---|
94 | xml::THashAttributes attributes = node.getAttributes(); |
---|
95 | CAttributeMap::setAttributes(attributes); |
---|
96 | } |
---|
97 | |
---|
98 | //--------------------------------------------------------------- |
---|
99 | |
---|
100 | template <class T> |
---|
101 | tree::ENodeType CObjectTemplate<T>::getType(void) const |
---|
102 | { |
---|
103 | return (T::GetType()); |
---|
104 | } |
---|
105 | |
---|
106 | //--------------------------------------------------------------- |
---|
107 | |
---|
108 | template <class T> |
---|
109 | bool CObjectTemplate<T>::hasChild(void) const |
---|
110 | { |
---|
111 | return (false); |
---|
112 | } |
---|
113 | |
---|
114 | //--------------------------------------------------------------- |
---|
115 | |
---|
116 | template <class T> |
---|
117 | void CObjectTemplate<T>::solveDescInheritance(const CAttributeMap * const parent) |
---|
118 | { |
---|
119 | SuperClassMap::setAttributes(parent); |
---|
120 | } |
---|
121 | |
---|
122 | //--------------------------------------------------------------- |
---|
123 | |
---|
124 | template <class T> |
---|
125 | void CObjectTemplate<T>::ClearAllAttributes(void) |
---|
126 | { |
---|
127 | std::vector<boost::shared_ptr<T> > & avect = |
---|
128 | CObjectTemplate<T>::GetAllVectobject(CObjectFactory::GetCurrentContextId()); |
---|
129 | typename std::vector<boost::shared_ptr<T> >::iterator |
---|
130 | it = avect.begin(), end = avect.end(); |
---|
131 | |
---|
132 | for (;it != end; it++) |
---|
133 | { |
---|
134 | CAttributeMap & amap = **it; |
---|
135 | amap.clearAllAttributes(); |
---|
136 | } |
---|
137 | } |
---|
138 | |
---|
139 | ///-------------------------------------------------------------- |
---|
140 | |
---|
141 | } // namespace xmlioserver |
---|
142 | |
---|
143 | #endif // __XMLIO_CObjectTemplate_impl__ |
---|