Ignore:
Timestamp:
04/15/20 13:23:39 (4 years ago)
Author:
ymipsl
Message:

Some update...

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_factory_impl.hpp

    r1542 r1869  
    113113 
    114114   template <typename U> 
     115   std::shared_ptr<U> CObjectFactory::CreateAlias(const StdString& id, const StdString& alias) 
     116   { 
     117      if (CurrContext.empty()) 
     118         ERROR("CObjectFactory::CreateAlias(const StdString& id, const StdString& alias)", 
     119               << "[ id = " << id << " alias = "<<alias<<" ] please define current context id !"); 
     120 
     121      if (CObjectFactory::HasObject<U>(alias)) 
     122      { 
     123         return CObjectFactory::GetObject<U>(alias); 
     124      } 
     125      else 
     126      { 
     127        if (! CObjectFactory::HasObject<U>(id)) 
     128        { 
     129            ERROR("CObjectFactory::CreateAlias(const StdString& id, const StdString& alias)", 
     130               << "[ id = " << id << " alias = "<<alias<<" ] object id doesn't exist");  
     131        } 
     132        else   
     133        { 
     134          std::shared_ptr<U> value = CObjectFactory::GetObject<U>(id);   
     135          U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(alias, value)); 
     136          return value; 
     137         } 
     138      } 
     139   } 
     140 
     141   template <typename U> 
    115142      const std::vector<std::shared_ptr<U> > & 
    116143         CObjectFactory::GetObjectVector(const StdString & context) 
Note: See TracChangeset for help on using the changeset viewer.