Ignore:
Timestamp:
04/12/11 16:54:20 (13 years ago)
Author:
hozdoba
Message:
 
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  
    1313      CAttribute::CAttribute(const CAttribute & attribut) 
    1414         : 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      ///-------------------------------------------------------------- 
    1623 
    1724      const boost::any & CAttribute::getAnyValue(void) const 
    18       { return (this->value); } 
     25      {  
     26         return (this->value);  
     27      } 
    1928 
    2029 
    2130      void CAttribute::setAnyValue(const boost::any & value) 
    22       { this->value = value; } 
     31      {  
     32         this->value = value;  
     33      } 
    2334 
    24       CAttribute::~CAttribute(void) 
    25       { /* Ne rien faire de plus */ } 
     35      //--------------------------------------------------------------- 
    2636 
    2737      bool CAttribute::isEmpty(void) const 
    28       { return (this->value.empty()); } 
     38      {  
     39         return (this->value.empty());  
     40      } 
    2941 
    3042      const StdString & CAttribute::getName(void) const 
    31       { return (this->getId()); } 
     43      {  
     44         return (this->getId());  
     45      } 
     46       
     47      ///-------------------------------------------------------------- 
    3248 
    3349   } // namespace tree 
  • XMLIO_V2/dev/dev_rv/src/xmlio/group_template.hpp

    r168 r172  
    3838         virtual StdString toString(void) const; 
    3939         virtual void fromString(const StdString & str); 
     40          
     41         virtual void toBinary  (StdOStream & os) const; 
     42         virtual void fromBinary(StdIStream & is); 
    4043 
    4144         virtual void parse(xml::CXMLNode & node); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/group_template_impl.hpp

    r168 r172  
    2525      CGroupTemplate<U, V, W>::~CGroupTemplate(void) 
    2626   { /* 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   //-------------------------------------------------------------- 
    27154 
    28155   template <class U, class V, class W> 
     
    31158      StdOStringStream oss; 
    32159      StdString name = (this->getId().compare(V::GetDefName()) != 0) 
    33                      ? V::GetName() 
    34                      : V::GetDefName(); 
     160                     ? V::GetName() : V::GetDefName(); 
    35161 
    36162      oss << "< " << name << " "; 
     
    75201   } 
    76202 
     203   //--------------------------------------------------------------- 
     204 
    77205   template <class U, class V, class W> 
    78206      StdString CGroupTemplate<U, V, W>::GetName(void) 
     
    86214      return (U::GetName().append("_definition"));  
    87215   } 
     216    
     217   //---------------------------------------------------------------    
    88218 
    89219   template <class U, class V, class W> 
     
    94224   } 
    95225 
     226   //--------------------------------------------------------------- 
     227 
    96228   template <class U, class V, class W> 
    97229      const xios_map<StdString, boost::shared_ptr<V> >& 
     
    101233   } 
    102234 
     235   //--------------------------------------------------------------- 
     236 
    103237   template <class U, class V, class W> 
    104238      bool CGroupTemplate<U, V, W>::hasChild(void) const 
     
    107241   } 
    108242 
     243   //--------------------------------------------------------------- 
     244 
    109245   template <class U, class V, class W> 
    110246      void CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node) 
     
    112248      this->parse(node, true);  
    113249   } 
     250    
     251   //--------------------------------------------------------------- 
    114252    
    115253   template <class U, class V, class W> 
     
    138276   } 
    139277 
     278   //--------------------------------------------------------------- 
     279 
    140280   template <class U, class V, class W> 
    141281      void CGroupTemplate<U, V, W>::getAllChildren(std::vector<boost::shared_ptr<U> > & allc) const 
     
    152292   } 
    153293 
     294   //--------------------------------------------------------------- 
     295 
    154296   template <class U, class V, class W> 
    155297      std::vector<boost::shared_ptr<U> > CGroupTemplate<U, V, W>::getAllChildren(void) const 
     
    160302   } 
    161303 
     304   //--------------------------------------------------------------- 
     305 
    162306   template <class U, class V, class W> 
    163307      void CGroupTemplate<U, V, W>::solveRefInheritance(void) 
    164308   { /* Ne rien faire de plus */ } 
    165309 
     310   ///-------------------------------------------------------------- 
     311 
    166312} // namespace xmlioserver 
    167313 
  • XMLIO_V2/dev/dev_rv/src/xmlio/object_template.hpp

    r168 r172  
    2929         virtual StdString toString(void) const; 
    3030         virtual void fromString(const StdString & str); 
     31 
     32         virtual void toBinary  (StdOStream & os) const; 
     33         virtual void fromBinary(StdIStream & is); 
    3134 
    3235         virtual void parse(xml::CXMLNode & node); 
     
    6265         static xios_map<StdString, 
    6366                xios_map<StdString, 
    64                 boost::shared_ptr<DerivedType> > > AllMapObj; 
     67                boost::shared_ptr<DerivedType> > > AllMapObj;  
    6568         static xios_map<StdString, 
    6669                std::vector<boost::shared_ptr<DerivedType> > > AllVectObj; 
  • XMLIO_V2/dev/dev_rv/src/xmlio/object_template_impl.hpp

    r168 r172  
    2727 
    2828   template <class T> 
    29       CObjectTemplate<T>::CObjectTemplate(const CObjectTemplate<T> & object, 
    30                                          bool withAttrList, bool withId) 
     29      CObjectTemplate<T>::CObjectTemplate 
     30         (const CObjectTemplate<T> & object, bool withAttrList, bool withId) 
    3131         : tree::CAttributeMap() 
    3232         , CObject() 
     
    3636      ERROR("CObjectTemplate<T> construtor 3", << "Not completly implemented yet !"); 
    3737   } 
     38    
     39   template <class T> 
     40      CObjectTemplate<T>::~CObjectTemplate(void) 
     41   { /* Ne rien faire de plus */ } 
     42 
     43   ///-------------------------------------------------------------- 
    3844 
    3945   template <class T> 
    4046      std::vector<boost::shared_ptr<T> > & 
    4147         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    
    4854   template <class T> 
    4955      StdString CObjectTemplate<T>::toString(void) const 
     
    5965   template <class T> 
    6066      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   //--------------------------------------------------------------- 
    6387 
    6488   template <class T> 
     
    6892      CAttributeMap::setAttributes(attributes); 
    6993   } 
    70     
     94 
     95   //--------------------------------------------------------------- 
     96 
    7197   template <class T> 
    7298      tree::ENodeType CObjectTemplate<T>::getType(void) const 
     
    74100      return (T::GetType()); 
    75101   } 
     102    
     103   //--------------------------------------------------------------- 
    76104 
    77105   template <class T> 
    78106      bool CObjectTemplate<T>::hasChild(void) const 
    79    { return (false); } 
     107   {  
     108      return (false);  
     109   } 
     110 
     111   //--------------------------------------------------------------- 
    80112 
    81113   template <class T> 
    82114      void CObjectTemplate<T>::solveDescInheritance(const CAttributeMap * const parent) 
    83    { SuperClassMap::setAttributes(parent); } 
     115   {  
     116      SuperClassMap::setAttributes(parent);  
     117   } 
     118 
     119   ///-------------------------------------------------------------- 
    84120 
    85121} // namespace xmlioserver 
Note: See TracChangeset for help on using the changeset viewer.