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

    r346 r347  
    4949      os.write (reinterpret_cast<const char*>(&chdnb) , sizeof(StdSize));       
    5050       
    51       typename std::vector<boost::shared_ptr<V> >::const_iterator  
     51      typename std::vector<V*>::const_iterator  
    5252         itg = this->groupList.begin(), endg = this->groupList.end(); 
    53       typename std::vector<boost::shared_ptr<U> >::const_iterator  
     53      typename std::vector<U*>::const_iterator  
    5454         itc = this->childList.begin(), endc = this->childList.end(); 
    5555             
    5656      for (; itg != endg; itg++) 
    5757      {  
    58          boost::shared_ptr<V> group = *itg; 
     58         V* group = *itg; 
    5959         bool hid = group->hasId(); 
    6060          
     
    7575      for (; itc != endc; itc++) 
    7676      {  
    77          boost::shared_ptr<U> child = *itc; 
     77         U* child = *itc; 
    7878         bool hid = child->hasId(); 
    7979          
     
    9999      SuperClass::fromBinary(is); 
    100100       
    101       boost::shared_ptr<V> group_ptr = (this->hasId()) 
    102          ? CObjectFactory::GetObject<V>(this->getId()) 
    103          : CObjectFactory::GetObject(boost::polymorphic_downcast<V*>(this)); 
     101      V* group_ptr = (this->hasId()) 
     102         ? V::get(this->getId()) 
     103         : V::get((V*)this); 
    104104       
    105105      StdSize grpnb = 0; 
     
    126126            StdString id(size, ' '); 
    127127            is.read (const_cast<char *>(id.data()), size * sizeof(char)); 
    128             CGroupFactory::CreateGroup(group_ptr, id)->fromBinary(is); 
     128            CGroupFactory::CreateGroup(group_ptr->getShared(), id)->fromBinary(is); 
    129129         } 
    130130         else 
    131131         { 
    132             CGroupFactory::CreateGroup(group_ptr)->fromBinary(is); 
     132            CGroupFactory::CreateGroup(group_ptr->getShared())->fromBinary(is); 
    133133         } 
    134134      } 
     
    150150            StdString id(size, ' '); 
    151151            is.read (const_cast<char *>(id.data()), size * sizeof(char)); 
    152             CGroupFactory::CreateChild(group_ptr, id)->fromBinary(is);             
     152            CGroupFactory::CreateChild(group_ptr->getShared(), id)->fromBinary(is);             
    153153         } 
    154154         else 
    155155         { 
    156             CGroupFactory::CreateChild(group_ptr)->fromBinary(is); 
     156            CGroupFactory::CreateChild(group_ptr->getShared())->fromBinary(is); 
    157157         }    
    158158      } 
     
    176176         oss << SuperClassAttribute::toString() << ">" << std::endl; 
    177177          
    178          typename std::vector<boost::shared_ptr<V> >::const_iterator  
     178         typename std::vector<V*>::const_iterator  
    179179            itg = this->groupList.begin(), endg = this->groupList.end(); 
    180          typename std::vector<boost::shared_ptr<U> >::const_iterator  
     180         typename std::vector<U*>::const_iterator  
    181181            itc = this->childList.begin(), endc = this->childList.end(); 
    182182             
    183183         for (; itg != endg; itg++) 
    184184         {  
    185             boost::shared_ptr<V> group = *itg; 
     185            V* group = *itg; 
    186186            oss << *group << std::endl; 
    187187         } 
     
    189189         for (; itc != endc; itc++) 
    190190         {  
    191             boost::shared_ptr<U> child = *itc; 
     191            U* child = *itc; 
    192192            oss << *child << std::endl; 
    193193         } 
     
    226226 
    227227   template <class U, class V, class W> 
    228       const std::vector<boost::shared_ptr<U> >& 
     228      const std::vector<U*>& 
    229229         CGroupTemplate<U, V, W>::getChildList(void) const 
    230230   {  
     
    235235 
    236236   template <class U, class V, class W> 
    237       const xios_map<StdString, boost::shared_ptr<V> >& 
     237      const xios_map<StdString, V*>& 
    238238         CGroupTemplate<U, V, W>::getGroupMap(void) const 
    239239   {  
     
    265265         SuperClassAttribute::setAttributes(parent); 
    266266          
    267       typename std::vector<boost::shared_ptr<U> >::const_iterator  
     267      typename std::vector<U*>::const_iterator  
    268268         itc = this->childList.begin(), endc = this->childList.end(); 
    269       typename std::vector<boost::shared_ptr<V> >::const_iterator  
     269      typename std::vector<V*>::const_iterator  
    270270         itg = this->groupList.begin(), endg = this->groupList.end(); 
    271271              
    272272      for (; itc != endc; itc++) 
    273273      {  
    274          boost::shared_ptr<U> child = *itc; 
     274         U* child = *itc; 
    275275         child->solveDescInheritance(this); 
    276276      } 
     
    278278      for (; itg != endg; itg++) 
    279279      {  
    280          boost::shared_ptr<V> group = *itg; 
     280         V* group = *itg; 
    281281         group->solveRefInheritance(); 
    282282         group->solveDescInheritance(this); 
     
    287287 
    288288   template <class U, class V, class W> 
    289       void CGroupTemplate<U, V, W>::getAllChildren(std::vector<boost::shared_ptr<U> > & allc) const 
     289      void CGroupTemplate<U, V, W>::getAllChildren(std::vector<U*>& allc) const 
    290290   { 
    291291      allc.insert (allc.end(), childList.begin(), childList.end()); 
    292       typename std::vector<boost::shared_ptr<V> >::const_iterator  
     292      typename std::vector<V*>::const_iterator  
    293293         itg = this->groupList.begin(), endg = this->groupList.end(); 
    294294          
    295295      for (; itg != endg; itg++) 
    296296      {  
    297          boost::shared_ptr<V> group = *itg; 
     297         V* group = *itg; 
    298298         group->getAllChildren(allc); 
    299299      } 
     
    303303 
    304304   template <class U, class V, class W> 
    305       std::vector<boost::shared_ptr<U> > CGroupTemplate<U, V, W>::getAllChildren(void) const 
    306    {  
    307       std::vector<boost::shared_ptr<U> > allc; 
     305      std::vector<U*> CGroupTemplate<U, V, W>::getAllChildren(void) const 
     306   {  
     307      std::vector<U*> allc; 
    308308      this->getAllChildren(allc); 
    309309      return (allc); 
     
    343343   
    344344   template <class U, class V, class W> 
    345    boost::shared_ptr<U> CGroupTemplate<U, V, W>::createChild(const string& id)  
     345   U* CGroupTemplate<U, V, W>::createChild(const string& id)  
    346346  { 
    347     return CGroupFactory::CreateChild<V>(this->get(), id) ; 
     347    return CGroupFactory::CreateChild<V>(this->getShared(), id).get() ; 
    348348  } 
    349349 
    350350   template <class U, class V, class W> 
    351    void CGroupTemplate<U, V, W>::addChild(shared_ptr<U> child)  
     351   void CGroupTemplate<U, V, W>::addChild(U* child)  
    352352  { 
    353     return CGroupFactory::AddChild<V>(this->get(),child) ; 
     353    return CGroupFactory::AddChild<V>(this->getShared,child->getShared()) ; 
    354354  } 
    355355   
    356356   template <class U, class V, class W> 
    357    boost::shared_ptr<V> CGroupTemplate<U, V, W>::createChildGroup(const string& id)  
     357   V* CGroupTemplate<U, V, W>::createChildGroup(const string& id)  
    358358  { 
    359     return CGroupFactory::CreateGroup<V>(this->get(), id) ; 
     359    return CGroupFactory::CreateGroup<V>(this->getShared(), id).get() ; 
    360360  } 
    361361 
    362362   template <class U, class V, class W> 
    363    void CGroupTemplate<U, V, W>::addChildGroup(shared_ptr<V> childGroup)  
     363   void CGroupTemplate<U, V, W>::addChildGroup(V* childGroup)  
    364364  { 
    365     return CGroupFactory::AddGroup<V>(this->get(), childGroup) ; 
     365    return CGroupFactory::AddGroup<V>(this->getShared(), childGroup->getShared()) ; 
    366366  } 
    367367 
     
    370370   void CGroupTemplate<U, V, W>::sendCreateChild(const string& id) 
    371371   { 
    372     shared_ptr<CContext> context=CContext::getCurrent() ; 
     372    CContext* context=CContext::getCurrent() ; 
    373373     
    374374    if (! context->hasServer ) 
     
    393393   void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id) 
    394394   { 
    395     shared_ptr<CContext> context=CContext::getCurrent() ; 
     395    CContext* context=CContext::getCurrent() ; 
    396396    if (! context->hasServer ) 
    397397    { 
Note: See TracChangeset for help on using the changeset viewer.