69 template<
typename TItemType,
class... TArgumentsList >
71 std::string
const& rItemFullName,
72 TArgumentsList&&... Arguments)
79 KRATOS_ERROR_IF(item_path.empty()) <<
"The item full name is empty" << std::endl;
83 for(std::size_t
i = 0 ;
i < item_path.size() - 1 ;
i++){
84 auto& r_item_name = item_path[
i];
85 if(p_current_item->
HasItem(r_item_name)){
86 p_current_item = &p_current_item->
GetItem(r_item_name);
94 auto& r_item_name = item_path.back();
95 if(p_current_item->
HasItem(r_item_name)){
96 KRATOS_ERROR <<
"The item \"" << rItemFullName <<
"\" is already registered." << std::endl;
99 p_current_item = &p_current_item->
AddItem<TItemType>(r_item_name, std::forward<TArgumentsList>(Arguments)...);
102 return *p_current_item;
107 template<
typename... Types>
109 std::string f_name = (... += (
"," + std::to_string(
args)));
120 return mspRootRegistryItem->begin();
125 return mspRootRegistryItem->cbegin();
130 return mspRootRegistryItem->end();
135 return mspRootRegistryItem->cend();
138 static RegistryItem& GetItem(std::string
const& rItemFullName);
140 template<
typename TDataType>
141 static TDataType
const&
GetValue(std::string
const& rItemFullName)
143 return GetItem(rItemFullName).GetValue<TDataType>();
146 template<
typename TDataType,
typename TCastType>
147 static typename std::enable_if<std::is_base_of<TDataType, TCastType>::value, TCastType>
::type const GetValueAs(std::string
const& rItemFullName)
149 return GetItem(rItemFullName).GetValueAs<TDataType, TCastType>();
152 static void RemoveItem(std::string
const& ItemName);
158 static std::size_t size();
160 static bool HasItem(std::string
const& rItemFullName);
162 static bool HasValue(std::string
const& rItemFullName);
164 static bool HasItems(std::string
const& rItemFullName);
171 std::string
Info()
const;
174 void PrintInfo(std::ostream& rOStream)
const;
177 void PrintData(std::ostream& rOStream)
const;
179 std::string ToJson(std::string
const& Indentation)
const;
214 static std::vector<std::string> SplitFullName(std::string
const& FullName);
247 std::istream& rIStream,
252 std::ostream& rOStream,
256 rOStream << std::endl;
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
static LockObject & GetGlobalLock()
Returns the global lock Global lock that can be used for critical sections.
Definition: parallel_utilities.cpp:125
Kratos base registry This class is intended to act as global registry Each time the AddItem method is...
Definition: registry.h:42
Registry()
Default constructor.
Definition: registry.h:55
static auto end()
Definition: registry.h:128
static std::string RegistryTemplateToString(Types &&... args)
Definition: registry.h:108
static auto cbegin()
Definition: registry.h:123
~Registry()
Destructor.
Definition: registry.h:58
KRATOS_CLASS_POINTER_DEFINITION(Registry)
Pointer definition of Registry.
static TDataType const & GetValue(std::string const &rItemFullName)
Definition: registry.h:141
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: registry.cpp:124
static auto begin()
Definition: registry.h:118
static std::enable_if< std::is_base_of< TDataType, TCastType >::value, TCastType >::type const GetValueAs(std::string const &rItemFullName)
Definition: registry.h:147
static auto const cend()
Definition: registry.h:133
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: registry.cpp:129
static RegistryItem & AddItem(std::string const &rItemFullName, TArgumentsList &&... Arguments)
Definition: registry.h:70
The registry item to be stored by Registry class. It is the base class for some more specific ones.
Definition: registry_item.h:44
RegistryItem const & GetItem(std::string const &rItemName) const
Definition: registry_item.cpp:154
bool HasItem(std::string const &rItemName) const
Definition: registry_item.cpp:134
RegistryItem & AddItem(std::string const &ItemName, TArgumentsList &&... Arguments)
Definition: registry_item.h:195
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
std::vector< std::string > SplitStringByDelimiter(const std::string &rString, const char Delimiter)
This method splits a string by a delimiter.
Definition: string_utilities.cpp:144
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
type
Definition: generate_gid_list_file.py:35
args
Definition: generate_gid_list_file.py:37
Registry
Definition: __init__.py:106
integer i
Definition: TensorModule.f:17