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/object_template_impl.hpp

    r501 r509  
    5555      ERROR("CObjectTemplate<T> construtor 3", << "Not completly implemented yet !"); 
    5656   } 
    57     
     57 
    5858   template <class T> 
    5959      CObjectTemplate<T>::~CObjectTemplate(void) 
     
    6565      std::vector<boost::shared_ptr<T> > & 
    6666         CObjectTemplate<T>::GetAllVectobject(const StdString & contextId) 
    67    {  
    68       return (CObjectTemplate<T>::AllVectObj[contextId]);  
    69    } 
    70     
    71    //--------------------------------------------------------------- 
    72     
     67   { 
     68      return (CObjectTemplate<T>::AllVectObj[contextId]); 
     69   } 
     70 
     71   //--------------------------------------------------------------- 
     72 
    7373   template <class T> 
    7474      StdString CObjectTemplate<T>::toString(void) const 
     
    8484   template <class T> 
    8585      void CObjectTemplate<T>::fromString(const StdString & str) 
    86    {  
     86   { 
    8787      ERROR("CObjectTemplate<T>::fromString(str)", 
    88             << "[ str = " << str << "] Not implemented yet !");  
    89    } 
    90     
    91    //--------------------------------------------------------------- 
    92  
    93 /*    
     88            << "[ str = " << str << "] Not implemented yet !"); 
     89   } 
     90 
     91   //--------------------------------------------------------------- 
     92 
     93/* 
    9494   template <class T> 
    9595      void CObjectTemplate<T>::toBinary(StdOStream & os) const 
    9696   { 
    97       SuperClassMap::toBinary(os);     
    98    } 
    99        
     97      SuperClassMap::toBinary(os); 
     98   } 
     99 
    100100   template <class T> 
    101101      void CObjectTemplate<T>::fromBinary(StdIStream & is) 
    102102   { 
    103       SuperClassMap::fromBinary(is);  
     103      SuperClassMap::fromBinary(is); 
    104104   } 
    105105*/ 
     
    121121      return (T::GetType()); 
    122122   } 
    123    
     123 
    124124   template <class T> 
    125125   string CObjectTemplate<T>::getName(void) const 
     
    127127      return (T::GetName()); 
    128128   } 
    129    
     129 
    130130   //--------------------------------------------------------------- 
    131131 
    132132   template <class T> 
    133133      bool CObjectTemplate<T>::hasChild(void) const 
    134    {  
    135       return (false);  
     134   { 
     135      return (false); 
    136136   } 
    137137 
     
    140140   template <class T> 
    141141      void CObjectTemplate<T>::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
    142    {  
    143       SuperClassMap::setAttributes(parent, apply);  
     142   { 
     143      SuperClassMap::setAttributes(parent, apply); 
    144144   } 
    145145 
     
    160160   } 
    161161 
     162   template<typename T> 
     163   void CObjectTemplate<T>::sendAllAttributesToServer() 
     164   { 
     165     CAttributeMap& attrMap = *this; 
     166     CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end(); 
     167     for (; it != itE; ++it) 
     168     { 
     169       if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second)); 
     170     } 
     171 
     172   } 
     173 
    162174   template <class T> 
    163175   void CObjectTemplate<T>::sendAttributToServer(const string& id) 
     
    172184  { 
    173185    CContext* context=CContext::getCurrent() ; 
    174      
     186 
    175187    if (!context->hasServer) 
    176188    { 
    177189       CContextClient* client=context->client ; 
    178190 
    179        CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE) ;    
     191       CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE) ; 
    180192       if (client->isServerLeader()) 
    181193       { 
     
    189201       else client->sendEvent(event) ; 
    190202    } 
    191        
     203 
    192204  } 
    193     
     205 
    194206  template <class T> 
    195207  void CObjectTemplate<T>::recvAttributFromClient(CEventServer& event) 
    196208  { 
    197        
     209 
    198210    CBufferIn* buffer=event.subEvents.begin()->buffer; 
    199211    string id,attrId; 
     
    220232           return true ; 
    221233           break ; 
    222         
     234 
    223235         default : 
    224236         return false ; 
     
    227239      } 
    228240   } 
    229     
     241 
    230242   template <typename T> 
    231243   bool CObjectTemplate<T>::has(const string & id) 
     
    251263     return CObjectFactory::GetObject<T>(ptr).get() ; 
    252264   } 
    253     
     265 
    254266   template <typename T> 
    255267   shared_ptr<T> CObjectTemplate<T>::getShared(const T* ptr) 
     
    263275     return CObjectFactory::GetObject<T>((T*)this) ; 
    264276   } 
    265     
     277 
    266278   template <typename T> 
    267279   const vector<T*> CObjectTemplate<T>::getAll() 
     
    269281     const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(); 
    270282     vector<T*> vect ; 
    271      
     283 
    272284     typename vector<shared_ptr<T> >::const_iterator it; 
    273285     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 
     
    280292     const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(id); 
    281293     vector<T*> vect ; 
    282      
     294 
    283295     typename vector<shared_ptr<T> >::const_iterator it; 
    284296     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 
     
    303315    return CObjectFactory::GetObject<T>((T*)this).get() ; 
    304316  } 
    305    
     317 
    306318   template <typename T> 
    307319   void CObjectTemplate<T>::generateCInterface(ostream& oss) 
     
    310322     int found=className.find_first_of("_") ; 
    311323     if (found!=string::npos) className.replace(found,1,0,'x') ; 
    312       
     324 
    313325     oss<<"/* ************************************************************************** *"<<iendl ; 
    314326     oss<<" *               Interface auto generated - do not modify                   *"<<iendl ; 
     
    340352     int found=className.find_first_of("_") ; 
    341353     if (found!=string::npos) className.replace(found,1,0,'x') ; 
    342       
     354 
    343355     oss<<"! * ************************************************************************** *"<<iendl ; 
    344356     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl ; 
     
    349361     oss<<iendl ; 
    350362     oss<<"INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99"<<iendl++ ; 
    351      oss<<iendl ;    
     363     oss<<iendl ; 
    352364     oss<<iendl ; 
    353365     SuperClassMap::generateFortran2003Interface(oss,className) ; 
     
    356368     oss<<"END MODULE "<<className<<"_interface_attr"<<iendl ; 
    357369   } 
    358    
     370 
    359371   template <typename T> 
    360372   void CObjectTemplate<T>::generateFortranInterface(ostream& oss) 
     
    366378     found=superClassName.find("_group") ; 
    367379     if (found!=string::npos) superClassName.erase(found,6) ; 
    368       
     380 
    369381     oss<<"! * ************************************************************************** *"<<iendl ; 
    370382     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl ; 
     
    398410     SuperClassMap::generateFortranInterfaceIsDefined_hdl(oss,className) ; 
    399411     oss<<iendl ; 
    400      SuperClassMap::generateFortranInterfaceIsDefined_hdl_(oss,className) ;      
     412     SuperClassMap::generateFortranInterfaceIsDefined_hdl_(oss,className) ; 
    401413     oss<<iendl-- ; 
    402414     oss<<"END MODULE i"<<className<<"_attr"<<iendl ; 
Note: See TracChangeset for help on using the changeset viewer.