Ignore:
Timestamp:
11/13/14 15:09:14 (9 years ago)
Author:
mhnguyen
Message:

Implementing buffer size auto-detection for mode client -server

+) Process xml tree in client side then send all the information to server
+) Only information enabled fields in enabled files are sent to server
+) Some important change in structure of code which must be refactored

Test
+) On Curie
+) Only mode client-server
+) Passed for all tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/file.cpp

    r501 r509  
    1818 
    1919namespace xios { 
    20     
     20 
    2121   /// ////////////////////// Définitions ////////////////////// /// 
    2222 
     
    2424      : CObjectTemplate<CFile>(), CFileAttributes() 
    2525      , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL) 
    26    {  
     26   { 
    2727     setVirtualFieldGroup() ; 
    2828     setVirtualVariableGroup() ; 
     
    3232      : CObjectTemplate<CFile>(id), CFileAttributes() 
    3333      , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL) 
    34     {  
     34    { 
    3535      setVirtualFieldGroup() ; 
    3636      setVirtualVariableGroup() ; 
     
    4141 
    4242   ///--------------------------------------------------------------- 
    43  
     43  //! Get name of file 
    4444   StdString CFile::GetName(void)   { return (StdString("file")); } 
    4545   StdString CFile::GetDefName(void){ return (CFile::GetName()); } 
     
    4747 
    4848   //---------------------------------------------------------------- 
    49  
     49   /*! 
     50   \brief Get data that will be written out. 
     51   Each enabled file in xml represents a physical netcdf file. 
     52   This function allows to access to data to be written out into netcdf file 
     53   \return data written out. 
     54   */ 
    5055   boost::shared_ptr<CDataOutput> CFile::getDataOutput(void) const 
    5156   { 
     
    5358   } 
    5459 
     60   /*! 
     61   \brief Get virtual field group 
     62      In each file, there always exists a field group which is the ancestor of all 
     63   fields in the file. This is considered be virtual because it is created automatically during 
     64   file initialization and it normally doesn't appear on xml file 
     65   \return Pointer to field group 
     66   */ 
    5567   CFieldGroup* CFile::getVirtualFieldGroup(void) const 
    5668   { 
     
    5870   } 
    5971 
     72   /*! 
     73   \brief Get virtual variable group 
     74      In each file, there always exists a variable group which is the ancestor of all 
     75   variable in the file. This is considered be virtual because it is created automatically during 
     76   file initialization and it normally doesn't appear on xml file 
     77   \return Pointer to variable group 
     78   */ 
    6079   CVariableGroup* CFile::getVirtualVariableGroup(void) const 
    6180   { 
     
    6382   } 
    6483 
     84   //! Get all fields of a file 
    6585   std::vector<CField*> CFile::getAllFields(void) const 
    6686   { 
    6787      return (this->vFieldGroup->getAllChildren()); 
    6888   } 
    69   
     89 
     90   //! Get all variables of a file 
    7091   std::vector<CVariable*> CFile::getAllVariables(void) const 
    7192   { 
     
    7495 
    7596   //---------------------------------------------------------------- 
    76  
    77    std::vector<CField*> CFile::getEnabledFields(int default_outputlevel,  
     97   /*! 
     98   \brief Get all enabled fields of file 
     99      A field is considered to be enabled if it fullfil these conditions: it is enabled, inside a enabled file 
     100   and its own level is not larger than file output level. 
     101   \param [in] default_outputlevel default value output level of file 
     102   \param [in] default_level default value level of field 
     103   \param [in] default_enabled flag determine by default if field is enabled 
     104   \return Vector of pointers of enabled fields 
     105   */ 
     106   std::vector<CField*> CFile::getEnabledFields(int default_outputlevel, 
    78107                                                int default_level, 
    79108                                                bool default_enabled) 
     
    88117 
    89118      std::vector<CField*> newEnabledFields; 
    90        
     119 
    91120      for ( it = this->enabledFields.begin() ; it != this->enabledFields.end(); it++ ) 
    92121      { 
     
    112141//            { it--; this->enabledFields.erase(it+1); continue; } 
    113142         } 
    114   
     143 
    115144//         CField* field_tmp=(*it).get() ; 
    116145//         shared_ptr<CField> sptfield=*it ; 
     
    130159 
    131160   //---------------------------------------------------------------- 
    132  
     161   //! Change virtual field group to a new one 
    133162   void CFile::setVirtualFieldGroup(CFieldGroup* newVFieldGroup) 
    134    {  
    135       this->vFieldGroup = newVFieldGroup;  
    136    } 
    137  
     163   { 
     164      this->vFieldGroup = newVFieldGroup; 
     165   } 
     166 
     167   //! Change virtual variable group to new one 
    138168   void CFile::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 
    139    {  
    140       this->vVariableGroup = newVVariableGroup;  
    141    } 
    142  
    143    //---------------------------------------------------------------- 
    144  
     169   { 
     170      this->vVariableGroup = newVVariableGroup; 
     171   } 
     172 
     173   //---------------------------------------------------------------- 
     174   //! Create virtual field group, which is done normally on initializing file 
    145175   void CFile::setVirtualFieldGroup(void) 
    146176   { 
     
    148178   } 
    149179 
     180   //! Create virtual variable group, which is done normally on initializing file 
    150181   void CFile::setVirtualVariableGroup(void) 
    151182   { 
     
    168199      return false ; 
    169200    } 
    170      
     201 
     202   //! Initialize a file in order to write into it 
    171203   void CFile::initFile(void) 
    172204   { 
     
    174206      CDate& currentDate=context->calendar->getCurrentDate() ; 
    175207      CContextServer* server=context->server ; 
    176              
     208 
    177209      if (! sync_freq.isEmpty()) syncFreq = CDuration::FromString(sync_freq.getValue()); 
    178210      if (! split_freq.isEmpty()) splitFreq = CDuration::FromString(split_freq.getValue()); 
     
    194226      nbDomain=setDomain.size() ; 
    195227 
    196       // create sub communicator for file   
     228      // create sub communicator for file 
    197229      int color=allDomainEmpty?0:1 ; 
    198230      MPI_Comm_split(server->intraComm,color,server->intraCommRank,&fileComm) ; 
    199231      if (allDomainEmpty) MPI_Comm_free(&fileComm) ; 
    200232      // 
    201        
    202     } 
    203      
     233 
     234    } 
     235 
     236    //! Verify state of a file 
    204237    void CFile::checkFile(void) 
    205238    { 
     
    208241      checkSplit() ; 
    209242    } 
    210        
    211       
     243 
     244 
     245    /*! 
     246    \brief Verify if synchronisation should be done 
     247        If syn option is enabled, syn frequence and current time will be used to 
     248    calculate the moment to syn file(s) 
     249    \return True if it is the moment to synchronize file, otherwise false 
     250    */ 
    212251   bool CFile::checkSync(void) 
    213252   { 
     
    225264      return false ; 
    226265    } 
    227      
    228      
     266 
     267    /*! 
     268    \brief Verify if splitting should be done 
     269        If split option is enabled, split frequence and current time will be used to 
     270    calculate the moment to split file 
     271    \return True if it is the moment to split file, otherwise false 
     272    */ 
    229273    bool CFile::checkSplit(void) 
    230274    { 
     
    235279        if (currentDate > *lastSplit+splitFreq) 
    236280        { 
    237           *lastSplit=*lastSplit+splitFreq ;     
     281          *lastSplit=*lastSplit+splitFreq ; 
    238282          std::vector<CField*>::iterator it, end = this->enabledFields.end(); 
    239283          for (it = this->enabledFields.begin() ;it != end; it++)  (*it)->resetNStep() ; 
     
    244288      return false ; 
    245289    } 
    246      
     290 
     291   /*! 
     292   \brief Create header of netcdf file 
     293   There are some information to fill in header of each netcdf. 
     294   */ 
    247295   void CFile::createHeader(void) 
    248296   { 
    249297      CContext* context = CContext::getCurrent() ; 
    250298      CContextServer* server=context->server ; 
    251       
     299 
    252300      if (!allDomainEmpty) 
    253301      { 
     
    273321           oss<<"_"<<lastSplit->getStr(splitFormat)<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStr(splitFormat); 
    274322         } 
    275             
     323 
    276324         bool multifile=true ; 
    277325         if (!type.isEmpty()) 
     
    280328           else if (type==type_attr::multiple_file) multifile=true ; 
    281329 
    282          }  
     330         } 
    283331#ifndef USING_NETCDF_PAR 
    284332         if (!multifile) 
     
    288336          } 
    289337#endif 
    290          if (multifile)  
     338         if (multifile) 
    291339         { 
    292340            int commSize, commRank ; 
    293341            MPI_Comm_size(fileComm,&commSize) ; 
    294342            MPI_Comm_rank(fileComm,&commRank) ; 
    295              
    296             if (server->intraCommSize > 1)  
     343 
     344            if (server->intraCommSize > 1) 
    297345            { 
    298346              oss << "_"  ; 
    299347              int width=0 ; int n=commSize-1 ; 
    300348              while(n != 0) { n=n/10 ; width++ ;} 
    301               if (!min_digits.isEmpty())  
     349              if (!min_digits.isEmpty()) 
    302350                if (width<min_digits) width=min_digits ; 
    303351              oss.width(width) ; 
     
    314362           if (par_access.getValue()=="independent") isCollective=false ; 
    315363           else if (par_access.getValue()=="collective") isCollective=true ; 
    316            else  
     364           else 
    317365           { 
    318366             ERROR("void Context::createDataOutput(void)", 
     
    332380         } 
    333381         this->data_out->writeTimeDimension(); 
    334           
     382 
    335383         for (it = this->enabledFields.begin() ;it != end; it++) 
    336384         { 
     
    338386            this->data_out->writeField(field); 
    339387         } 
    340           
     388 
    341389         vector<CVariable*> listVars = getAllVariables() ; 
    342390         for (vector<CVariable*>::iterator it = listVars.begin() ;it != listVars.end(); it++) this-> data_out-> writeAttribute(*it) ; 
    343           
     391 
    344392         this->data_out->definition_end(); 
    345393      } 
    346394   } 
    347395 
     396   //! Close file 
    348397   void CFile::close(void) 
    349398   { 
     
    351400     delete lastSplit ; 
    352401     if (!allDomainEmpty) 
    353        if (isOpen)  
     402       if (isOpen) 
    354403       { 
    355404         this->data_out->closeFile(); 
     
    359408   //---------------------------------------------------------------- 
    360409 
     410   /*! 
     411   \brief Parse xml file and write information into file object 
     412   \param [in] node xmld node corresponding in xml file 
     413   */ 
    361414   void CFile::parse(xml::CXMLNode & node) 
    362415   { 
    363416      SuperClass::parse(node); 
    364        
     417 
    365418      if (node.goToChildElement()) 
    366419      { 
     
    376429   //---------------------------------------------------------------- 
    377430 
     431   /*! 
     432   \brief Represent a file in form of string with all its info 
     433   \return String 
     434   */ 
    378435   StdString CFile::toString(void) const 
    379436   { 
     
    391448 
    392449   //---------------------------------------------------------------- 
    393     
     450 
     451   /*! 
     452   \brief Find all inheritace among objects in a file. 
     453   \param [in] apply (true) write attributes of parent into ones of child if they are empty 
     454                     (false) write attributes of parent into a new container of child 
     455   \param [in] parent 
     456   */ 
    394457   void CFile::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
    395458   { 
    396459      SuperClassAttribute::setAttributes(parent,apply); 
    397       this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL);  
     460      this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); 
    398461      this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 
    399462   } 
     
    401464   //---------------------------------------------------------------- 
    402465 
    403    void CFile::processEnabledFile(void) 
    404    { 
    405      if (output_freq.isEmpty()) ERROR("void CFile::processEnabledFile(void)", 
    406                                        <<"File attribute <<output_freq>> is undefined");  
    407      solveFieldRefInheritance(true) ; 
    408      getEnabledFields() ; 
    409      processEnabledFields() ; 
    410    } 
    411     
    412    void CFile::processEnabledFields(void) 
    413    { 
    414       for (unsigned int i = 0; i < this->enabledFields.size(); i++) 
    415       { 
    416         this->enabledFields[i]->processEnabledField() ; 
    417       } 
    418     } 
    419      
     466//   void CFile::processEnabledFile(void) 
     467//   { 
     468//     if (output_freq.isEmpty()) ERROR("void CFile::processEnabledFile(void)", 
     469//                                       <<"File attribute <<output_freq>> is undefined"); 
     470//     solveFieldRefInheritance(true) ; 
     471//     getEnabledFields() ; 
     472//     processEnabledFields() ; 
     473//   } 
     474 
     475//   void CFile::processEnabledFields(void) 
     476//   { 
     477//      for (unsigned int i = 0; i < this->enabledFields.size(); i++) 
     478//      { 
     479//        this->enabledFields[i]->processEnabledField() ; 
     480//      } 
     481//   } 
     482 
     483   /*! 
     484   \brief Resolve all reference of active fields. 
     485      In order to know exactly which data each active field has, a search for all its 
     486   reference to find its parents or/and its base reference object must be done. Moreover 
     487   during this search, there are some information that can only be sent to server AFTER 
     488   all information of active fields are created on server side, e.g: checking mask or index 
     489   \param [in] sendToServer: Send all info to server (true) or only a part of it (false) 
     490   */ 
     491   void CFile::solveAllRefOfEnabledFields(bool sendToServer) 
     492   { 
     493     int size = this->enabledFields.size(); 
     494     for (int i = 0; i < size; ++i) 
     495     { 
     496       this->enabledFields[i]->solveAllReferenceEnabledField(sendToServer); 
     497     } 
     498   } 
     499 
     500   /*! 
     501   \brief Contruct all expression related to active fields. 
     502      Each field can do some expressions which appear on the xml file, and itself can be 
     503   a result of an expression among some other fields. This function builds all possible expression 
     504   relating to active fields. 
     505   */ 
     506   void CFile::buildAllExpressionOfEnabledFields() 
     507   { 
     508     int size = this->enabledFields.size(); 
     509     for (int i = 0; i < size; ++i) 
     510     { 
     511       this->enabledFields[i]->buildAllExpressionEnabledField(); 
     512     } 
     513   } 
     514 
    420515   void CFile::solveFieldRefInheritance(bool apply) 
    421516   { 
     
    441536         this->enabledFields[i]->solveOperation(); 
    442537   } 
    443   
     538 
    444539   void CFile::solveEFExpression(void) 
    445540   { 
    446541      for (unsigned int i = 0; i < this->enabledFields.size(); i++) 
    447542         this->enabledFields[i]->buildExpression(); 
    448    }    
    449   
    450  
     543   } 
     544 
     545   /*! 
     546   \brief Add a field into file. 
     547      A field is added into file and it will be written out if the file is enabled and 
     548   level of this field is smaller than level_output. A new field won't be created if one 
     549   with id has already existed 
     550   \param [in] id String identity of new field 
     551   \return Pointer to added (or already existed) field 
     552   */ 
    451553   CField* CFile::addField(const string& id) 
    452554   { 
     
    454556   } 
    455557 
     558   /*! 
     559   \brief Add a field group into file. 
     560      A field group is added into file and it will play a role as parents for fields. 
     561   A new field group won't be created if one with id has already existed 
     562   \param [in] id String identity of new field group 
     563   \return Pointer to added (or already existed) field group 
     564   */ 
    456565   CFieldGroup* CFile::addFieldGroup(const string& id) 
    457566   { 
    458567     return vFieldGroup->createChildGroup(id) ; 
    459568   } 
    460   
     569 
     570   /*! 
     571   \brief Add a variable into file. 
     572      A variable is added into file and if one with id has already existed, pointer to 
     573   it will be returned. 
     574      Variable as long as attributes are information container of file. 
     575   However, whereas attributes are "fixed" information, variables provides a more flexible way to user 
     576   to fill in (extra) information for a file. 
     577   \param [in] id String identity of new variable 
     578   \return Pointer to added (or already existed) variable 
     579   */ 
    461580   CVariable* CFile::addVariable(const string& id) 
    462581   { 
     
    464583   } 
    465584 
     585   /*! 
     586   \brief Add a variable group into file. 
     587      A variable group is added into file and it will play a role as parents for variables. 
     588   A new variable group won't be created if one with id has already existed 
     589   \param [in] id String identity of new variable group 
     590   \return Pointer to added (or already existed) variable group 
     591   */ 
    466592   CVariableGroup* CFile::addVariableGroup(const string& id) 
    467593   { 
    468594     return vVariableGroup->createChildGroup(id) ; 
    469595   } 
    470     
    471    
     596 
     597   /*! 
     598   \brief Send a message to create a field on server side 
     599   \param[in] id String identity of field that will be created on server 
     600   */ 
    472601   void CFile::sendAddField(const string& id) 
    473602   { 
    474603    CContext* context=CContext::getCurrent() ; 
    475      
     604 
    476605    if (! context->hasServer ) 
    477606    { 
    478607       CContextClient* client=context->client ; 
    479608 
    480        CEventClient event(this->getType(),EVENT_ID_ADD_FIELD) ;    
     609       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD) ; 
    481610       if (client->isServerLeader()) 
    482611       { 
     
    489618       else client->sendEvent(event) ; 
    490619    } 
    491        
    492    } 
    493     
     620 
     621   } 
     622 
     623   /*! 
     624   \brief Send a message to create a field group on server side 
     625   \param[in] id String identity of field group that will be created on server 
     626   */ 
    494627   void CFile::sendAddFieldGroup(const string& id) 
    495628   { 
     
    499632       CContextClient* client=context->client ; 
    500633 
    501        CEventClient event(this->getType(),EVENT_ID_ADD_FIELD_GROUP) ;    
     634       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD_GROUP) ; 
    502635       if (client->isServerLeader()) 
    503636       { 
     
    510643       else client->sendEvent(event) ; 
    511644    } 
    512        
    513    } 
    514     
     645 
     646   } 
     647 
     648   /*! 
     649   \brief Receive a message annoucing the creation of a field on server side 
     650   \param[in] event Received event 
     651   */ 
    515652   void CFile::recvAddField(CEventServer& event) 
    516653   { 
    517        
     654 
    518655      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    519656      string id; 
     
    521658      get(id)->recvAddField(*buffer) ; 
    522659   } 
    523     
    524     
     660 
     661   /*! 
     662   \brief Receive a message annoucing the creation of a field on server side 
     663   \param[in] buffer Buffer containing message 
     664   */ 
    525665   void CFile::recvAddField(CBufferIn& buffer) 
    526666   { 
     
    530670   } 
    531671 
     672   /*! 
     673   \brief Receive a message annoucing the creation of a field group on server side 
     674   \param[in] event Received event 
     675   */ 
    532676   void CFile::recvAddFieldGroup(CEventServer& event) 
    533677   { 
    534        
     678 
    535679      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    536680      string id; 
     
    538682      get(id)->recvAddFieldGroup(*buffer) ; 
    539683   } 
    540     
    541     
     684 
     685   /*! 
     686   \brief Receive a message annoucing the creation of a field group on server side 
     687   \param[in] buffer Buffer containing message 
     688   */ 
    542689   void CFile::recvAddFieldGroup(CBufferIn& buffer) 
    543690   { 
     
    546693      addFieldGroup(id) ; 
    547694   } 
    548     
    549  
    550  
    551  
    552  
    553  
    554  
    555  
    556  
    557  
    558  
     695 
     696   /*! 
     697   \brief Send messages to duplicate all variables on server side 
     698      Because each variable has also its attributes. So first thing to do is replicate 
     699   all these attributes on server side. Because variable can have a value, the second thing 
     700   is to duplicate this value on server, too. 
     701   */ 
     702   void CFile::sendAddAllVariables() 
     703   { 
     704     if (!getAllVariables().empty()) 
     705     { 
     706       // Firstly, it's necessary to add virtual variable group 
     707       sendAddVariableGroup(getVirtualVariableGroup()->getId()); 
     708 
     709       // Okie, now we can add to this variable group 
     710       std::vector<CVariable*> allVar = getAllVariables(); 
     711       std::vector<CVariable*>::const_iterator it = allVar.begin(); 
     712       std::vector<CVariable*>::const_iterator itE = allVar.end(); 
     713 
     714       for (; it != itE; ++it) 
     715       { 
     716         std::cout << "Variable Files " << (*it)->getId() << std::endl; 
     717         this->sendAddVariable((*it)->getId()); 
     718         (*it)->sendAllAttributesToServer(); 
     719         (*it)->sendValue(); 
     720       } 
     721     } 
     722   } 
     723 
     724   /*! 
     725   \brief Send a message to create a variable on server side 
     726      A variable always belongs to a variable group 
     727   \param[in] id String identity of variable that will be created on server 
     728   */ 
    559729   void CFile::sendAddVariable(const string& id) 
    560730   { 
    561731    CContext* context=CContext::getCurrent() ; 
    562      
     732 
    563733    if (! context->hasServer ) 
    564734    { 
    565735       CContextClient* client=context->client ; 
    566736 
    567        CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE) ;    
     737       CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE) ; 
    568738       if (client->isServerLeader()) 
    569739       { 
     
    576746       else client->sendEvent(event) ; 
    577747    } 
    578        
    579    } 
    580     
     748 
     749   } 
     750 
     751   /*! 
     752   \brief Send a message to create a variable group on server side 
     753   \param[in] id String identity of variable group that will be created on server 
     754   */ 
    581755   void CFile::sendAddVariableGroup(const string& id) 
    582756   { 
     
    586760       CContextClient* client=context->client ; 
    587761 
    588        CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE_GROUP) ;    
     762       CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE_GROUP) ; 
    589763       if (client->isServerLeader()) 
    590764       { 
     
    597771       else client->sendEvent(event) ; 
    598772    } 
    599        
    600    } 
    601     
     773 
     774   } 
     775 
     776   /*! 
     777   \brief Receive a message annoucing the creation of a variable on server side 
     778   \param[in] event Received event 
     779   */ 
    602780   void CFile::recvAddVariable(CEventServer& event) 
    603781   { 
    604        
     782 
    605783      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    606784      string id; 
     
    608786      get(id)->recvAddVariable(*buffer) ; 
    609787   } 
    610     
    611     
     788 
     789   /*! 
     790   \brief Receive a message annoucing the creation of a variable on server side 
     791   \param[in] buffer Buffer containing message 
     792   */ 
    612793   void CFile::recvAddVariable(CBufferIn& buffer) 
    613794   { 
     
    617798   } 
    618799 
     800   /*! 
     801   \brief Receive a message annoucing the creation of a variable group on server side 
     802   \param[in] event Received event 
     803   */ 
    619804   void CFile::recvAddVariableGroup(CEventServer& event) 
    620805   { 
    621        
     806 
    622807      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    623808      string id; 
     
    625810      get(id)->recvAddVariableGroup(*buffer) ; 
    626811   } 
    627     
    628     
     812 
     813   /*! 
     814   \brief Receive a message annoucing the creation of a variable group on server side 
     815   \param[in] buffer Buffer containing message 
     816   */ 
    629817   void CFile::recvAddVariableGroup(CBufferIn& buffer) 
    630818   { 
     
    634822   } 
    635823 
    636  
    637  
    638  
    639  
     824   /*! 
     825     \brief Sending all active (enabled) fields from client to server. 
     826   Each field is identified uniquely by its string identity. Not only should we 
     827   send the id to server but also we need to send ids of reference domain and reference axis. 
     828   With these two id, it's easier to make reference to grid where all data should be written. 
     829   Remark: This function must be called AFTER all active (enabled) files have been created on the server side 
     830   */ 
     831   void CFile::sendEnabledFields() 
     832   { 
     833     int size = this->enabledFields.size(); 
     834     CField* fieldPtr(0); 
     835     for (int i = 0; i < size; ++i) 
     836     { 
     837       fieldPtr = this->enabledFields[i]; 
     838       if (fieldPtr->name.isEmpty()) fieldPtr->name.setValue(fieldPtr->getBaseFieldReference()->getId()); 
     839       std::cout << "Enabled Fields " << i << " " << CField::get(fieldPtr)->getId() << std::endl; 
     840       this->sendAddField(fieldPtr->getId()); 
     841       fieldPtr->sendAllAttributesToServer(); 
     842       fieldPtr->sendAddAllVariables(); 
     843     } 
     844   } 
     845 
     846   /*! 
     847   \brief Dispatch event received from client 
     848      Whenever a message is received in buffer of server, it will be processed depending on 
     849   its event type. A new event type should be added in the switch list to make sure 
     850   it processed on server side. 
     851   \param [in] event: Received message 
     852   */ 
    640853   bool CFile::dispatchEvent(CEventServer& event) 
    641854   { 
     
    649862             return true ; 
    650863             break ; 
    651           
     864 
    652865           case EVENT_ID_ADD_FIELD_GROUP : 
    653866             recvAddFieldGroup(event) ; 
    654867             return true ; 
    655              break ;        
    656   
     868             break ; 
     869 
    657870            case EVENT_ID_ADD_VARIABLE : 
    658871             recvAddVariable(event) ; 
    659872             return true ; 
    660873             break ; 
    661           
     874 
    662875           case EVENT_ID_ADD_VARIABLE_GROUP : 
    663876             recvAddVariableGroup(event) ; 
    664877             return true ; 
    665              break ;                
     878             break ; 
    666879           default : 
    667880              ERROR("bool CFile::dispatchEvent(CEventServer& event)", <<"Unknown Event") ; 
     
    670883      } 
    671884   } 
    672     
    673     
    674     
    675     
     885 
     886 
     887 
     888 
    676889   ///--------------------------------------------------------------- 
    677890 
Note: See TracChangeset for help on using the changeset viewer.