Changeset 172 for XMLIO_V2/dev/dev_rv/src
- Timestamp:
- 04/12/11 16:54:20 (13 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/xmlio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/attribute.cpp
r152 r172 13 13 CAttribute::CAttribute(const CAttribute & attribut) 14 14 : CObject(attribut.getId()) 15 { this->value = attribut.getAnyValue(); } 15 { 16 this->value = attribut.getAnyValue(); 17 } 18 19 CAttribute::~CAttribute(void) 20 { /* Ne rien faire de plus */ } 21 22 ///-------------------------------------------------------------- 16 23 17 24 const boost::any & CAttribute::getAnyValue(void) const 18 { return (this->value); } 25 { 26 return (this->value); 27 } 19 28 20 29 21 30 void CAttribute::setAnyValue(const boost::any & value) 22 { this->value = value; } 31 { 32 this->value = value; 33 } 23 34 24 CAttribute::~CAttribute(void) 25 { /* Ne rien faire de plus */ } 35 //--------------------------------------------------------------- 26 36 27 37 bool CAttribute::isEmpty(void) const 28 { return (this->value.empty()); } 38 { 39 return (this->value.empty()); 40 } 29 41 30 42 const StdString & CAttribute::getName(void) const 31 { return (this->getId()); } 43 { 44 return (this->getId()); 45 } 46 47 ///-------------------------------------------------------------- 32 48 33 49 } // namespace tree -
XMLIO_V2/dev/dev_rv/src/xmlio/group_template.hpp
r168 r172 38 38 virtual StdString toString(void) const; 39 39 virtual void fromString(const StdString & str); 40 41 virtual void toBinary (StdOStream & os) const; 42 virtual void fromBinary(StdIStream & is); 40 43 41 44 virtual void parse(xml::CXMLNode & node); -
XMLIO_V2/dev/dev_rv/src/xmlio/group_template_impl.hpp
r168 r172 25 25 CGroupTemplate<U, V, W>::~CGroupTemplate(void) 26 26 { /* Ne rien faire de plus */ } 27 28 ///-------------------------------------------------------------- 29 30 template <class U, class V, class W> 31 void CGroupTemplate<U, V, W>::toBinary(StdOStream & os) const 32 { 33 SuperClass::toBinary(os); 34 35 const StdSize grpnb = this->groupList.size(); 36 const StdSize chdnb = this->childList.size(); 37 tree::ENodeType cenum = U::GetType(); 38 tree::ENodeType genum = V::GetType(); 39 40 os.write (reinterpret_cast<const char*>(&grpnb) , sizeof(StdSize)); 41 os.write (reinterpret_cast<const char*>(&chdnb) , sizeof(StdSize)); 42 43 typename std::vector<boost::shared_ptr<V> >::const_iterator 44 itg = this->groupList.begin(), endg = this->groupList.end(); 45 typename std::vector<boost::shared_ptr<U> >::const_iterator 46 itc = this->childList.begin(), endc = this->childList.end(); 47 48 for (; itg != endg; itg++) 49 { 50 boost::shared_ptr<V> group = *itg; 51 bool hid = group->hasId(); 52 53 os.write (reinterpret_cast<const char*>(&genum), sizeof(tree::ENodeType)); 54 os.write (reinterpret_cast<const char*>(&hid), sizeof(bool)); 55 56 if (hid) 57 { 58 const StdString & id = group->getId(); 59 const StdSize size = id.size(); 60 61 os.write (reinterpret_cast<const char*>(&size), sizeof(StdSize)); 62 os.write (id.data(), size * sizeof(char)); 63 } 64 group->toBinary(os); 65 } 66 67 for (; itc != endc; itc++) 68 { 69 boost::shared_ptr<U> child = *itc; 70 bool hid = child->hasId(); 71 72 os.write (reinterpret_cast<const char*>(&cenum), sizeof(tree::ENodeType)); 73 os.write (reinterpret_cast<const char*>(&hid), sizeof(bool)); 74 75 if (hid) 76 { 77 const StdString & id = child->getId(); 78 const StdSize size = id.size(); 79 80 os.write (reinterpret_cast<const char*>(&size), sizeof(StdSize)); 81 os.write (id.data(), size * sizeof(char)); 82 } 83 child->toBinary(os); 84 } 85 86 } 87 88 template <class U, class V, class W> 89 void CGroupTemplate<U, V, W>::fromBinary(StdIStream & is) 90 { 91 SuperClass::fromBinary(is); 92 93 boost::shared_ptr<V> group_ptr = (this->hasId()) 94 ? CObjectFactory::GetObject<V>(this->getId()) 95 : CObjectFactory::GetObject(boost::polymorphic_downcast<V*>(this)); 96 97 StdSize grpnb = 0; 98 StdSize chdnb = 0; 99 tree::ENodeType renum = Unknown; 100 101 is.read (reinterpret_cast<char*>(&grpnb), sizeof(StdSize)); 102 is.read (reinterpret_cast<char*>(&chdnb), sizeof(StdSize)); 103 104 for (StdSize i = 0; i < grpnb; i++) 105 { 106 bool hid = false; 107 is.read (reinterpret_cast<char*>(&renum), sizeof(tree::ENodeType)); 108 is.read (reinterpret_cast<char*>(&hid), sizeof(bool)); 109 110 if (renum != V::GetType()) 111 ERROR("CGroupTemplate<U, V, W>::fromBinary(StdIStream & is)", 112 << "[ renum = " << renum << "] Bad type !"); 113 114 if (hid) 115 { 116 StdSize size = 0; 117 is.read (reinterpret_cast<char*>(&size), sizeof(StdSize)); 118 StdString id(size, ' '); 119 is.read (const_cast<char *>(id.data()), size * sizeof(char)); 120 CGroupFactory::CreateGroup(group_ptr, id)->fromBinary(is); 121 } 122 else 123 { 124 CGroupFactory::CreateGroup(group_ptr)->fromBinary(is); 125 } 126 } 127 128 for (StdSize j = 0; j < chdnb; j++) 129 { 130 bool hid = false; 131 is.read (reinterpret_cast<char*>(&renum), sizeof(tree::ENodeType)); 132 is.read (reinterpret_cast<char*>(&hid), sizeof(bool)); 133 134 if (renum != U::GetType()) 135 ERROR("CGroupTemplate<U, V, W>::fromBinary(StdIStream & is)", 136 << "[ renum = " << renum << "] Bad type !"); 137 138 if (hid) 139 { 140 StdSize size = 0; 141 is.read (reinterpret_cast<char*>(&size), sizeof(StdSize)); 142 StdString id(size, ' '); 143 is.read (const_cast<char *>(id.data()), size * sizeof(char)); 144 CGroupFactory::CreateChild(group_ptr, id)->fromBinary(is); 145 } 146 else 147 { 148 CGroupFactory::CreateChild(group_ptr)->fromBinary(is); 149 } 150 } 151 } 152 153 //-------------------------------------------------------------- 27 154 28 155 template <class U, class V, class W> … … 31 158 StdOStringStream oss; 32 159 StdString name = (this->getId().compare(V::GetDefName()) != 0) 33 ? V::GetName() 34 : V::GetDefName(); 160 ? V::GetName() : V::GetDefName(); 35 161 36 162 oss << "< " << name << " "; … … 75 201 } 76 202 203 //--------------------------------------------------------------- 204 77 205 template <class U, class V, class W> 78 206 StdString CGroupTemplate<U, V, W>::GetName(void) … … 86 214 return (U::GetName().append("_definition")); 87 215 } 216 217 //--------------------------------------------------------------- 88 218 89 219 template <class U, class V, class W> … … 94 224 } 95 225 226 //--------------------------------------------------------------- 227 96 228 template <class U, class V, class W> 97 229 const xios_map<StdString, boost::shared_ptr<V> >& … … 101 233 } 102 234 235 //--------------------------------------------------------------- 236 103 237 template <class U, class V, class W> 104 238 bool CGroupTemplate<U, V, W>::hasChild(void) const … … 107 241 } 108 242 243 //--------------------------------------------------------------- 244 109 245 template <class U, class V, class W> 110 246 void CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node) … … 112 248 this->parse(node, true); 113 249 } 250 251 //--------------------------------------------------------------- 114 252 115 253 template <class U, class V, class W> … … 138 276 } 139 277 278 //--------------------------------------------------------------- 279 140 280 template <class U, class V, class W> 141 281 void CGroupTemplate<U, V, W>::getAllChildren(std::vector<boost::shared_ptr<U> > & allc) const … … 152 292 } 153 293 294 //--------------------------------------------------------------- 295 154 296 template <class U, class V, class W> 155 297 std::vector<boost::shared_ptr<U> > CGroupTemplate<U, V, W>::getAllChildren(void) const … … 160 302 } 161 303 304 //--------------------------------------------------------------- 305 162 306 template <class U, class V, class W> 163 307 void CGroupTemplate<U, V, W>::solveRefInheritance(void) 164 308 { /* Ne rien faire de plus */ } 165 309 310 ///-------------------------------------------------------------- 311 166 312 } // namespace xmlioserver 167 313 -
XMLIO_V2/dev/dev_rv/src/xmlio/object_template.hpp
r168 r172 29 29 virtual StdString toString(void) const; 30 30 virtual void fromString(const StdString & str); 31 32 virtual void toBinary (StdOStream & os) const; 33 virtual void fromBinary(StdIStream & is); 31 34 32 35 virtual void parse(xml::CXMLNode & node); … … 62 65 static xios_map<StdString, 63 66 xios_map<StdString, 64 boost::shared_ptr<DerivedType> > > AllMapObj; 67 boost::shared_ptr<DerivedType> > > AllMapObj; 65 68 static xios_map<StdString, 66 69 std::vector<boost::shared_ptr<DerivedType> > > AllVectObj; -
XMLIO_V2/dev/dev_rv/src/xmlio/object_template_impl.hpp
r168 r172 27 27 28 28 template <class T> 29 CObjectTemplate<T>::CObjectTemplate (const CObjectTemplate<T> & object,30 29 CObjectTemplate<T>::CObjectTemplate 30 (const CObjectTemplate<T> & object, bool withAttrList, bool withId) 31 31 : tree::CAttributeMap() 32 32 , CObject() … … 36 36 ERROR("CObjectTemplate<T> construtor 3", << "Not completly implemented yet !"); 37 37 } 38 39 template <class T> 40 CObjectTemplate<T>::~CObjectTemplate(void) 41 { /* Ne rien faire de plus */ } 42 43 ///-------------------------------------------------------------- 38 44 39 45 template <class T> 40 46 std::vector<boost::shared_ptr<T> > & 41 47 CObjectTemplate<T>::GetAllVectobject(const StdString & contextId) 42 { return (CObjectTemplate<T>::AllVectObj[contextId]); }43 44 template <class T>45 CObjectTemplate<T>::~CObjectTemplate(void)46 { /* Ne rien faire de plus */ }47 48 { 49 return (CObjectTemplate<T>::AllVectObj[contextId]); 50 } 51 52 //--------------------------------------------------------------- 53 48 54 template <class T> 49 55 StdString CObjectTemplate<T>::toString(void) const … … 59 65 template <class T> 60 66 void CObjectTemplate<T>::fromString(const StdString & str) 61 { ERROR("CObjectTemplate<T>::fromString(str)", 62 << "[ str = " << str << "] Not implemented yet !"); } 67 { 68 ERROR("CObjectTemplate<T>::fromString(str)", 69 << "[ str = " << str << "] Not implemented yet !"); 70 } 71 72 //--------------------------------------------------------------- 73 74 template <class T> 75 void CObjectTemplate<T>::toBinary(StdOStream & os) const 76 { 77 SuperClassMap::toBinary(os); 78 } 79 80 template <class T> 81 void CObjectTemplate<T>::fromBinary(StdIStream & is) 82 { 83 SuperClassMap::fromBinary(is); 84 } 85 86 //--------------------------------------------------------------- 63 87 64 88 template <class T> … … 68 92 CAttributeMap::setAttributes(attributes); 69 93 } 70 94 95 //--------------------------------------------------------------- 96 71 97 template <class T> 72 98 tree::ENodeType CObjectTemplate<T>::getType(void) const … … 74 100 return (T::GetType()); 75 101 } 102 103 //--------------------------------------------------------------- 76 104 77 105 template <class T> 78 106 bool CObjectTemplate<T>::hasChild(void) const 79 { return (false); } 107 { 108 return (false); 109 } 110 111 //--------------------------------------------------------------- 80 112 81 113 template <class T> 82 114 void CObjectTemplate<T>::solveDescInheritance(const CAttributeMap * const parent) 83 { SuperClassMap::setAttributes(parent); } 115 { 116 SuperClassMap::setAttributes(parent); 117 } 118 119 ///-------------------------------------------------------------- 84 120 85 121 } // namespace xmlioserver
Note: See TracChangeset
for help on using the changeset viewer.