Ignore:
Timestamp:
06/13/18 16:48:53 (6 years ago)
Author:
oabramkina
Message:

Replacing Boost's unordered_map and shared_pointer by its STL counterparts.

Two notes for Curie:

  • one can see the content of unordered_map with ddt only if XIOS has been compiled with gnu
  • XIOS will not compile any more with pgi (all available versions use old STL which are not up to the c++11 norms)
File:
1 edited

Legend:

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

    r591 r1542  
    99 
    1010   template <typename U> 
    11       void CGroupFactory::AddGroup(boost::shared_ptr<U> pgroup, 
    12                                    boost::shared_ptr<U> cgroup) 
     11      void CGroupFactory::AddGroup(std::shared_ptr<U> pgroup, 
     12                                   std::shared_ptr<U> cgroup) 
    1313   { 
    1414      if (cgroup.get() == NULL || pgroup.get() == NULL ) 
    15          ERROR("CGroupFactory::AddGroup(boost::shared_ptr<U> pgroup, boost::shared_ptr<U> cgroup)", 
     15         ERROR("CGroupFactory::AddGroup(std::shared_ptr<U> pgroup, std::shared_ptr<U> cgroup)", 
    1616               << " pgroup or cgroup NULL !"); 
    1717      if (!cgroup->hasId()) 
     
    2525 
    2626   template <typename U> 
    27       void CGroupFactory::AddChild(boost::shared_ptr<U> group, 
    28                                    boost::shared_ptr<typename U::RelChild> child) 
     27      void CGroupFactory::AddChild(std::shared_ptr<U> group, 
     28                                   std::shared_ptr<typename U::RelChild> child) 
    2929   { 
    3030      if (group.get() == NULL || child.get() == NULL ) 
    31          ERROR("CGroupFactory::AddGroup(boost::shared_ptr<U> pgroup, boost::shared_ptr<U> cgroup)", 
     31         ERROR("CGroupFactory::AddGroup(std::shared_ptr<U> pgroup, std::shared_ptr<U> cgroup)", 
    3232               << " pgroup or cgroup NULL !"); 
    3333      if (!child->hasId()) 
     
    4141 
    4242   template <typename U> 
    43       boost::shared_ptr<U> 
    44          CGroupFactory::CreateGroup(boost::shared_ptr<U> group, const StdString & id) 
     43      std::shared_ptr<U> 
     44         CGroupFactory::CreateGroup(std::shared_ptr<U> group, const StdString & id) 
    4545   { 
    4646      CObjectFactory::SetCurrentContextId 
     
    4848      if (id.size() == 0) 
    4949      { 
    50          boost::shared_ptr<U> value = CObjectFactory::CreateObject<U>(CObjectFactory::GenUId<U>()); 
     50         std::shared_ptr<U> value = CObjectFactory::CreateObject<U>(CObjectFactory::GenUId<U>()); 
    5151         group->groupList.insert(group->groupList.end(), value.get()); 
    5252         group->groupMap.insert(std::make_pair(value->getId(), value.get())); 
     
    5757      else 
    5858      { 
    59          boost::shared_ptr<U> value = CObjectFactory::CreateObject<U>(id); 
     59         std::shared_ptr<U> value = CObjectFactory::CreateObject<U>(id); 
    6060         group->groupList.insert(group->groupList.end(), value.get()); 
    6161         group->groupMap.insert(std::make_pair(id, value.get())); 
     
    6565 
    6666   template <typename U> 
    67       boost::shared_ptr<typename U::RelChild> 
    68          CGroupFactory::CreateChild(boost::shared_ptr<U> group, const StdString & id) 
     67      std::shared_ptr<typename U::RelChild> 
     68         CGroupFactory::CreateChild(std::shared_ptr<U> group, const StdString & id) 
    6969   { 
    7070      CObjectFactory::SetCurrentContextId 
     
    7272      if (id.size() == 0) 
    7373      { 
    74          boost::shared_ptr<typename U::RelChild> value = 
     74         std::shared_ptr<typename U::RelChild> value = 
    7575               CObjectFactory::CreateObject<typename U::RelChild>(); 
    7676         group->childList.insert(group->childList.end(), value.get()); 
     
    8282      else 
    8383      { 
    84          boost::shared_ptr<typename U::RelChild> value = 
     84         std::shared_ptr<typename U::RelChild> value = 
    8585               CObjectFactory::CreateObject<typename U::RelChild>(id); 
    8686         group->childList.insert(group->childList.end(), value.get()); 
     
    9191 
    9292   template <typename U> 
    93       bool CGroupFactory::HasGroup(boost::shared_ptr<U> group, const StdString & id) 
     93      bool CGroupFactory::HasGroup(std::shared_ptr<U> group, const StdString & id) 
    9494   {  return (group->groupMap.find(id) != group->groupMap.end()); } 
    9595 
    9696   template <typename U> 
    97       bool CGroupFactory::HasChild(boost::shared_ptr<U> group, const StdString & id) 
     97      bool CGroupFactory::HasChild(std::shared_ptr<U> group, const StdString & id) 
    9898   {  return (group->childMap.find(id) != group->childMap.end()); } 
    9999 
    100100   template <typename U> 
    101       int CGroupFactory::GetGroupNum(boost::shared_ptr<U> group) 
     101      int CGroupFactory::GetGroupNum(std::shared_ptr<U> group) 
    102102   { return (group->groupList.size()); } 
    103103 
    104104   template <typename U> 
    105       int CGroupFactory::GetGroupIdNum(boost::shared_ptr<U> group) 
     105      int CGroupFactory::GetGroupIdNum(std::shared_ptr<U> group) 
    106106   { return (group->groupMap.size()); } 
    107107 
    108108   template <typename U> 
    109       int CGroupFactory::GetChildNum(boost::shared_ptr<U> group) 
     109      int CGroupFactory::GetChildNum(std::shared_ptr<U> group) 
    110110   { return (group->childList.size()); } 
    111111 
    112112   template <typename U> 
    113       int CGroupFactory::GetChildIdNum(boost::shared_ptr<U> group) 
     113      int CGroupFactory::GetChildIdNum(std::shared_ptr<U> group) 
    114114   { return (group->childMap.size()); } 
    115115 
    116116   template <typename U> 
    117       boost::shared_ptr<U> 
    118          CGroupFactory::GetGroup(boost::shared_ptr<U> group, const StdString & id) 
     117      std::shared_ptr<U> 
     118         CGroupFactory::GetGroup(std::shared_ptr<U> group, const StdString & id) 
    119119   { 
    120120      if (!CGroupFactory::HasGroup<U>(group, id)) 
    121          ERROR("CGroupFactory::GetGroup(boost::shared_ptr<U> group, const StdString & id)", 
     121         ERROR("CGroupFactory::GetGroup(std::shared_ptr<U> group, const StdString & id)", 
    122122               << "[ id = " << id << ", U = " << U::GetName() << " ] " 
    123123               << " group is not referenced !"); 
     
    126126 
    127127   template <typename U> 
    128       boost::shared_ptr<typename U::RelChild> 
    129          CGroupFactory::GetChild(boost::shared_ptr<U> group, const StdString & id) 
     128      std::shared_ptr<typename U::RelChild> 
     129         CGroupFactory::GetChild(std::shared_ptr<U> group, const StdString & id) 
    130130   { 
    131131      if (!CGroupFactory::HasChild<U>(group, id)) 
    132          ERROR("CGroupFactory::GetChild(boost::shared_ptr<U> group, const StdString & id)", 
     132         ERROR("CGroupFactory::GetChild(std::shared_ptr<U> group, const StdString & id)", 
    133133               << "[ id = " << id << ", U = " << U::GetName() << " ] " 
    134134               << " child is not referenced !"); 
Note: See TracChangeset for help on using the changeset viewer.