24template <
class Derived,
class ComponentType,
class ComponentName >
36 static bool available (
const Derived &
object,
const ComponentType & element );
46 static void valid (
const Derived &
object,
const ComponentType & element );
49template <
class Derived,
class ComponentType,
class ComponentCategory,
class ComponentName >
58template <
class Derived,
class ComponentType,
class ComponentName >
69 void checkSet (
const ComponentType & element ) {
73 std::string elementTypeName ( ext::to_string < ComponentName * > ( ) );
74 elementTypeName.back ( ) =
' ';
92 Component ( ComponentType element ) : m_data (
std::move ( element ) ) {
102 bool set ( ComponentType element ) {
103 checkSet ( element );
105 if ( m_data == element )
return false;
107 m_data = std::move ( element );
123 const ComponentType &
get ( )
const {
132 template <
class AccessedComponentName >
133 requires std::is_same_v < AccessedComponentName, ComponentName >
143 template <
class AccessedComponentName >
144 requires std::is_same_v < AccessedComponentName, ComponentName >
153 std::array < std::string, 0 > emptyNames;
154 std::array < std::string, 1 > elementNames = { {
"element" } };
157 abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( getMethod,
"get", emptyNames );
160 abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( constGetMethod,
"get", emptyNames );
163 abstraction::AlgorithmRegistry::registerMethod < ComponentName > ( setMethod,
"set", elementNames );
170 abstraction::AlgorithmRegistry::unregisterMethod < ComponentName, Derived & > (
"get" );
171 abstraction::AlgorithmRegistry::unregisterMethod < ComponentName, const Derived & > (
"get" );
172 abstraction::AlgorithmRegistry::unregisterMethod < ComponentName, Derived &, ComponentType > (
"set" );
180template <
class ... Data >
187 requires ( ! std::is_same_v < T, T > )
206template <
class Derived,
class ComponentType,
class ComponentCategory,
class ComponentName,
class ... Next >
207class Components < Derived, ComponentType, ComponentCategory, ComponentName, Next ... > :
public Component < Derived, ComponentType, ComponentCategory, ComponentName >,
public Components < Derived, Next ... > {
217 template <
class ComponentValue,
class ... NextValues >
218 Components ( ComponentValue param, NextValues ... nextParams ) :
Component < Derived, ComponentType, ComponentCategory, ComponentName > (
std::move ( param ) ),
Components < Derived, Next ... > (
std::move ( nextParams ) ... ) {
252template <
class Derived,
class ComponentType,
class ComponentCategory,
class ComponentName,
class ... ComponentNames,
class ... Next >
253class Components < Derived, ComponentType, ComponentCategory,
std::tuple < ComponentName, ComponentNames ... >, Next ... > :
public Component < Derived, ComponentType, ComponentCategory, ComponentName >,
public Components < Derived, ComponentType, ComponentCategory, std::tuple < ComponentNames ... >, Next ... > {
263 template <
class ComponentValue,
class ... NextValues >
264 Components ( ComponentValue param, NextValues ... nextParams ) :
Component < Derived, ComponentType, ComponentCategory, ComponentName > (
std::move ( param ) ),
Components < Derived, ComponentType, ComponentCategory,
std::tuple < ComponentNames ... >, Next ... > (
std::move ( nextParams ) ... ) {
298template <
class Derived,
class ComponentType,
class ComponentCategory,
class ... Next >
299class Components < Derived, ComponentType, ComponentCategory,
std::tuple < >, Next ... > :
public Components < Derived, Next ... > {
309 template <
class ... NextValues >
Definition: components.hpp:59
ComponentType & get()
Definition: components.hpp:115
static void registerComponent()
Definition: components.hpp:152
void checkState()
Definition: components.hpp:83
Component(ComponentType element)
Definition: components.hpp:92
& accessComponent()
Definition: components.hpp:145
const ComponentType & get() const
Definition: components.hpp:123
const Component< Derived, ComponentType, component::Value, ComponentName > & accessComponent() const
Definition: components.hpp:134
bool set(ComponentType element)
Definition: components.hpp:102
static void unregisterComponent()
Definition: components.hpp:169
Definition: components.hpp:50
static void registerComponent()
Definition: components.hpp:235
static void unregisterComponent()
Definition: components.hpp:243
Components(ComponentValue param, NextValues ... nextParams)
Definition: components.hpp:218
static void unregisterComponent()
Definition: components.hpp:328
static void registerComponent()
Definition: components.hpp:321
Components(NextValues ... nextParams)
Definition: components.hpp:310
static void unregisterComponent()
Definition: components.hpp:289
Components(ComponentValue param, NextValues ... nextParams)
Definition: components.hpp:264
static void registerComponent()
Definition: components.hpp:281
Definition: components.hpp:181
static void unregisterComponent()
Definition: components.hpp:199
static void registerComponent()
Definition: components.hpp:193
Definition: components.hpp:25
static void valid(const Derived &object, const ComponentType &element)
static bool available(const Derived &object, const ComponentType &element)
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
Definition: components.hpp:13
Definition: normalize.hpp:10
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
Definition: FordFulkerson.hpp:16