Ignore:
Timestamp:
05/21/12 17:57:22 (12 years ago)
Author:
ymipsl
Message:
  • Supress lot of shared_ptr
  • instrument code for vampir-trace and timer diagnostic

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/object_template_impl.hpp

    r346 r347  
    145145      void CObjectTemplate<T>::ClearAllAttributes(void) 
    146146   { 
    147       std::vector<boost::shared_ptr<T> > & avect = 
    148          CObjectTemplate<T>::GetAllVectobject(CContext::getCurrent()->getId()); 
    149       typename std::vector<boost::shared_ptr<T> >::iterator 
     147      vector<T*> avect = CObjectTemplate<T>::getAll() ; 
     148      typename vector<T*>::iterator 
    150149            it = avect.begin(), end = avect.end(); 
    151150 
     
    165164   } 
    166165 
    167    template <class T> 
    168    void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 
    169    { 
    170      shared_ptr<CContext> context=CContext::getCurrent() ; 
    171       
     166  template <class T> 
     167  void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 
     168  { 
     169    CContext* context=CContext::getCurrent() ; 
     170     
    172171    if (!context->hasServer) 
    173172    { 
     
    187186    } 
    188187       
    189    } 
    190     
    191    template <class T> 
    192    void CObjectTemplate<T>::recvAttributFromClient(CEventServer& event) 
    193    { 
     188  } 
     189    
     190  template <class T> 
     191  void CObjectTemplate<T>::recvAttributFromClient(CEventServer& event) 
     192  { 
    194193       
    195       CBufferIn* buffer=event.subEvents.begin()->buffer; 
    196       string id,attrId; 
    197       *buffer>>id ; 
    198       CAttributeMap & attrMap = *get(id); 
    199       *buffer>>attrId ; 
    200       CAttribute* attr=attrMap[attrId] ; 
    201       info(50)<<"attribut recu "<<attrId<<"  " ; 
    202       if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 
    203       else info(50) /*<attr->getValue()*/<<endl ; 
    204       *buffer>>*attr ; 
    205        info(50)<<"attribut recu "<<attrId<<"  " ; 
    206       if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 
    207       else info(50) /*attr->getValue()*/<<endl ; 
     194    CBufferIn* buffer=event.subEvents.begin()->buffer; 
     195    string id,attrId; 
     196    *buffer>>id ; 
     197    CAttributeMap & attrMap = *get(id); 
     198    *buffer>>attrId ; 
     199    CAttribute* attr=attrMap[attrId] ; 
     200    info(50)<<"attribut recu "<<attrId<<"  " ; 
     201    if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 
     202    else info(50) /*<attr->getValue()*/<<endl ; 
     203    *buffer>>*attr ; 
     204     info(50)<<"attribut recu "<<attrId<<"  " ; 
     205    if (attr->isEmpty()) info(50)<<"--> empty"<<endl ; 
     206    else info(50) /*attr->getValue()*/<<endl ; 
    208207  } 
    209208 
     
    238237 
    239238   template <typename T> 
    240    boost::shared_ptr<T> CObjectTemplate<T>::get(const string & id) 
    241    { 
    242      return CObjectFactory::GetObject<T>(id) ; 
    243    } 
    244  
    245    template <typename T> 
    246    boost::shared_ptr<T> CObjectTemplate<T>::get(const T* ptr) 
     239   T* CObjectTemplate<T>::get(const string & id) 
     240   { 
     241     return CObjectFactory::GetObject<T>(id).get() ; 
     242   } 
     243 
     244   template <typename T> 
     245   T* CObjectTemplate<T>::get(const T* ptr) 
     246   { 
     247     return CObjectFactory::GetObject<T>(ptr).get() ; 
     248   } 
     249    
     250   template <typename T> 
     251   shared_ptr<T> CObjectTemplate<T>::getShared(const T* ptr) 
    247252   { 
    248253     return CObjectFactory::GetObject<T>(ptr) ; 
    249254   } 
    250     
    251     
    252    template <typename T> 
    253    const vector<boost::shared_ptr<T> >& CObjectTemplate<T>::getAll() 
    254    { 
    255      return CObjectFactory::GetObjectVector<T>() ; 
    256    } 
    257  
    258    template <typename T> 
    259    const vector<boost::shared_ptr<T> >& CObjectTemplate<T>::getAll(const string & id) 
    260    { 
    261      return CObjectFactory::GetObjectVector<T>(id) ; 
    262    } 
    263  
    264    template <typename T> 
    265    boost::shared_ptr<T> CObjectTemplate<T>::get(const string& contextId, const string & id) 
    266    { 
    267      return CObjectFactory::GetObject<T>(contextId,id) ; 
    268    } 
    269  
    270    template <typename T> 
    271    boost::shared_ptr<T> CObjectTemplate<T>::create(const string & id) 
    272    { 
    273      return CObjectFactory::CreateObject<T>(id) ; 
     255 
     256   template <typename T> 
     257   shared_ptr<T> CObjectTemplate<T>::getShared(void) 
     258   { 
     259     return CObjectFactory::GetObject<T>((T*)this) ; 
     260   } 
     261    
     262   template <typename T> 
     263   const vector<T*> CObjectTemplate<T>::getAll() 
     264   { 
     265     const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(); 
     266     vector<T*> vect ; 
     267     
     268     typename vector<shared_ptr<T> >::const_iterator it; 
     269     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 
     270     return vect ; 
     271   } 
     272 
     273   template <typename T> 
     274   const vector<T*> CObjectTemplate<T>::getAll(const string & id) 
     275   { 
     276     const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(id); 
     277     vector<T*> vect ; 
     278     
     279     typename vector<shared_ptr<T> >::const_iterator it; 
     280     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 
     281     return vect ; 
     282   } 
     283 
     284   template <typename T> 
     285   T* CObjectTemplate<T>::get(const string& contextId, const string & id) 
     286   { 
     287     return CObjectFactory::GetObject<T>(contextId,id).get() ; 
     288   } 
     289 
     290   template <typename T> 
     291   T* CObjectTemplate<T>::create(const string & id) 
     292   { 
     293     return CObjectFactory::CreateObject<T>(id).get() ; 
    274294   }   ///-------------------------------------------------------------- 
    275295 
    276296  template <typename T> 
    277   boost::shared_ptr<T> CObjectTemplate<T>::get(void) 
     297  T* CObjectTemplate<T>::get(void) 
    278298  { 
    279     return CObjectFactory::GetObject<T>((T*)this) ; 
    280 //      return shared_ptr<T>((T*)this) ; 
     299    return CObjectFactory::GetObject<T>((T*)this).get() ; 
    281300  } 
    282301   
     
    299318     oss<<"#include \"group_template_impl.hpp\""<<iendl ; 
    300319     oss<<"#include \"icutil.hpp\""<<iendl ; 
     320     oss<<"#include \"timer.hpp\""<<iendl ; 
    301321     oss<<iendl ; 
    302322     oss<<"extern \"C\""<<iendl ; 
Note: See TracChangeset for help on using the changeset viewer.