Ignore:
Timestamp:
04/19/11 15:06:51 (13 years ago)
Author:
hozdoba
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/manager/tree_manager.cpp

    r179 r180  
    178178         const ENodeType genum = CContextGroup::GetType(); 
    179179         const ENodeType denum = CDomain::GetType(); 
     180         const ENodeType ienum = CGrid::GetType(); 
    180181          
    181182         os.write (reinterpret_cast<const char*>(&genum) , sizeof(ENodeType));  
     
    202203            std::vector<boost::shared_ptr<CDomain> > & alldomain =  
    203204               CDomain::GetAllVectobject(context->getId()); 
     205            std::vector<boost::shared_ptr<CGrid> > & allgrid =  
     206               CGrid::GetAllVectobject(context->getId()); 
     207                
    204208            const StdSize alldomain_size = alldomain.size();  
     209            const StdSize allgrid_size   = allgrid.size(); 
    205210             
    206211            os.write (reinterpret_cast<const char*>(&alldomain_size), sizeof(StdSize)); 
    207              
     212            os.write (reinterpret_cast<const char*>(&allgrid_size), sizeof(StdSize)); 
     213             
     214            // Écriture successive des informations binaires de domaine. 
    208215            for (StdSize j = 0; j < alldomain_size; j++) 
    209216            { 
     
    222229                  os.write (id.data(), idsize * sizeof(char));          
    223230               }          
    224                domain->toBinary(os); 
    225                 
     231               domain->toBinary(os);                
     232            } 
     233             
     234            // Écriture successive des informations binaires de grille. 
     235            for (StdSize j = 0; j < allgrid_size; j++) 
     236            { 
     237               boost::shared_ptr<CGrid> grid = allgrid[j]; 
     238               bool hid = grid->hasId(); 
     239                
     240               os.write (reinterpret_cast<const char*>(&ienum), sizeof(ENodeType));  
     241               os.write (reinterpret_cast<const char*>(&hid), sizeof(bool)); 
     242                
     243               if (hid) 
     244               { 
     245                  const StdString & id = grid->getId(); 
     246                  const StdSize idsize   = id.size(); 
     247                      
     248                  os.write (reinterpret_cast<const char*>(&idsize), sizeof(StdSize)); 
     249                  os.write (id.data(), idsize * sizeof(char));          
     250               }          
     251               grid->toBinary(os);                
    226252            } 
    227253         } 
     
    276302            std::vector<boost::shared_ptr<CDomain> > & alldomain =  
    277303               CDomain::GetAllVectobject(context->getId()); 
     304            std::vector<boost::shared_ptr<CGrid> > & allgrid =  
     305               CGrid::GetAllVectobject(context->getId()); 
     306                
     307            const StdSize allgrid_size = allgrid.size(); 
    278308            const StdSize alldomain_size = alldomain.size();  
     309             
    279310            StdSize read_alldomain_size = 0;  
     311            StdSize read_allgrid_size = 0;  
    280312             
    281313            is.read (reinterpret_cast<char*>(&read_alldomain_size), sizeof(StdSize)); 
     314            is.read (reinterpret_cast<char*>(&read_allgrid_size), sizeof(StdSize)); 
    282315             
    283316            if (alldomain_size != read_alldomain_size) 
     
    286319                     << "] Bad domain group size !"); 
    287320                      
     321            if (alldomain_size != read_alldomain_size) 
     322               ERROR("CTreeManager::DomainsFromBinary(StdIStream & is)", 
     323                     << "[ read_allgrid_size = " << read_allgrid_size  
     324                     << "] Bad grid group size !"); 
     325                      
     326            // Lecture successive des informations binaires de domaine. 
    288327            for (StdSize j = 0; j < alldomain_size; j++) 
    289328            { 
     
    312351               domain->fromBinary(is); 
    313352            } 
     353             
     354            // Lecture successive des informations binaires de grille. 
     355            for (StdSize j = 0; j < allgrid_size; j++) 
     356            { 
     357               boost::shared_ptr<CGrid> grid = allgrid[j]; 
     358               bool hid = grid->hasId(); 
     359               ENodeType rrenum = Unknown; 
     360                
     361               is.read (reinterpret_cast<char*>(&rrenum), sizeof(ENodeType)); 
     362               is.read (reinterpret_cast<char*>(&hid), sizeof(bool)); 
     363                
     364               if (rrenum != CGrid::GetType()) 
     365                  ERROR("CTreeManager::DomainsFromBinary(StdIStream & is)", 
     366                        << "[ rrenum = " << rrenum << "] Bad type !"); 
     367 
     368               if (hid) 
     369               { 
     370                  StdSize size  = 0; 
     371                  is.read (reinterpret_cast<char*>(&size), sizeof(StdSize)); 
     372                  StdString id(size, ' '); 
     373                  is.read (const_cast<char *>(id.data()), size * sizeof(char)); 
     374                   
     375                  if (grid->getId().compare(id) != 0) 
     376                     ERROR("CTreeManager::DomainsFromBinary(StdIStream & is)", 
     377                           << "[ id = " << id << "] Bad id !");  
     378               } 
     379               grid->fromBinary(is); 
     380            } 
     381             
    314382         } 
    315383      } 
Note: See TracChangeset for help on using the changeset viewer.