1 #ifndef __XIOS_CGroupFactory_impl__
2 #define __XIOS_CGroupFactory_impl__
12 std::shared_ptr<U> cgroup)
14 if (cgroup.get() == NULL || pgroup.get() == NULL )
15 ERROR(
"CGroupFactory::AddGroup(std::shared_ptr<U> pgroup, std::shared_ptr<U> cgroup)",
16 <<
" pgroup or cgroup NULL !");
18 pgroup->groupList.insert(pgroup->groupList.end(), cgroup.get());
21 pgroup->groupList.insert(pgroup->groupList.end(), cgroup.get());
22 pgroup->groupMap.insert(std::make_pair(cgroup->getId(), cgroup.get()));
28 std::shared_ptr<typename U::RelChild> child)
30 if (group.get() == NULL || child.get() == NULL )
31 ERROR(
"CGroupFactory::AddGroup(std::shared_ptr<U> pgroup, std::shared_ptr<U> cgroup)",
32 <<
" pgroup or cgroup NULL !");
34 group->childList.insert(group->childList.end(), child.get());
37 group->childList.insert(group->childList.end(), child.get());
38 group->childMap.insert(std::make_pair(child->getId(), child.get()));
50 std::shared_ptr<U> value = CObjectFactory::CreateObject<U>(CObjectFactory::GenUId<U>());
51 group->groupList.insert(group->groupList.end(), value.get());
52 group->groupMap.insert(std::make_pair(value->getId(), value.get()));
59 std::shared_ptr<U> value = CObjectFactory::CreateObject<U>(id);
60 group->groupList.insert(group->groupList.end(), value.get());
61 group->groupMap.insert(std::make_pair(
id, value.get()));
67 std::shared_ptr<typename U::RelChild>
74 std::shared_ptr<typename U::RelChild> value =
75 CObjectFactory::CreateObject<typename U::RelChild>();
76 group->childList.insert(group->childList.end(), value.get());
77 group->childMap.insert(std::make_pair(value->getId(), value.get()));
84 std::shared_ptr<typename U::RelChild> value =
85 CObjectFactory::CreateObject<typename U::RelChild>(id);
86 group->childList.insert(group->childList.end(), value.get());
87 group->childMap.insert(std::make_pair(
id, value.get()));
94 {
return (group->groupMap.find(
id) != group->groupMap.end()); }
98 {
return (group->childMap.find(
id) != group->childMap.end()); }
100 template <
typename U>
102 {
return (group->groupList.size()); }
104 template <
typename U>
106 {
return (group->groupMap.size()); }
108 template <
typename U>
110 {
return (group->childList.size()); }
112 template <
typename U>
114 {
return (group->childMap.size()); }
116 template <
typename U>
120 if (!CGroupFactory::HasGroup<U>(group,
id))
121 ERROR(
"CGroupFactory::GetGroup(std::shared_ptr<U> group, const StdString & id)",
122 <<
"[ id = " <<
id <<
", U = " << U::GetName() <<
" ] "
123 <<
" group is not referenced !");
124 return (group->groupMap[
id]->getShared());
127 template <
typename U>
128 std::shared_ptr<typename U::RelChild>
131 if (!CGroupFactory::HasChild<U>(group,
id))
132 ERROR(
"CGroupFactory::GetChild(std::shared_ptr<U> group, const StdString & id)",
133 <<
"[ id = " <<
id <<
", U = " << U::GetName() <<
" ] "
134 <<
" child is not referenced !");
135 return (group->childMap[
id]->getShared());
140 #endif // __XIOS_CGroupFactory_impl__
static void SetCurrentContextId(const StdString &context)
Mutateurs ///.
static std::shared_ptr< U > GetGroup(std::shared_ptr< U > group, const StdString &id)
static std::shared_ptr< typename U::RelChild > CreateChild(std::shared_ptr< U > group, const StdString &id=StdString(""))
static bool HasGroup(std::shared_ptr< U > group, const StdString &id)
Tests ///.
static std::shared_ptr< typename U::RelChild > GetChild(std::shared_ptr< U > group, const StdString &id)
static std::shared_ptr< U > CreateGroup(std::shared_ptr< U > group, const StdString &id=StdString(""))
Instanciateur ///.
static int GetChildNum(std::shared_ptr< U > group)
static int GetGroupIdNum(std::shared_ptr< U > group)
static void AddChild(std::shared_ptr< U > group, std::shared_ptr< typename U::RelChild > child)
static void AddGroup(std::shared_ptr< U > pgroup, std::shared_ptr< U > cgroup)
////////////////////// Définitions ////////////////////// ///
CATCH CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar *scalarDestination, CScalar *scalarSource, CReduceScalarToScalar *algo ERROR)("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",<< "Operation must be defined."<< "Scalar source "<< scalarSource->getId()<< std::endl<< "Scalar destination "<< scalarDestination->getId())
static int GetChildIdNum(std::shared_ptr< U > group)
static bool HasChild(std::shared_ptr< U > group, const StdString &id)
static int GetGroupNum(std::shared_ptr< U > group)
static StdString & GetCurrentContextId(void)
Accesseurs ///.