[219] | 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 | CObjectTemplate<T>::CObjectTemplate(void) |
---|
| 18 | : tree::CAttributeMap() |
---|
| 19 | , CObject() |
---|
| 20 | { /* Ne rien faire de plus */ } |
---|
| 21 | |
---|
| 22 | template <class T> |
---|
| 23 | CObjectTemplate<T>::CObjectTemplate(const StdString & id) |
---|
| 24 | : tree::CAttributeMap() |
---|
| 25 | , CObject(id) |
---|
| 26 | { /* Ne rien faire de plus */ } |
---|
| 27 | |
---|
| 28 | template <class T> |
---|
| 29 | CObjectTemplate<T>::CObjectTemplate |
---|
| 30 | (const CObjectTemplate<T> & object, bool withAttrList, bool withId) |
---|
| 31 | : tree::CAttributeMap() |
---|
| 32 | , CObject() |
---|
| 33 | { |
---|
| 34 | if (object.hasId() && withId) |
---|
| 35 | this->setId(object.getId()); |
---|
| 36 | ERROR("CObjectTemplate<T> construtor 3", << "Not completly implemented yet !"); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | template <class T> |
---|
| 40 | CObjectTemplate<T>::~CObjectTemplate(void) |
---|
| 41 | { /* Ne rien faire de plus */ } |
---|
| 42 | |
---|
| 43 | ///-------------------------------------------------------------- |
---|
| 44 | |
---|
| 45 | template <class T> |
---|
| 46 | std::vector<boost::shared_ptr<T> > & |
---|
| 47 | CObjectTemplate<T>::GetAllVectobject(const StdString & contextId) |
---|
| 48 | { |
---|
| 49 | return (CObjectTemplate<T>::AllVectObj[contextId]); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | //--------------------------------------------------------------- |
---|
| 53 | |
---|
| 54 | template <class T> |
---|
| 55 | StdString CObjectTemplate<T>::toString(void) const |
---|
| 56 | { |
---|
| 57 | StdOStringStream oss; |
---|
| 58 | oss << "<" << T::GetName(); |
---|
| 59 | if (this->hasId()) |
---|
| 60 | oss << " id=\"" << this->getId() << "\""; |
---|
| 61 | oss << " " << SuperClassMap::toString() << "/>"; |
---|
| 62 | return (oss.str()); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | template <class T> |
---|
| 66 | void CObjectTemplate<T>::fromString(const StdString & str) |
---|
| 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 | //--------------------------------------------------------------- |
---|
| 87 | |
---|
| 88 | template <class T> |
---|
| 89 | void CObjectTemplate<T>::parse(xml::CXMLNode & node) |
---|
| 90 | { |
---|
| 91 | xml::THashAttributes attributes = node.getAttributes(); |
---|
| 92 | CAttributeMap::setAttributes(attributes); |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | //--------------------------------------------------------------- |
---|
| 96 | |
---|
| 97 | template <class T> |
---|
| 98 | tree::ENodeType CObjectTemplate<T>::getType(void) const |
---|
| 99 | { |
---|
| 100 | return (T::GetType()); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | //--------------------------------------------------------------- |
---|
| 104 | |
---|
| 105 | template <class T> |
---|
| 106 | bool CObjectTemplate<T>::hasChild(void) const |
---|
| 107 | { |
---|
| 108 | return (false); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | //--------------------------------------------------------------- |
---|
| 112 | |
---|
| 113 | template <class T> |
---|
| 114 | void CObjectTemplate<T>::solveDescInheritance(const CAttributeMap * const parent) |
---|
| 115 | { |
---|
| 116 | SuperClassMap::setAttributes(parent); |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | //--------------------------------------------------------------- |
---|
| 120 | |
---|
| 121 | template <class T> |
---|
| 122 | void CObjectTemplate<T>::ClearAllAttributes(void) |
---|
| 123 | { |
---|
| 124 | std::vector<boost::shared_ptr<T> > & avect = |
---|
| 125 | CObjectTemplate<T>::GetAllVectobject(CObjectFactory::GetCurrentContextId()); |
---|
| 126 | typename std::vector<boost::shared_ptr<T> >::iterator |
---|
| 127 | it = avect.begin(), end = avect.end(); |
---|
| 128 | |
---|
| 129 | for (;it != end; it++) |
---|
| 130 | { |
---|
| 131 | CAttributeMap & amap = **it; |
---|
| 132 | amap.clearAllAttributes(); |
---|
| 133 | } |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | ///-------------------------------------------------------------- |
---|
| 137 | |
---|
| 138 | } // namespace xmlioserver |
---|
| 139 | |
---|
| 140 | #endif // __XMLIO_CObjectTemplate_impl__ |
---|