Changeset 369 for XIOS/trunk/src/attribute_template_impl.hpp
- Timestamp:
- 10/16/12 13:04:44 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/attribute_template_impl.hpp
r352 r369 2 2 #define __XMLIO_CAttributeTemplate_impl__ 3 3 4 #include "array.hpp"5 4 #include "type.hpp" 6 5 #include "buffer_in.hpp" … … 25 24 this->setValue(value); 26 25 } 27 26 /* 28 27 template <class T> 29 28 CAttributeTemplate<T>::CAttributeTemplate(const CAttribute & attribut) … … 34 33 ERROR("CAttributeTemplate", << "Invalid instantiation !"); 35 34 } 36 35 */ 37 36 template <class T> 38 37 CAttributeTemplate<T>::CAttributeTemplate(const StdString & id, … … 52 51 umap.insert(umap.end(), std::make_pair(id, this)); 53 52 } 54 55 template <class T> 56 53 /* 54 template <class T> 55 CAttributeTemplate<T>::~CAttributeTemplate(void) 57 56 { 58 this->clear(); 59 } 60 57 // this->CType<T>::reset() ; 58 // this->clear(); 59 } 60 */ 61 61 ///-------------------------------------------------------------- 62 62 … … 64 64 T CAttributeTemplate<T>::getValue(void) const 65 65 { 66 return CType<T>::get() ; 67 /* 66 68 if (SuperClass::isEmpty()) 67 69 { … … 71 73 } 72 74 return (SuperClass::getValue<T>()); 73 } 74 75 */ 76 } 77 78 /* 75 79 template <class T> 76 80 T* CAttributeTemplate<T>::getRef(void) … … 84 88 return (SuperClass::getRef<T>()); 85 89 } 90 */ 86 91 87 92 template <class T> 88 93 void CAttributeTemplate<T>::setValue(const T & value) 89 94 { 90 SuperClass::setValue<T>(value); 91 } 92 93 //--------------------------------------------------------------- 94 95 template <class T> 96 T CAttributeTemplate<T>::operator=(const T & value) 95 CType<T>::set(value) ; 96 // SuperClass::setValue<T>(value); 97 } 98 99 template <class T> 100 void CAttributeTemplate<T>::set(const CAttribute& attr) 101 { 102 this->set(dynamic_cast<const CAttributeTemplate<T>& >(attr)) ; 103 } 104 105 template <class T> 106 void CAttributeTemplate<T>::set(const CAttributeTemplate& attr) 107 { 108 CType<T>::set(attr) ; 109 } 110 111 //--------------------------------------------------------------- 112 113 template <class T> 114 CAttributeTemplate<T>& CAttributeTemplate<T>::operator=(const T & value) 97 115 { 98 116 this->setValue(value); 99 return (this->getValue()); 100 } 101 102 //--------------------------------------------------------------- 103 104 template <class T> 105 StdString CAttributeTemplate<T>::toString(void) const 117 // return (this->getValue()); 118 return *this; 119 } 120 121 //--------------------------------------------------------------- 122 123 template <class T> 124 StdString CAttributeTemplate<T>::_toString(void) const 106 125 { 107 126 StdOStringStream oss; 108 if (! this->isEmpty() && this->hasId())109 oss << this->getName() << "=\"" << this->getValue() << "\"";127 if (!CType<T>::isEmpty() && this->hasId()) 128 oss << this->getName() << "=\"" << CType<T>::toString() << "\""; 110 129 return (oss.str()); 111 130 } 112 131 113 132 template <class T> 114 void CAttributeTemplate<T>::fromString(const StdString & str) 115 { 116 ERROR("CAttributeTemplate<T>::fromString(const StdString & str)", 117 << "[ str = " << str << " ] Not implemented yet !"); 118 } 119 120 //--------------------------------------------------------------- 121 133 void CAttributeTemplate<T>::_fromString(const StdString & str) 134 { 135 CType<T>::fromString(str) ; 136 } 137 138 //--------------------------------------------------------------- 139 /* 122 140 template <class T> 123 141 void CAttributeTemplate<T>::toBinary (StdOStream & os) const … … 133 151 this->setValue(value); 134 152 } 135 136 template <class T> 137 bool CAttributeTemplate<T>::toBuffer (CBufferOut& buffer) const 138 { 153 */ 154 template <class T> 155 bool CAttributeTemplate<T>::_toBuffer (CBufferOut& buffer) const 156 { 157 return CType<T>::toBuffer(buffer) ; 158 /* 139 159 if (isEmpty()) return buffer.put(true) ; 140 160 else … … 146 166 return ret ; 147 167 } 148 } 149 150 template <class T> 151 bool CAttributeTemplate<T>::fromBuffer(CBufferIn& buffer) 152 { 168 */ 169 } 170 171 template <class T> 172 bool CAttributeTemplate<T>::_fromBuffer(CBufferIn& buffer) 173 { 174 return CType<T>::fromBuffer(buffer) ; 175 /* 153 176 bool empty ; 154 177 bool ret=true ; … … 170 193 return val.fromBuffer(buffer) ; 171 194 } 172 } 173 195 */ 196 } 197 /* 174 198 template <class T> 175 199 size_t CAttributeTemplate<T>::size(void) const 176 { 200 { 201 return CType<T>::size() ;*/ 202 /* 177 203 if (isEmpty()) return sizeof(bool) ; 178 204 else … … 181 207 return val.size()+sizeof(bool) ; 182 208 } 183 } 209 */ 210 /* }*/ 184 211 185 212 template <typename T> … … 231 258 } 232 259 233 234 //--------------------------------------------------------------- 235 236 / ** Spécialisations des templates pour la fonction [toString] **/260 /* 261 //--------------------------------------------------------------- 262 263 // Spécialisations des templates pour la fonction [toString] 237 264 238 265 template <> … … 241 268 //--------------------------------------------------------------- 242 269 243 / ** Spécialisations des templates pour la fonction [fromString] **/270 // Spécialisations des templates pour la fonction [fromString] 244 271 245 272 template <> // Chaîne de caractÚres. … … 260 287 //--------------------------------------------------------------- 261 288 262 / ** Spécialisations des templates pour la fonction [toBinary] **/289 // Spécialisations des templates pour la fonction [toBinary] // 263 290 264 291 template <> // Chaîne de caractÚres. … … 276 303 //--------------------------------------------------------------- 277 304 278 / ** Spécialisations des templates pour la fonction [fromBinary] **/305 // Spécialisations des templates pour la fonction [fromBinary] // 279 306 280 307 template <> // Chaîne de caractÚres. … … 291 318 292 319 ///-------------------------------------------------------------- 320 */ 293 321 } // namespace xios 294 322
Note: See TracChangeset
for help on using the changeset viewer.