Changeset 274


Ignore:
Timestamp:
09/15/11 10:19:26 (13 years ago)
Author:
hozdoba
Message:

nouvelle interface fortran et corrections

Location:
XMLIO_V2/dev/common
Files:
30 added
7 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/common/make_xios

    r248 r274  
    7979export PATH=$PWD/tools/FCM/bin:$PATH 
    8080 
    81 $make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp      $make_dir/src/xmlio/iface/interface.cpp.in 
    82 $make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in 
     81#$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp      $make_dir/src/xmlio/iface/interface.cpp.in 
     82#$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in 
    8383 
    8484fcm build 
  • XMLIO_V2/dev/common/src/xmlio/attribute_template_impl.hpp

    r219 r274  
    6060      { 
    6161         if (SuperClass::isEmpty()) 
     62         { 
    6263            ERROR("T CAttributeTemplate<T>::getValue(void) const", 
    6364                  << "[ id = " << this->getId() << "]" 
    6465                  << " L'attribut est requis mais n'est pas défini !"); 
     66          } 
    6567         return (SuperClass::getValue<T>()); 
    6668      } 
  • XMLIO_V2/dev/common/src/xmlio/buffer_impl.hpp

    r219 r274  
    88      /// ////////////////// Définitions (inline) /////////////////// /// 
    99 
    10 #define DATA_HEADER_SIZE  sizeof(CBufferDataType) + 2 * sizeof(StdSize) + sizeof(bool) 
     10#define DATA_HEADER_SIZE  sizeof(CBuffer::CBufferDataType) + 2 * sizeof(StdSize) + sizeof(bool) 
    1111 
    1212      template <class T> 
  • XMLIO_V2/dev/common/src/xmlio/config/context_attribute.conf

    r219 r274  
    22DECLARE_ATTRIBUTE(StdString, start_date) 
    33 
    4    DECLARE_ATTRIBUTE(StdString, output_dir) 
     4DECLARE_ATTRIBUTE(StdString, output_dir) 
     5 
  • XMLIO_V2/dev/common/src/xmlio/config/var_attribute.conf

    r219 r274  
    1  
     1DECLARE_ATTRIBUTE(StdString, type) 
  • XMLIO_V2/dev/common/src/xmlio/data_output.cpp

    r219 r274  
    22 
    33#include "attribute_template_impl.hpp" 
     4#include "group_template_impl.hpp" 
    45#include "context.hpp" 
    56 
  • XMLIO_V2/dev/common/src/xmlio/data_treatment.hpp

    r268 r274  
    125125         std::vector<boost::shared_ptr<CField> >::const_iterator 
    126126               it = refField.begin(), end = refField.end(); 
    127 //       std::cout << "nb :" << refField.size() << std::endl; 
    128127         for (; it != end; it++) 
    129128         { 
    130129            boost::shared_ptr<CField> field = *it; 
    131130            boost::shared_ptr<CFile>  file  = field->getRelFile(); 
    132 //  std::cout << ">> " << fieldId << ", " << file->getId() << std::endl; 
    133131            if (field->updateData(currDate, timestep, data)) 
    134132            { 
  • XMLIO_V2/dev/common/src/xmlio/declare_group.hpp

    r219 r274  
    2727   };                                                                 \ 
    2828   typedef type##Group type##Definition 
     29    
     30#define DECLARE_GROUP_PARSE_REDEF(type)                                  \ 
     31   class type##Group                                                     \ 
     32      : public CGroupTemplate<type, type##Group, type##Attributes>       \ 
     33   {                                                                     \ 
     34      public:                                                            \ 
     35         typedef type              RelChild;                             \ 
     36         typedef type##Group       RelGroup;                             \ 
     37         typedef type##Attributes  RelAttributes;                        \ 
     38         typedef CGroupTemplate<type, type##Group, type##Attributes>     \ 
     39                 SuperClass;                                             \ 
     40                                                                         \ 
     41         type##Group(void)                                               \ 
     42            : CGroupTemplate<RelChild, RelGroup, RelAttributes> ()       \ 
     43         { /* Ne rien faire de plus */ }                                 \ 
     44         type##Group(const StdString& _id)                               \ 
     45            : CGroupTemplate<RelChild, RelGroup, RelAttributes> (_id)    \ 
     46         { /* Ne rien faire de plus */ }                                 \ 
     47                                                                         \ 
     48         static ENodeType GetType(void)                                  \ 
     49         { return static_cast<ENodeType>(RelChild::GetType()+1); }       \ 
     50                                                                         \ 
     51         virtual void parse(xml::CXMLNode & node, bool withAttr = true); \ 
     52                                                                         \ 
     53         virtual ~type##Group(void)                                      \ 
     54         { /* Ne rien faire de plus */ }                                 \ 
     55   };                                                                    \ 
     56   typedef type##Group type##Definition 
    2957 
    3058#endif // __XMLIO_DECLARE_GROUP__ 
  • XMLIO_V2/dev/common/src/xmlio/group_template.hpp

    r219 r274  
    4343 
    4444         virtual void parse(xml::CXMLNode & node); 
    45          inline void parse(xml::CXMLNode & node, bool withAttr); 
     45         virtual void parse(xml::CXMLNode & node, bool withAttr); 
    4646          
    4747         /// Test /// 
  • XMLIO_V2/dev/common/src/xmlio/main_server.cpp

    r268 r274  
    88#include "server.hpp" 
    99 
    10 #include "fake.hpp" 
    11  
    1210// Point d'entrée du programme principal 
    1311 
     
    1715   { 
    1816      MPIComm comm_client, comm_client_server, comm_server; 
    19       //comm::CMPIManager::Initialise(&argc, &argv); // < seulement en mode connecté 
     17      comm::CMPIManager::Initialise(&argc, &argv); // < seulement en mode connecté 
    2018       
    21       //CTreeManager::ParseFile  ("test/iodef_simple_test.xml"); 
    22       //CTreeManager::PrintTreeToFile("wk/def/test.xml"); 
     19      CTreeManager::ParseFile  ("test/iodef_simple_test.xml"); 
     20      CTreeManager::PrintTreeToFile("wk/def/test.xml"); 
    2321      
    24       //comm::CMPIManager::Finalize();               // < seulement en mode connecté 
     22      comm::CMPIManager::Finalize();               // < seulement en mode connecté 
    2523 
    26       CXIOSManager::Initialise (CXIOSManager::CLIENT_SERVER, &argc, &argv); 
    27        
    28       //---------------------------------------------------------------------- 
    29       //CXIOSManager::AddClient("nemo"    , 4, 2, &nemo_fake_entry); 
    30       //CXIOSManager::AddClient("orchidee", 1, 1, &orchidee_fake_entry); 
    31       //CXIOSManager::AddClient("lmdz"    , 4, 2, &lmdz_fake_entry); 
    32        
    33       CMPIManager::DispatchClient(true, comm_client, comm_client_server,  comm_server); 
    34       CXIOSManager::RunServer("Nemo", comm_client_server, comm_server); 
    35       //CXIOSManager::RunClientServer (comm::CMPIManager::GetCommWorld ());      
    36       CXIOSManager::Finalize (); 
     24      //CXIOSManager::Initialise (CXIOSManager::CLIENT_SERVER, &argc, &argv); 
     25      //CMPIManager::DispatchClient(true, comm_client, comm_client_server,  comm_server); 
     26      //CXIOSManager::RunServer("Nemo", comm_client_server, comm_server); 
     27      //CXIOSManager::Finalize (); 
    3728   } 
    3829   catch (CException & exc) 
  • XMLIO_V2/dev/common/src/xmlio/manager/mpi_manager.cpp

    r268 r274  
    251251      _outdata.resize(recvcount);      
    252252      if (MPI_Allgather ( const_cast<int*>(&(_indata[0])), sendcount, MPI_INTEGER, 
    253                                           &(_outdata[0]) , recvcount, MPI_INTEGER, _comm) != MPI_SUCCESS) 
     253                                          &(_outdata[0]) , sendcount, MPI_INTEGER, _comm) != MPI_SUCCESS) 
    254254         ERROR("CMPIManager::AllGather (indata, outdata, comm)", << " MPI Error !"); 
    255255   } 
  • XMLIO_V2/dev/common/src/xmlio/manager/tree_manager.cpp

    r233 r274  
    121121                           CContext::GetContextGroup(); 
    122122                            
    123          is.read (reinterpret_cast<char*>(&renum), sizeof(StdSize));    
    124          is.read (reinterpret_cast<char*>(&ctxtnb), sizeof(ENodeType)); 
     123         is.read (reinterpret_cast<char*>(&renum), sizeof(ENodeType));    
     124         is.read (reinterpret_cast<char*>(&ctxtnb), sizeof(StdSize)); 
    125125 
    126126         if (renum != CContextGroup::GetType()) 
    127127            ERROR("CTreeManager::FromBinary(StdIStream & is)", 
    128128                  << "[ renum = " << renum << "] Bad type !"); 
     129                   
     130                   
     131//         std::cout << "Nombre de contexte :" << ctxtnb << std::endl; 
    129132 
    130133         for (StdSize i = 0; i < ctxtnb; i++) 
     
    144147               StdString id(size, ' '); 
    145148               is.read (const_cast<char *>(id.data()), size * sizeof(char)); 
     149                
     150//               std::cout << "context ::::" << id << std::endl; 
    146151                
    147152               CTreeManager::SetCurrentContextId(id);                
  • XMLIO_V2/dev/common/src/xmlio/manager/xios_manager.cpp

    r233 r274  
    6767         StdString main_data_tree = clientBuffer[0]->getString(0);         
    6868         tree::CTreeManager::FromBinary(main_data_tree); 
     69         std::cout << "main_data_tree" << main_data_tree.size() << std::endl; 
    6970          
    7071         // Obtention des sous-domaines clients. 
     
    7475            tree::CTreeManager::DomainsFromBinary(main_data_tree); 
    7576         } 
     77          
     78         StdOStringStream osss; 
     79         osss << StdString("./def_server_next.") 
     80              << CMPIManager::GetCommRank(CMPIManager::GetCommWorld()); 
     81         CTreeManager::PrintTreeToFile(osss.str()); 
    7682 
    7783         {  // Traitement de tous les contextes 
     
    8288                               it = def_vector.begin(), end = def_vector.end(); 
    8389 
    84             for (; it != end; it++) 
     90            //for (; it != end; it++ ) 
    8591            { 
    8692               boost::shared_ptr<CContext> context = *it; 
     93               CTreeManager::SetCurrentContextId(context->getId()); 
    8794               boost::shared_ptr<data::CDataTreatment> dt(new data::CDataTreatment (context)); 
    8895               context->setDataTreatment(dt); 
     
    93100         
    94101         StdOStringStream oss; 
    95          oss << StdString("data/def/def_server_end.") 
     102         oss << StdString("./def_server_end.") 
    96103             << CMPIManager::GetCommRank(CMPIManager::GetCommWorld()); 
    97104         CTreeManager::PrintTreeToFile(oss.str());       
     
    233240      //--------------------------------------------------------------- 
    234241       
    235       void CXIOSManager::RunClient(comm::MPIComm comm_client) 
    236       { 
    237          CXIOSManager::Status  = LOC_CLIENT_SERVER; 
    238          (CXIOSManager::Clients.begin()->second.entry)(comm_client, comm_client, comm_client); 
     242      void CXIOSManager::RunClient(bool launch, comm::MPIComm comm_client) 
     243      { 
     244         if (launch) 
     245         { 
     246            CXIOSManager::Status  = LOC_CLIENT_SERVER;          
     247            (CXIOSManager::Clients.begin()->second.entry) 
     248               (comm_client, comm_client, comm_client); 
     249         } 
     250         else 
     251         { 
     252            CXIOSManager::Status  = LOC_CLIENT; 
     253         } 
    239254      } 
    240255 
  • XMLIO_V2/dev/common/src/xmlio/manager/xios_manager.hpp

    r219 r274  
    4343         static void RunServer(StdString clientName, 
    4444                               comm::MPIComm comm_client_server, comm::MPIComm comm_server); 
    45          static void RunClient(comm::MPIComm comm_client = 
    46                                comm::CMPIManager::GetCommWorld()); 
     45         static void RunClient(bool launch = false, comm::MPIComm comm_client = 
     46                                                    comm::CMPIManager::GetCommWorld()); 
    4747         static void RunClientServer(comm::MPIComm comm_client_server = 
    4848                                     comm::CMPIManager::GetCommWorld()); 
  • XMLIO_V2/dev/common/src/xmlio/node/context.cpp

    r268 r274  
    201201               << "[ renum = " << renum << "] Bad type !");                \ 
    202202      if (val) CObjectFactory::CreateObject<C##Name_##Definition>          \ 
    203                   (C##Name_##Definition::GetDefName()) -> fromBinary(is); \ 
     203                   (C##Name_##Definition::GetDefName()) -> fromBinary(is); \ 
    204204   }    
    205205#define DECLARE_NODE_PAR(Name_, name_) 
  • XMLIO_V2/dev/common/src/xmlio/node/domain.cpp

    r266 r274  
    66 
    77#include "mpi_manager.hpp" 
     8 
     9#include "tree_manager.hpp" 
    810 
    911#include <algorithm> 
     
    1820      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 
    1921      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
     22      , ibegin_zoom_sub(), jbegin_zoom_sub() 
    2023      , lonvalue_sub(), latvalue_sub() 
    2124   { /* Ne rien faire de plus */ } 
     
    2528      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 
    2629      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
     30      , ibegin_zoom_sub(), jbegin_zoom_sub() 
    2731      , lonvalue_sub(), latvalue_sub() 
    2832   { /* Ne rien faire de plus */ } 
     
    8185      SuperClass::fromBinary(is); 
    8286       
    83       this->ibegin_sub.push_back(this->ibegin.getValue()); 
    84       this->jbegin_sub.push_back(this->jbegin.getValue()); 
    85       this->iend_sub.push_back(this->iend.getValue()); 
    86       this->jend_sub.push_back(this->jend.getValue());  
    87        
    88       this->latvalue_sub.push_back(this->latvalue.getValue()); 
    89       this->lonvalue_sub.push_back(this->lonvalue.getValue());    
     87      if ( !this->ibegin.isEmpty()   && 
     88           !this->jbegin.isEmpty()   && 
     89           !this->iend.isEmpty()     && 
     90           !this->jend.isEmpty()     && 
     91           !this->latvalue.isEmpty() && 
     92           !this->lonvalue.isEmpty()) 
     93      { 
     94       
     95         this->ibegin_sub.push_back(this->ibegin.getValue()); 
     96         this->jbegin_sub.push_back(this->jbegin.getValue()); 
     97         this->iend_sub.push_back(this->iend.getValue()); 
     98         this->jend_sub.push_back(this->jend.getValue());  
     99          
     100         this->ibegin_zoom_sub.push_back(this->zoom_ibegin_loc.getValue()); 
     101         this->jbegin_zoom_sub.push_back(this->zoom_jbegin_loc.getValue()); 
     102       
     103         this->latvalue_sub.push_back(this->latvalue.getValue()); 
     104         this->lonvalue_sub.push_back(this->lonvalue.getValue()); 
     105      } 
    90106       
    91107#define CLEAR_ATT(name_)\ 
     
    107123#undef CLEAR_ATT 
    108124 
    109       this->ibegin.setValue(*std::min_element(this->ibegin_sub.begin(),this->ibegin_sub.end())); 
    110       this->jbegin.setValue(*std::min_element(this->jbegin_sub.begin(),this->jbegin_sub.end())); 
    111       this->iend.setValue(*std::max_element(this->iend_sub.begin(),this->iend_sub.end())); 
    112       this->jend.setValue(*std::max_element(this->jend_sub.begin(),this->jend_sub.end())); 
     125      if ( !this->ibegin.isEmpty()   && 
     126           !this->jbegin.isEmpty()   && 
     127           !this->iend.isEmpty()     && 
     128           !this->jend.isEmpty()     && 
     129           !this->latvalue.isEmpty() && 
     130           !this->lonvalue.isEmpty()) 
     131      { 
     132 
     133         this->ibegin.setValue(*std::min_element(this->ibegin_sub.begin(),this->ibegin_sub.end())); 
     134         this->jbegin.setValue(*std::min_element(this->jbegin_sub.begin(),this->jbegin_sub.end())); 
     135         this->iend.setValue(*std::max_element(this->iend_sub.begin(),this->iend_sub.end())); 
     136         this->jend.setValue(*std::max_element(this->jend_sub.begin(),this->jend_sub.end())); 
     137      } 
    113138   } 
    114139 
     
    124149   { 
    125150      if ((ni_glo.isEmpty() || ni_glo.getValue() <= 0 ) || 
    126           (ni_glo.isEmpty() || nj_glo.getValue() <= 0 )) 
     151          (nj_glo.isEmpty() || nj_glo.getValue() <= 0 )) 
     152      { 
     153         abort(); 
    127154         ERROR("CDomain::checkAttributes(void)", 
    128155               << "[ Id = " << this->getId() << " ] " 
    129156               << "Le domaine global est mal défini," 
    130                << " vérifiez les valeurs de \'ni_glo\' et \'nj_glo\' !") ; 
     157               << " vérifiez les valeurs de \'ni_glo\' et \'nj_glo\' !")  
     158      } 
    131159   } 
    132160 
     
    675703   //---------------------------------------------------------------- 
    676704    
     705   const std::vector<int> & CDomain::getIBeginZoomSub(void) const 
     706   { 
     707      return (this->ibegin_zoom_sub); 
     708   } 
     709                
     710   //---------------------------------------------------------------- 
     711                      
    677712   const std::vector<int> & CDomain::getIEndSub(void) const 
    678713   { 
     
    686721      return (this->jbegin_sub); 
    687722   } 
     723    
     724   //---------------------------------------------------------------- 
     725       
     726   const std::vector<int> & CDomain::getJBeginZoomSub(void) const 
     727   { 
     728      return (this->jbegin_zoom_sub); 
     729   } 
     730                   
    688731    
    689732   //---------------------------------------------------------------- 
  • XMLIO_V2/dev/common/src/xmlio/node/domain.hpp

    r266 r274  
    7777         const std::vector<int> & getJBeginSub(void) const; 
    7878         const std::vector<int> & getJEndSub(void) const; 
     79 
     80         const std::vector<int> & getIBeginZoomSub(void) const; 
     81         const std::vector<int> & getJBeginZoomSub(void) const; 
    7982          
    8083         const std::vector<ARRAY(double, 1)> & getLonValueSub(void) const; 
     
    110113 
    111114         std::vector<int> ibegin_sub, iend_sub, jbegin_sub, jend_sub; 
     115         std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub; 
    112116         std::vector<ARRAY(double, 1)> lonvalue_sub, latvalue_sub; 
    113117 
  • XMLIO_V2/dev/common/src/xmlio/node/grid.cpp

    r266 r274  
    437437      const std::vector<int> & ibegin = this->domain->getIBeginSub(); 
    438438      const std::vector<int> & jbegin = this->domain->getJBeginSub(); 
     439      const std::vector<int> & ibegin_zoom = this->domain->getIBeginZoomSub(); 
     440      const std::vector<int> & jbegin_zoom = this->domain->getJBeginZoomSub(); 
    439441       
    440442      const int ibegin_srv  = this->domain->ibegin.getValue(); 
     
    465467         const int jbegin_cl = jbegin[i]; 
    466468          
     469         int ibegin_zoom_cl = ibegin[i]; //ibegin_zoom[i]; 
     470         int jbegin_zoom_cl = jbegin[i]; //jbegin_zoom[i]; 
     471          
     472         if (ibegin_zoom.size() != 0) 
     473         { 
     474            ibegin_zoom_cl = ibegin_zoom[i]; 
     475            jbegin_zoom_cl = jbegin_zoom[i]; 
     476         } 
     477          
    467478         for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    468479         { 
    469480            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    470481            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    471                                   + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1); 
     482                                  /*+ (ibegin_cl - 1)*/ - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1);  
    472483            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
    473                                   + (jbegin_cl - 1) - (jbegin_srv - 1) - (jbegin_zoom_srv - 1); 
     484                                  /*+ (jbegin_cl - 1)*/ - (jbegin_srv - 1) + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
    474485            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    475486         } 
     
    493504         { 
    494505            ERROR("CGrid::computeIndexServer(void)", 
    495                   <<"Erreur d'indexation de la grille au niveau du serveur") ; 
     506                  << "[ grille = "      << this->getId() 
     507                  << ", ibegin_t = "    << ibegin_t 
     508                  << ", jbegin_t = "    << jbegin_t 
     509                  << ", iend_t = "      << iend_t 
     510                  << ", jend_t = "      << jend_t 
     511                  << ", zoom_ni_srv = " << zoom_ni_srv 
     512                  << ", zoom_nj_srv = " << zoom_nj_srv 
     513                  <<" ] Erreur d'indexation de la grille au niveau du serveur") ; 
    496514         } 
    497515      } 
  • XMLIO_V2/dev/common/src/xmlio/node/variable.cpp

    r268 r274  
    1616      : CObjectTemplate<CVariable>() 
    1717      , CVariableAttributes() 
     18      , content() 
    1819   { /* Ne rien faire de plus */ } 
    1920 
     
    2122      : CObjectTemplate<CVariable>(id) 
    2223      , CVariableAttributes() 
     24      , content() 
    2325   { /* Ne rien faire de plus */ } 
    2426 
     
    3032   ENodeType CVariable::GetType(void)   { return (eVariable); } 
    3133 
     34   void CVariable::parse(xml::CXMLNode & node) 
     35   { 
     36      SuperClass::parse(node); 
     37      StdString id = (this->hasId()) ? this->getId() : StdString("undefined"); 
     38      if (!node.getContent(this->content)) 
     39      { 
     40         ERROR("CVariable::parse(xml::CXMLNode & node)", 
     41               << "[ variable id = " << id 
     42               << " ] variable is not defined !"); 
     43      } 
     44   } 
     45 
     46   const StdString & CVariable::getContent (void) const 
     47   { 
     48      return (this->content); 
     49   } 
     50 
     51   StdString CVariable::toString(void) const 
     52   { 
     53      StdOStringStream oss; 
     54 
     55      oss << "<" << CVariable::GetName() << " "; 
     56      if (this->hasId()) 
     57         oss << " id=\"" << this->getId() << "\" "; 
     58      oss << SuperClassAttribute::toString() << ">" << std::endl 
     59          << this->content /*<< std::endl*/; 
     60      oss << "</" << CVariable::GetName() << " >"; 
     61      return (oss.str()); 
     62   } 
     63 
     64   void CVariable::toBinary(StdOStream & os) const 
     65   { 
     66     const StdString & content = this->content; 
     67     const StdSize size        =  content.size(); 
     68     SuperClass::toBinary(os); 
     69 
     70     os.write (reinterpret_cast<const char*>(&size), sizeof(StdSize)); 
     71     os.write (content.data(), size * sizeof(char)); 
     72   } 
     73 
     74   void CVariable::fromBinary(StdIStream & is) 
     75   { 
     76      SuperClass::fromBinary(is); 
     77      StdSize size  = 0; 
     78      is.read (reinterpret_cast<char*>(&size), sizeof(StdSize)); 
     79      this->content.assign(size, ' '); 
     80      is.read (const_cast<char *>(this->content.data()), size * sizeof(char)); 
     81   } 
     82 
     83   void CVariableGroup::parse(xml::CXMLNode & node, bool withAttr) 
     84   { 
     85      boost::shared_ptr<CVariableGroup> group_ptr = (this->hasId()) 
     86         ? CObjectFactory::GetObject<CVariableGroup>(this->getId()) 
     87         : CObjectFactory::GetObject(this); 
     88 
     89      StdString content; 
     90      if (this->getId().compare(CVariableGroup::GetDefName()) != 0 && node.getContent(content)) 
     91      { 
     92        StdSize beginid = 0, endid = 0, begindata = 0, enddata = 0; 
     93        StdString subdata, subid; 
     94 
     95        while ((beginid = content.find_first_not_of ( " \r\n\t;", enddata)) != StdString::npos) 
     96        { 
     97           endid   = content.find_first_of ( " \r\n\t=", beginid ); 
     98           subid   = content.substr ( beginid, endid-beginid); 
     99 
     100           begindata = content.find_first_of ( "=", endid ) + 1; 
     101           enddata   = content.find_first_of ( ";", begindata ); 
     102           subdata   = content.substr ( begindata, enddata-begindata); 
     103 
     104           //std::cout << "\"" << subid << "\":\"" << subdata << "\"" << std::endl; 
     105           CGroupFactory::CreateChild(group_ptr, subid)->content = subdata; 
     106        } 
     107      } 
     108      else 
     109      { 
     110         SuperClass::parse(node, withAttr); 
     111      } 
     112      //SuperClass::parse(node, withAttr); 
     113 
     114   } 
     115 
    32116} // namespace tree 
    33117} // namespace xmlioserver 
  • XMLIO_V2/dev/common/src/xmlio/node/variable.hpp

    r268 r274  
    3535            typedef CVariableAttributes SuperClassAttribute; 
    3636 
     37            friend class CVariableGroup; 
     38 
    3739         public : 
    3840 
     
    4951            virtual ~CVariable(void); 
    5052 
     53         public : 
     54          
     55            /// Autres /// 
     56            virtual void parse(xml::CXMLNode & node); 
     57            virtual StdString toString(void) const; 
     58 
     59            virtual void toBinary  (StdOStream & os) const; 
     60            virtual void fromBinary(StdIStream & is); 
     61 
     62            /// Accesseur /// 
     63            const StdString & getContent (void) const; 
     64 
     65             
     66            template <typename T> inline void getData(T & _data) const; 
     67            template <typename T, StdSize N> 
     68               inline void getData(ARRAY(T, N) _data_array) const; 
     69 
     70         public : 
     71          
    5172            /// Accesseurs statiques /// 
    5273            static StdString GetName(void); 
    5374            static StdString GetDefName(void); 
    5475            static ENodeType GetType(void); 
     76 
     77         private : 
     78 
     79            StdString content; 
    5580 
    5681      }; // class CVar 
     
    5984 
    6085      // Declare/Define CVarGroup and CVarDefinition 
    61       DECLARE_GROUP(CVariable); 
     86      DECLARE_GROUP_PARSE_REDEF(CVariable); 
    6287 
    6388 
  • XMLIO_V2/dev/common/src/xmlio/output/nc4_data_output.cpp

    r268 r274  
    44#include <boost/lexical_cast.hpp> 
    55#include "attribute_template_impl.hpp" 
     6#include "group_template_impl.hpp" 
    67 
    78#include "file.hpp" 
  • XMLIO_V2/dev/common/src/xmlio/output/onetcdf4.cpp

    r266 r274  
    11#include "onetcdf4.hpp" 
     2#include "group_template_impl.hpp" 
    23 
    34namespace xmlioserver 
  • XMLIO_V2/dev/common/src/xmlio/server.cpp

    r219 r274  
    44#include "duration.hpp" 
    55#include "data_treatment.hpp" 
     6#include "group_template_impl.hpp" 
    67 
    78namespace xmlioserver { 
  • XMLIO_V2/dev/common/src/xmlio/xml_node.cpp

    r219 r274  
    6565      } 
    6666 
     67      bool CXMLNode::getContent(StdString & content) 
     68      { 
     69         if (this->node->value_size() == 0) return (false); 
     70         content.assign(this->node->value(), this->node->value_size()); 
     71         return (true); 
     72      } 
     73 
    6774      const StdString & CXMLNode::GetRootName(void) 
    6875      {  
  • XMLIO_V2/dev/common/src/xmlio/xml_node.hpp

    r219 r274  
    3333            bool goToChildElement(void); 
    3434            bool goToParentElement(void); 
     35            bool getContent(StdString & content); 
    3536 
    3637            /// Accesseurs statiques /// 
Note: See TracChangeset for help on using the changeset viewer.