Ignore:
Timestamp:
06/18/18 20:32:55 (6 years ago)
Author:
yushan
Message:

branch_openmp merged with trunk r1544

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/object_factory_impl.hpp

    r1460 r1545  
    1313         ERROR("CObjectFactory::GetObjectNum(void)", 
    1414               << "please define current context id !"); 
    15       //return (U::AllVectObj[CObjectFactory::CurrContext].size()); 
    1615      if(U::AllVectObj_ptr == NULL) return 0; 
    1716      return (*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr].size(); 
     
    2423         ERROR("CObjectFactory::GetObjectIdNum(void)", 
    2524               << "please define current context id !"); 
    26       //return (U::AllMapObj[CObjectFactory::CurrContext].size()); 
    2725      if(U::AllMapObj_ptr == NULL) return 0; 
    2826      return (*U::AllMapObj_ptr)[*CObjectFactory::CurrContext_ptr].size(); 
     
    3533         ERROR("CObjectFactory::HasObject(const StdString & id)", 
    3634               << "[ id = " << id << " ] please define current context id !"); 
    37       //return (U::AllMapObj[CObjectFactory::CurrContext].find(id) != 
    38       //        U::AllMapObj[CObjectFactory::CurrContext].end()); 
    3935      if(U::AllMapObj_ptr  == NULL)  return false; 
    4036      return ((*U::AllMapObj_ptr)[*CObjectFactory::CurrContext_ptr].find(id) != 
     
    4642      bool CObjectFactory::HasObject(const StdString & context, const StdString & id) 
    4743   { 
    48  
    49       // if (U::AllMapObj.find(context) == U::AllMapObj.end()) return false ; 
    50       // else return (U::AllMapObj[context].find(id) !=  U::AllMapObj[context].end()); 
    5144      if(U::AllMapObj_ptr  == NULL) return false; 
    5245 
     
    5649 
    5750   template <typename U> 
    58       boost::shared_ptr<U> CObjectFactory::GetObject(const U * const object) 
     51      std::shared_ptr<U> CObjectFactory::GetObject(const U * const object) 
    5952   { 
    60       if(U::AllVectObj_ptr == NULL) return (boost::shared_ptr<U>()); 
     53      if(U::AllVectObj_ptr == NULL) return (std::shared_ptr<U>()); 
    6154      if (CurrContext_ptr->size() == 0) 
    6255         ERROR("CObjectFactory::GetObject(const U * const object)", 
    6356               << "please define current context id !"); 
    64       //std::vector<boost::shared_ptr<U> > & vect = U::AllVectObj[CObjectFactory::CurrContext]; 
    65       std::vector<boost::shared_ptr<U> > & vect = (*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr]; 
     57      std::vector<std::shared_ptr<U> > & vect = (*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr]; 
    6658 
    67       typename std::vector<boost::shared_ptr<U> >::const_iterator 
     59      typename std::vector<std::shared_ptr<U> >::const_iterator 
    6860         it = vect.begin(), end = vect.end(); 
    6961 
    7062      for (; it != end; it++) 
    7163      { 
    72          boost::shared_ptr<U> ptr = *it; 
     64         std::shared_ptr<U> ptr = *it; 
    7365         if (ptr.get() == object) 
    7466            return (ptr); 
     
    7870               << "[type = " << U::GetName() << ", adress = " << object << "] " 
    7971               << "object was not found."); 
    80       return (boost::shared_ptr<U>()); // jamais atteint 
     72      return (std::shared_ptr<U>()); // jamais atteint 
    8173   } 
    8274 
    8375   template <typename U> 
    84       boost::shared_ptr<U> CObjectFactory::GetObject(const StdString & id) 
     76      std::shared_ptr<U> CObjectFactory::GetObject(const StdString & id) 
    8577   { 
    86       if(U::AllMapObj_ptr  == NULL) return (boost::shared_ptr<U>()); 
     78      if(U::AllMapObj_ptr  == NULL) return (std::shared_ptr<U>()); 
    8779      if (CurrContext_ptr->size() == 0) 
    8880         ERROR("CObjectFactory::GetObject(const StdString & id)", 
     
    9284               << "[ id = " << id << ", U = " << U::GetName() << " ] " 
    9385               << "object was not found."); 
    94  
    95       //cout<<"CObjectFactory::GetObject(const StdString & id)[ id = " << id << ", U = " << U::GetName() << " ] "<<endl; 
    96       if(id == "src_domain_regular_read") 
    97       { 
    98          //cout<<"match"<<endl; 
    99       } 
    100  
    101       //return (U::AllMapObj[CObjectFactory::CurrContext][id]); 
    10286      return (*U::AllMapObj_ptr)[*CObjectFactory::CurrContext_ptr][id]; 
    10387   } 
    10488 
    10589   template <typename U> 
    106       boost::shared_ptr<U> CObjectFactory::GetObject(const StdString & context, const StdString & id) 
     90      std::shared_ptr<U> CObjectFactory::GetObject(const StdString & context, const StdString & id) 
    10791   { 
    108       if(U::AllMapObj_ptr  == NULL) return (boost::shared_ptr<U>()); 
     92      if(U::AllMapObj_ptr  == NULL) return (std::shared_ptr<U>()); 
    10993 
    11094      if (!CObjectFactory::HasObject<U>(context,id)) 
     
    11296               << "[ id = " << id << ", U = " << U::GetName() <<", context = "<<context<< " ] " 
    11397               << "object was not found."); 
    114  
    115       //cout<<"CObjectFactory::GetObject(const StdString & context, const StdString & id)[ id = " << id << ", U = " << U::GetName() << " ] "<<endl; 
    116       if(id == "src_domain_regular_read") 
    117       { 
    118          //cout<<"match"<<endl; 
    119          boost::shared_ptr<U> value; 
    120       } 
    121       //return (U::AllMapObj[context][id]); 
    12298      return (*U::AllMapObj_ptr)[context][id]; 
    12399   } 
    124100 
    125101   template <typename U> 
    126    boost::shared_ptr<U> CObjectFactory::CreateObject(const StdString& id) 
     102   std::shared_ptr<U> CObjectFactory::CreateObject(const StdString& id) 
    127103   { 
    128       if(U::AllVectObj_ptr == NULL) U::AllVectObj_ptr = new xios_map<StdString, std::vector<boost::shared_ptr<U> > >; 
    129       if(U::AllMapObj_ptr  == NULL) U::AllMapObj_ptr  = new xios_map<StdString, xios_map<StdString, boost::shared_ptr<U> > >; 
     104      if(U::AllVectObj_ptr == NULL) U::AllVectObj_ptr = new xios_map<StdString, std::vector<std::shared_ptr<U> > >; 
     105      if(U::AllMapObj_ptr  == NULL) U::AllMapObj_ptr  = new xios_map<StdString, xios_map<StdString, std::shared_ptr<U> > >; 
    130106 
    131107      if (CurrContext_ptr->empty()) 
     
    139115      else 
    140116      { 
    141          boost::shared_ptr<U> value(new U(id.empty() ? CObjectFactory::GenUId<U>() : id)); 
    142  
    143          //U::AllVectObj[CObjectFactory::CurrContext].insert(U::AllVectObj[CObjectFactory::CurrContext].end(), value); 
    144          //U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value)); 
     117         std::shared_ptr<U> value(new U(id.empty() ? CObjectFactory::GenUId<U>() : id)); 
    145118 
    146119         (*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr].insert((*U::AllVectObj_ptr)[*CObjectFactory::CurrContext_ptr].end(), value); 
    147120         (*U::AllMapObj_ptr) [*CObjectFactory::CurrContext_ptr].insert(std::make_pair(value->getId(), value)); 
    148          //cout<<"CObjectFactory::CreateObject(const StdString& id) [ id = " << id << " ]" <<endl; 
    149121 
    150122         return value; 
     
    153125 
    154126   template <typename U> 
    155       const std::vector<boost::shared_ptr<U> > & 
     127      const std::vector<std::shared_ptr<U> > & 
    156128         CObjectFactory::GetObjectVector(const StdString & context) 
    157129   { 
    158       //return (U::AllVectObj[context]); 
    159130      return (*U::AllVectObj_ptr)[context]; 
    160131   } 
Note: See TracChangeset for help on using the changeset viewer.