Changeset 171


Ignore:
Timestamp:
04/12/11 11:48:48 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/Makefile.wk

    r168 r171  
    1616GUI       = no 
    1717NPROC     = 1 
    18 CSUITE    = gnu 
     18CSUITE    = intel 
    1919PFORME    = fedora-wk 
    2020FORTEXT   = .f90 
     
    276276ifeq ($(CSUITE), intel) 
    277277        FFLAGS  += -module $(LIB_PATH) 
    278         CFLAGS  += -ansi  -diag-disable 1125 
     278        CFLAGS  += -ansi  -diag-disable 1125 -diag-disable 279 
    279279endif 
    280280 
  • XMLIO_V2/dev/dev_rv/src/xmlio/array_impl.hpp

    r152 r171  
    7777         shape.push_back(temp); 
    7878      } 
    79       this->reshape(shape); 
     79      this->resize(shape); 
    8080      is.read (reinterpret_cast<char*>(&nelem), sizeof(LSize)); 
    8181      is.read (reinterpret_cast<char*>(this->data()), nelem * sizeof(ValueType)); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/attribute_map.cpp

    r152 r171  
    1414      CAttributeMap::~CAttributeMap(void) 
    1515      { /* Ne rien faire de plus */ } 
    16  
     16       
     17      ///-------------------------------------------------------------- 
     18       
    1719      bool CAttributeMap::hasAttribute(const StdString & key) const 
    18       { return (this->find(key) != this->end()); } 
    19  
     20      {  
     21         return (this->find(key) != this->end());  
     22      } 
     23       
     24      //--------------------------------------------------------------- 
     25       
    2026      void CAttributeMap::setAttribute(const StdString & key, CAttribute * const attr) 
    2127      { 
     
    2834         this->find(key)->second->setAnyValue(attr->getAnyValue()); 
    2935      } 
    30  
     36       
     37      //--------------------------------------------------------------- 
     38       
    3139      CAttribute * CAttributeMap::operator[](const StdString & key) 
    3240      { 
     
    3644         return (SuperClassMap::operator[](key)); 
    3745      } 
    38  
     46       
     47      //--------------------------------------------------------------- 
     48       
    3949      StdString CAttributeMap::toString(void) const 
    4050      { 
     
    5161         return (oss.str()); 
    5262      } 
    53  
     63       
     64      //--------------------------------------------------------------- 
     65       
    5466      void CAttributeMap::fromString(const StdString & str) 
    55       { ERROR("CAttributeMap::fromString(const StdString & str)", 
    56              << "[ str = " << str << "] Not implemented yet !"); } 
     67      {  
     68         ERROR("CAttributeMap::fromString(const StdString & str)", 
     69               << "[ str = " << str << "] Not implemented yet !");  
     70      } 
     71       
     72      //--------------------------------------------------------------- 
    5773 
    5874      //StdOStream & operator << (StdOStream & os, const CAttributeMap & attributmap) 
    5975      //{ os << attributmap.toString(); return (os); } 
    60  
     76       
     77      //--------------------------------------------------------------- 
     78       
    6179      void CAttributeMap::setAttributes(const xml::THashAttributes & attributes) 
    6280      { 
     
    7189            } 
    7290      } 
    73  
     91       
     92      //--------------------------------------------------------------- 
     93       
    7494      void CAttributeMap::setAttributes(const CAttributeMap * const _parent) 
    7595      { 
     
    90110         } 
    91111      } 
     112       
     113      //--------------------------------------------------------------- 
     114       
     115      void CAttributeMap::toBinary(StdOStream & os) const 
     116      { 
     117         typedef std::pair<StdString, CAttribute*> StdStrAttPair; 
     118         SuperClassMap::const_iterator it = this->begin(), end = this->end(); 
     119          
     120         const StdSize nbatt = SuperClassMap::size(); 
     121         os.write (reinterpret_cast<const char*>(&nbatt) , sizeof(StdSize)); 
     122          
     123         for (; it != end; it++) 
     124         { 
     125            const StdString & key   = it->first; 
     126            const CAttribute* value = it->second;             
     127            const StdSize size = key.size(); 
     128             
     129            os.write (reinterpret_cast<const char*>(&size) , sizeof(StdSize)); 
     130            os.write (key.data(), size * sizeof(char)); 
     131             
     132            if (!value->isEmpty()) 
     133            { 
     134               bool b = true; 
     135               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool)); 
     136               value->toBinary(os); 
     137            } 
     138            else  
     139            { 
     140               bool b = false; 
     141               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool)); 
     142            } 
     143         } 
     144      } 
     145       
     146      //--------------------------------------------------------------- 
     147       
     148      void CAttributeMap::fromBinary(StdIStream & is) 
     149      { 
     150         StdSize nbatt = 0; 
     151         is.read (reinterpret_cast<char*>(&nbatt), sizeof(StdSize)); 
     152          
     153         for (StdSize i = 0; i < nbatt; i++) 
     154         { 
     155            bool hasValue = false; 
     156            StdSize size  = 0; 
     157            is.read (reinterpret_cast<char*>(&size), sizeof(StdSize)); 
     158            StdString key(size, ' '); 
     159            is.read (const_cast<char *>(key.data()), size * sizeof(char)); 
     160             
     161            if (!this->hasAttribute(key)) 
     162               ERROR("CAttributeMap::fromBinary(StdIStream & is)", 
     163                     << "[ key = " << key << "] key not found !");  
     164                      
     165            is.read (reinterpret_cast<char*>(&hasValue), sizeof(bool)); 
     166             
     167            if (hasValue)           
     168               this->operator[](key)->fromBinary(is); 
     169         } 
     170      } 
     171       
     172      ///-------------------------------------------------------------- 
    92173 
    93174   } // namespace tree 
  • XMLIO_V2/dev/dev_rv/src/xmlio/attribute_map.hpp

    r152 r171  
    4343            virtual StdString toString(void) const; 
    4444            virtual void fromString(const StdString & str); 
     45             
     46            virtual void toBinary  (StdOStream & os) const; 
     47            virtual void fromBinary(StdIStream & is); 
    4548 
    4649         protected : 
  • XMLIO_V2/dev/dev_rv/src/xmlio/attribute_template.cpp

    r152 r171  
    1010 
    1111      /** Spécialisations des templates pour la fonction [toString] **/ 
     12       
    1213      template <> 
    1314         StdString CAttributeTemplate<bool>::toString(void) const 
  • XMLIO_V2/dev/dev_rv/src/xmlio/exception.hpp

    r152 r171  
    4747 
    4848#ifdef XIOS_DEBUG 
    49    #define DEBUG(x) std::clog << "> Debug " << INFO(x) 
     49define DEBUG(x) std::clog << "> Debug " << INFO(x) 
    5050#else 
    51    #define DEBUG(x) 
     51define DEBUG(x) 
    5252#endif 
    5353 
  • XMLIO_V2/dev/dev_rv/src/xmlio/main_server.cpp

    r169 r171  
    8080      CTreeManager::PrintTreeToFile("data/def/test.xml"); 
    8181       
     82       
     83      ARRAY_CREATE(sarray, double, 1, [1]); 
     84      StdIFStream ifs("data/monfichierbinaire"); 
     85      sarray->fromBinary(ifs); 
     86      ifs.close(); 
     87       
    8288      
    8389      
  • XMLIO_V2/dev/dev_rv/src/xmlio/xml_node.cpp

    r152 r171  
    1717 
    1818      StdString CXMLNode::getElementName(void) const 
    19       { return (this->node->name()); } 
     19      {  
     20         return (this->node->name());  
     21      } 
    2022 
    2123      bool CXMLNode::goToNextElement(void) 
     
    2426         for(rapidxml::xml_node<char> * nextElement = this->node->next_sibling(); 
    2527                                      ; nextElement = this->node->next_sibling()) 
     28         { 
    2629            if (nextElement == NULL) break; 
    2730            else if (nextElement->type() == rapidxml::node_element) 
    28             { node = nextElement; return (!retvalue); } 
     31            {  
     32               node = nextElement; 
     33               return (!retvalue); 
     34            } 
     35         } 
    2936         return (retvalue); 
    3037      } 
     
    3744         { 
    3845            for(;;nextElement = this->node->next_sibling()) 
     46            { 
    3947               if (nextElement == NULL) break; 
    4048               else if (nextElement->type() == rapidxml::node_element) 
    41                { node = nextElement; return (!retvalue); } 
     49               {  
     50                  node = nextElement;  
     51                  return (!retvalue);  
     52               } 
     53            } 
    4254         } 
    4355         return (retvalue); 
     
    5466 
    5567      const StdString & CXMLNode::GetRootName(void) 
    56       { return (CXMLNode::RootName); } 
     68      {  
     69         return (CXMLNode::RootName);  
     70      } 
    5771 
    5872      THashAttributes CXMLNode::getAttributes(void) const 
     
    6276 
    6377         if ((currentAttr = this->node->first_attribute()) != NULL) 
    64             do { 
     78         { 
     79            do  
     80            { 
    6581               attributes.insert(std::pair<StdString, StdString> 
    6682                                (StdString(currentAttr->name()), 
    6783                                 StdString(currentAttr->value()))); 
    6884            } while ((currentAttr = currentAttr->next_attribute()) != NULL); 
     85         } 
    6986 
    7087         return (attributes) ; 
Note: See TracChangeset for help on using the changeset viewer.