Changeset 2203 for XIOS


Ignore:
Timestamp:
08/20/21 14:38:23 (3 years ago)
Author:
ymipsl
Message:

New functionnality : domain, axis and scalar can now be retrieve with new syntax id :
ex. for domain :

id="domainId" : old syntax, working as before
id="fieldId::domainId" : get the domain related to "domainId" associated to the field "fieldId", work if only 1 domain related to domainId is associated to the field.
id="fieldId::domainId[n]" : get the nth domain related to "domainId" associated to the field "fieldId"
id="fieldId::" : get the domain associated the the field "fieldId, work if grid associated to th field is composed with exactly 1 domain (and possibly other components axis or scalars)
id="fieldId::[n] : get the nth domain composing the grid associated to the field

YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src
Files:
13 edited

Legend:

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

    r1984 r2203  
    5050    refObjects.push_back(refer_ptr);                                   \ 
    5151    SuperClassAttribute::setAttributes(refer_ptr, apply);              \ 
     52    setInheritedId(refer_ptr) ;                                        \ 
    5253  }                                                                    \ 
    5354}                                                                      \ 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp

    r2196 r2203  
    1313#include "client_server_mapping_distributed.hpp" 
    1414#include "distribution_client.hpp" 
     15 
     16#include <algorithm> 
     17#include <regex> 
    1518 
    1619namespace xios { 
     
    217220   } 
    218221   CATCH 
     222 
     223   CAxis* CAxis::get(const string& id) 
     224   { 
     225     const regex r("::"); 
     226     smatch m; 
     227     if (regex_search(id, m, r)) 
     228     { 
     229        if (m.size()!=1) ERROR("CAxis* CAxis::get(string& id)", <<" id = "<<id<< "  -> bad format id, separator :: append more than one time"); 
     230        string fieldId=m.prefix() ; 
     231        if (fieldId.empty()) ERROR("CAxis* CAxis::get(string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
     232        string suffix=m.suffix() ; 
     233        CField* field=CField::get(fieldId) ; 
     234        return field->getAssociatedAxis(suffix) ; 
     235     } 
     236     else return CObjectFactory::GetObject<CAxis>(id).get(); 
     237   } 
    219238 
    220239   /*! 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp

    r2022 r2203  
    6969 
    7070         static CAxis* createAxis(); 
     71         static CAxis* get(const string& id) ; //<! return axis pointer using id 
    7172 
    7273         /// Accesseurs /// 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp

    r2196 r2203  
    2626#include "transformation_path.hpp" 
    2727 
    28  
    29  
    30  
    3128#include <algorithm> 
     29#include <regex> 
     30 
    3231 
    3332namespace xios { 
     
    7978   } 
    8079   CATCH 
     80 
     81   CDomain* CDomain::get(const string& id) 
     82   { 
     83     const regex r("::"); 
     84     smatch m; 
     85     if (regex_search(id, m, r)) 
     86     { 
     87        if (m.size()!=1) ERROR("CDomain* CDomain::get(string& id)", <<" id = "<<id<< "  -> bad format id, separator :: append more than one time"); 
     88        string fieldId=m.prefix() ; 
     89        if (fieldId.empty()) ERROR("CDomain* CDomain::get(string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
     90        string suffix=m.suffix() ; 
     91        CField* field=CField::get(fieldId) ; 
     92        return field->getAssociatedDomain(suffix) ; 
     93     } 
     94     else return CObjectFactory::GetObject<CDomain>(id).get(); 
     95   } 
     96 
    8197 
    8298   const std::set<StdString> & CDomain::getRelFiles(void) const 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp

    r2022 r2203  
    7070         CDomain(const CDomain & domain);       // Not implemented yet. 
    7171         CDomain(const CDomain * const domain); // Not implemented yet. 
    72  
     72        
    7373         static CDomain* createDomain(); 
    74           
     74         static CDomain* get(const string& id) ; //<! return domain pointer using id 
     75        // static bool has(const string& id) ;     //<! return true if domain with identifier id exist 
     76 
    7577         CMesh* mesh; 
    7678         void assignMesh(const StdString, const int); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp

    r2193 r2203  
    326326  } 
    327327  CATCH 
     328 
     329  CDomain* CField::getAssociatedDomain(const string& domainId) const 
     330  { 
     331    if (grid_==nullptr) ERROR("CDomain* CField::getAssociatedDomain(const string& domainId)", <<" field with id="<<getId()<<" has no associated grid, " 
     332                              <<"check if the worklfow is enabled for this field"); 
     333    grid_->getAssociatedDomain(domainId) ; 
     334  } 
     335 
     336  CAxis* CField::getAssociatedAxis(const string& axisId) const 
     337  { 
     338    if (grid_==nullptr) ERROR("CAxis* CField::getAssociatedAxis(const string& axisId)", <<" field with id="<<getId()<<" has no associated grid, " 
     339                              <<"check if the worklfow is enabled for this field"); 
     340    grid_->getAssociatedAxis(axisId) ; 
     341  } 
     342 
     343  CScalar* CField::getAssociatedScalar(const string& scalarId) const 
     344  { 
     345    if (grid_==nullptr) ERROR("CScalar* CField::getAssociatedScalar(const string& scalarId)", <<" field with id="<<getId()<<" has no associated grid, " 
     346                              <<"check if the worklfow is enabled for this field"); 
     347    grid_->getAssociatedScalar(scalarId) ; 
     348  } 
     349 
    328350 
    329351  func::CFunctor::ETimeType CField::getOperationTimeType() const 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.hpp

    r2182 r2203  
    4848   class CContext; 
    4949   class CGenericFilter; 
     50   class CDomain ; 
     51   class CAxis ; 
     52   class CScalar ; 
    5053 
    5154   class CGarbageCollector; 
     
    101104         CGrid* getRelGrid(void) const; 
    102105         CFile* getRelFile(void) const; 
     106         CDomain* getAssociatedDomain(const std::string& domainId) const; 
     107         CAxis*   getAssociatedAxis(const std::string& axisId) const; 
     108         CScalar* getAssociatedScalar(const std::string& scalarId) const; 
    103109 
    104110         func::CFunctor::ETimeType getOperationTimeType() const; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r2144 r2203  
    3030#include "algo_types.hpp" 
    3131 
     32#include <regex> 
    3233 
    3334namespace xios 
     
    398399  } 
    399400  CATCH_DUMP_ATTR 
     401 
     402  CDomain* CGrid::getAssociatedDomain(const string& domainId) 
     403  { 
     404    const regex r("\\[[0-9]*\\]"); 
     405    smatch m; 
     406    string id=domainId ; 
     407    int pos=-1 ; 
     408    if (regex_search(domainId, m, r)) 
     409    { 
     410        if (m.size()!=1) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<" domainId = "<<domainId<< "  -> bad format id, separator [] append more than one time"); 
     411        id=m.prefix() ; 
     412        pos = stoi(m.str(0).substr(1,m.str(0).size()-2)) ; 
     413    } 
     414    std::vector<CDomain*> domainList = this->getDomains(); 
     415    if (domainList.empty()) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain is compsing the grid"); 
     416    if (id.empty()) 
     417    { 
     418      if (pos==-1) 
     419      { 
     420        if (domainList.size()==1) return domainList[0] ; 
     421        else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the grid contain more than 1 domain, use [#n] to specify which one must be retrieved"); 
     422      } 
     423      else 
     424      { 
     425        if (domainList.size()>pos) return domainList[pos] ; 
     426        else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the position of the requested domain [ pos = "<<pos 
     427                   <<" ] is greater than the number of domain composing the grid  [ numDomain = "<<domainList.size()<<" ]"); 
     428      } 
     429    } 
     430    else 
     431    { 
     432      if (pos==-1)  
     433      { 
     434        int nbDomain=0 ; 
     435        for(int i=0; i<domainList.size();i++) if (domainList[i]->getTemplateId()==id) nbDomain++ ; 
     436        if (nbDomain>1) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain with the id = "<<id 
     437                              <<" is composing the grid") ; 
     438        if (nbDomain==0) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the grid contain more than 1 domain with the id = " 
     439                               <<id<<" , use [#n] to specify which one must be retrieved") ; 
     440        for(int i=0; i<domainList.size();i++) if (domainList[i]->getTemplateId()==id) return domainList[i]  ; 
     441      } 
     442      else 
     443      { 
     444        int currentPos=0 ; 
     445        for(int i=0; i<domainList.size();i++)  
     446        { 
     447          if (domainList[i]->getTemplateId()==id && pos==currentPos) return domainList[i] ; 
     448          currentPos++ ; 
     449        } 
     450        ERROR("CGrid::getAssociatedDomain(const string& domainId)",<<"Cannot find domain with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 
     451      }   
     452    } 
     453  }  
     454 
     455  CAxis* CGrid::getAssociatedAxis(const string& axisId) 
     456  { 
     457    const regex r("\\[[0-9]*\\]"); 
     458    smatch m; 
     459    string id=axisId ; 
     460    int pos=-1 ; 
     461    if (regex_search(axisId, m, r)) 
     462    { 
     463        if (m.size()!=1) ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<" axisId = "<<axisId<< "  -> bad format id, separator [] append more than one time"); 
     464        id=m.prefix() ; 
     465        pos = stoi(m.str(0).substr(1,m.str(0).size()-2)) ; 
     466    } 
     467    std::vector<CAxis*> axisList = this->getAxis(); 
     468    if (axisList.empty()) ERROR("CGrid::getAssociatedAxis(const string& AxisId)", <<"no axis is composing the grid"); 
     469    if (id.empty()) 
     470    { 
     471      if (pos==-1) 
     472      { 
     473        if (axisList.size()==1) return axisList[0] ; 
     474        else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the grid contain more than 1 axis, use [#n] to specify which one must be retrieved"); 
     475      } 
     476      else 
     477      { 
     478        if (axisList.size()>pos) return axisList[pos] ; 
     479        else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the position of the requested axis [ pos = "<<pos 
     480                   <<" ] is greater than the number of axis composing the grid  [ numAxis = "<<axisList.size()<<" ]"); 
     481      } 
     482    } 
     483    else 
     484    { 
     485      if (pos==-1)  
     486      { 
     487        int nbAxis=0 ; 
     488        for(int i=0; i<axisList.size();i++) if (axisList[i]->getTemplateId()==id) nbAxis++ ; 
     489        if (nbAxis>1) ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"no axis with the id = "<<id 
     490                              <<" is composing the grid") ; 
     491        if (nbAxis==0) ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the grid contain more than 1 axis with the id = " 
     492                               <<id<<" , use [#n] to specify which one must be retrieved") ; 
     493        for(int i=0; i<axisList.size();i++) if (axisList[i]->getTemplateId()==id) return axisList[i]  ; 
     494      } 
     495      else 
     496      { 
     497        int currentPos=0 ; 
     498        for(int i=0; i<axisList.size();i++)  
     499        { 
     500          if (axisList[i]->getTemplateId()==id && pos==currentPos) return axisList[i] ; 
     501          currentPos++ ; 
     502        } 
     503        ERROR("CGrid::getAssociatedAxis(const string& axisId)",<<"Cannot find axis with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 
     504      }   
     505    } 
     506  }  
     507 
     508  CScalar* CGrid::getAssociatedScalar(const string& scalarId) 
     509  { 
     510    const regex r("\\[[0-9]*\\]"); 
     511    smatch m; 
     512    string id=scalarId ; 
     513    int pos=-1 ; 
     514    if (regex_search(scalarId, m, r)) 
     515    { 
     516        if (m.size()!=1) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<" scalarId = "<<scalarId<< "  -> bad format id, separator [] append more than one time"); 
     517        id=m.prefix() ; 
     518        pos = stoi(m.str(0).substr(1,m.str(0).size()-2)) ; 
     519    } 
     520    std::vector<CScalar*> scalarList = this->getScalars(); 
     521    if (scalarList.empty()) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar is composing the grid"); 
     522    if (id.empty()) 
     523    { 
     524      if (pos==-1) 
     525      { 
     526        if (scalarList.size()==1) return scalarList[0] ; 
     527        else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the grid contain more than 1 scalar, use [#n] to specify which one must be retrieved"); 
     528      } 
     529      else 
     530      { 
     531        if (scalarList.size()>pos) return scalarList[pos] ; 
     532        else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the position of the requested scalar [ pos = "<<pos 
     533                   <<" ] is greater than the number of scalar composing the grid  [ numScalar = "<<scalarList.size()<<" ]"); 
     534      } 
     535    } 
     536    else 
     537    { 
     538      if (pos==-1)  
     539      { 
     540        int nbScalar=0 ; 
     541        for(int i=0; i<scalarList.size();i++) if (scalarList[i]->getTemplateId()==id) nbScalar++ ; 
     542        if (nbScalar>1) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar with the id = "<<id 
     543                              <<" is composing the grid") ; 
     544        if (nbScalar==0) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the grid contain more than 1 scalar with the id = " 
     545                               <<id<<" , use [#n] to specify which one must be retrieved") ; 
     546        for(int i=0; i<scalarList.size();i++) if (scalarList[i]->getTemplateId()==id) return scalarList[i]  ; 
     547      } 
     548      else 
     549      { 
     550        int currentPos=0 ; 
     551        for(int i=0; i<scalarList.size();i++)  
     552        { 
     553          if (scalarList[i]->getTemplateId()==id && pos==currentPos) return scalarList[i] ; 
     554          currentPos++ ; 
     555        } 
     556        ERROR("CGrid::getAssociatedScalar(const string& scalarId)",<<"Cannot find scalar with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 
     557      }   
     558    } 
     559  }  
     560 
    400561 
    401562  /*! 
     
    17371898              cout<<"Create new domain : "<<dstDomain->getId()<<" with alias : "<<dstElementId<<endl ; 
    17381899 
    1739               if (isGenerate) dstDomain->duplicateAttributes(lastDstDomain) ; 
    1740               else if (srcElementId=="" && srcElement.type==TYPE_DOMAIN)  dstDomain->duplicateAttributes(srcElement.domain) ; // make a copy 
    1741               else dstDomain->duplicateAttributes(dstElement.domain) ; // make a copy 
     1900              if (isGenerate)  
     1901              { 
     1902                dstDomain->duplicateAttributes(lastDstDomain) ; 
     1903                dstDomain->setTemplateId(lastDstDomain) ; 
     1904              } 
     1905              else if (srcElementId=="" && srcElement.type==TYPE_DOMAIN)   
     1906              { 
     1907                dstDomain->duplicateAttributes(srcElement.domain) ; // make a copy 
     1908                dstDomain->setTemplateId(srcElement.domain) ; 
     1909              } 
     1910              else  
     1911              { 
     1912                dstDomain->duplicateAttributes(dstElement.domain) ; // make a copy 
     1913                dstDomain->setTemplateId(dstElement.domain) ; 
     1914              } 
    17421915              CTransformation<CDomain>* transformation = CTransformation<CDomain>::createTransformation(transType,"") ; 
    17431916              auto srcTransform = CTransformation<CDomain>::getTransformation(transType, transId) ; 
     
    17871960              cout<<"Create new axis : "<<dstAxis->getId()<<" with alias : "<<dstElementId<<endl ; 
    17881961               
    1789               if (isGenerate) dstAxis->duplicateAttributes(lastDstAxis) ; 
    1790               else if (srcElementId=="" && srcElement.type==TYPE_AXIS)  dstAxis->duplicateAttributes(srcElement.axis) ; // make a copy 
    1791               else dstAxis->duplicateAttributes(dstElement.axis) ; // make a copy 
     1962              if (isGenerate)  
     1963              { 
     1964                dstAxis->duplicateAttributes(lastDstAxis) ; 
     1965                dstAxis->setTemplateId(lastDstAxis) ; 
     1966              } 
     1967              else if (srcElementId=="" && srcElement.type==TYPE_AXIS)   
     1968              {  
     1969                dstAxis->duplicateAttributes(srcElement.axis) ; // make a copy 
     1970                dstAxis->setTemplateId(srcElement.axis) ; 
     1971              } 
     1972              else  
     1973              { 
     1974                dstAxis->duplicateAttributes(dstElement.axis) ; // make a copy$ 
     1975                dstAxis->setTemplateId(dstElement.axis) ; 
     1976              } 
    17921977              CTransformation<CAxis>* transformation = CTransformation<CAxis>::createTransformation(transType,"") ; 
    17931978              auto srcTransform = CTransformation<CAxis>::getTransformation(transType, transId) ; 
     
    18362021              cout<<"Create new scalar : "<<dstScalar->getId()<<" with alias : "<<dstElementId<<endl ; 
    18372022               
    1838               if (isGenerate) dstScalar->duplicateAttributes(lastDstScalar) ; 
    1839               else if (srcElementId=="" && srcElement.type==TYPE_SCALAR)  dstScalar->duplicateAttributes(srcElement.scalar) ; // make a copy 
    1840               else dstScalar->duplicateAttributes(dstElement.scalar) ; // make a copy 
     2023              if (isGenerate)  
     2024              { 
     2025                dstScalar->duplicateAttributes(lastDstScalar) ; 
     2026                dstScalar->setTemplateId(lastDstScalar) ; 
     2027              } 
     2028              else if (srcElementId=="" && srcElement.type==TYPE_SCALAR) 
     2029              { 
     2030                dstScalar->duplicateAttributes(srcElement.scalar) ; // make a copy 
     2031                dstScalar->setTemplateId(srcElement.scalar) ; 
     2032              } 
     2033              else  
     2034              { 
     2035                dstScalar->duplicateAttributes(dstElement.scalar) ; // make a copy 
     2036                dstScalar->setTemplateId(dstElement.scalar) ; 
     2037              } 
    18412038              CTransformation<CScalar>* transformation = CTransformation<CScalar>::createTransformation(transType,"") ; 
    18422039              auto srcTransform = CTransformation<CScalar>::getTransformation(transType, transId) ; 
     
    19932190          CDomain* domain = CDomain::create(); 
    19942191          domain->duplicateAttributes(element.domain) ; 
     2192          domain->setTemplateId(element.domain) ; 
    19952193          domain->name = element.domain->getId() ; 
    19962194          newGrid->addDomain(domain->getId()) ; 
     
    20002198          CAxis* axis = CAxis::create(); 
    20012199          axis->duplicateAttributes(element.axis) ; 
     2200          axis->setTemplateId(element.axis) ; 
    20022201          axis->name = element.axis->getId() ; 
    20032202          newGrid->addAxis(axis->getId()) ; 
     
    20072206          CScalar* scalar = CScalar::create(); 
    20082207          scalar->duplicateAttributes(element.scalar) ; 
     2208          scalar->setTemplateId(element.scalar) ; 
    20092209          scalar->name = element.scalar->getId() ; 
    20102210          newGrid->addScalar(scalar->getId()) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp

    r2144 r2203  
    147147         static CGrid* cloneGrid(const StdString& idNewGrid, CGrid* gridSrc); 
    148148 
     149         CDomain* getAssociatedDomain(const string& domainId) ; 
     150         CAxis*   getAssociatedAxis(const string& axisId) ; 
     151         CScalar* getAssociatedScalar(const string& scalarId) ; 
    149152      public:             
    150153         void solveDomainAxisRef(bool areAttributesChecked); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp

    r2196 r2203  
    99#include "context.hpp" 
    1010 
     11#include <algorithm> 
     12#include <regex> 
     13 
    1114namespace xios  
    1215{ 
     
    4851    CScalar* scalar = CScalarGroup::get("scalar_definition")->createChild(); 
    4952    return scalar; 
     53  } 
     54 
     55  CScalar* CScalar::get(const string& id) 
     56  { 
     57    const regex r("::"); 
     58    smatch m; 
     59    if (regex_search(id, m, r)) 
     60    { 
     61      if (m.size()!=1) ERROR("CScalar* CScalar::get(string& id)", <<" id = "<<id<< "  -> bad format id, separator :: append more than one time"); 
     62      string fieldId=m.prefix() ; 
     63      if (fieldId.empty()) ERROR("CScalar* CScalar::get(string& id)", <<" id = "<<id<< "  -> bad format id, field name is empty"); 
     64      string suffix=m.suffix() ; 
     65      CField* field=CField::get(fieldId) ; 
     66      return field->getAssociatedScalar(suffix) ; 
     67    } 
     68    else return CObjectFactory::GetObject<CScalar>(id).get(); 
    5069  } 
    5170 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp

    r2022 r2203  
    7878    public: 
    7979      static CScalar* createScalar(); 
     80      static CScalar* get(const string& id) ; //<! return scalar pointer using id 
    8081 
    8182    public: 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp

    r1984 r2203  
    8585         static T* createAlias(const string& id, const string& alias) ; 
    8686         void createAlias(const string& alias) ; 
    87           
     87 
    8888         static const vector<T*> getAll() ; 
    8989         static const vector<T*> getAll(const string& contextId) ; 
     
    9292         void generateFortran2003Interface(ostream& oss) ; 
    9393         void generateFortranInterface(ostream& oss) ; 
     94       
     95      // manage inherited id which is herited by reference 
     96        void setInheritedId(T* obj) ; 
     97        bool hasInheritedId(void) { return hasInheritedId_ ;} 
     98        string getInheritedId(void) { return  inheritedId_ ;} 
    9499 
     100      private:   
     101         std::string inheritedId_ ; 
     102         bool hasInheritedId_ = false; 
     103 
     104      // manage the template id 
     105      public: 
     106         void setTemplateId(T* obj) ; //<! set the id of the object that served as template  
     107         bool hasTemplateId(void) {return hasTemplateId_;} //<! return  hasTemplateId_ 
     108         string getTemplateId(void) 
     109         { 
     110           if (hasTemplateId_) return templateId_  ; 
     111           else if (hasId() && !hasAutoGeneratedId()) return getId() ; 
     112           else if (hasInheritedId()) return getInheritedId() ; 
     113           else return getId() ; 
     114         } 
     115      private: 
     116         std::string templateId_ ;    //<! the id of the object that served as template  
     117         bool hasTemplateId_ = false; //<! true if templateId is set 
     118       
    95119      protected : 
    96120 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template_impl.hpp

    r1875 r2203  
    157157   } 
    158158 
     159   // --------------------------------------------------------------- 
     160   template <class T> 
     161   void CObjectTemplate<T>::setInheritedId(T* obj) 
     162   { 
     163     if (!hasInheritedId_) 
     164     { 
     165       if (!(hasId() && !hasAutoGeneratedId()))  
     166        if (obj->hasId() && !obj->hasAutoGeneratedId())  
     167        { 
     168          hasInheritedId_=true ; 
     169          inheritedId_=obj->getId() ; 
     170        }  
     171     } 
     172   } 
     173 
     174   template <class T> 
     175   void CObjectTemplate<T>::setTemplateId(T* obj) 
     176   { 
     177     if (hasId() && !hasAutoGeneratedId()) 
     178     { 
     179        templateId_ = getId() ; 
     180        hasTemplateId_ = true ; 
     181     } 
     182     else if (obj->hasId() && !obj->hasAutoGeneratedId()) 
     183     { 
     184       templateId_ = obj->getId() ; 
     185       hasTemplateId_ = true ; 
     186     } 
     187     else if (obj->hasTemplateId()) 
     188     { 
     189       templateId_= obj->getTemplateId() ; 
     190       hasTemplateId_=true ; 
     191     } 
     192   } 
     193    
     194    
    159195   //--------------------------------------------------------------- 
    160196 
Note: See TracChangeset for help on using the changeset viewer.