Skip to content
Snippets Groups Projects
Commit bae4a1f4 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

add documentation for new code in components

parent 637f1dd8
No related branches found
No related tags found
Loading
Pipeline #
......@@ -146,6 +146,9 @@ public:
return * this;
}
 
/**
* Register this component's accessors to abstraction
*/
static void registerComponent ( ) {
std::array < std::string, 0 > emptyNames;
std::array < std::string, 1 > elementNames = { { "element" } };
......@@ -174,6 +177,9 @@ public:
template < class T, typename std::enable_if < ! std::is_same < T, T >::value >::type * = nullptr >
void accessComponent ( );
 
/**
* To silent the compiler about nonexistent access method in Components base
*/
static void registerComponent ( ) {
}
};
......@@ -184,6 +190,9 @@ public:
template < class Derived, class ComponentType, class ComponentCategory, class ComponentName, class ... Next >
class Components < Derived, ComponentType, ComponentCategory, ComponentName, Next ... > : public Component < Derived, ComponentType, ComponentCategory, ComponentName >, public Components < Derived, Next ... > {
public:
/**
* Allow less initialization values then number of components. They need to allow to be defaulty constructed then.
*/
Components ( ) {
}
 
......@@ -205,6 +214,9 @@ public:
*/
using Components < Derived, Next ... >::accessComponent;
 
/**
* Dispatcher for registration functions in subclasses.
*/
static void registerComponent ( ) {
Component < Derived, ComponentType, ComponentCategory, ComponentName >::registerComponent ( );
Components < Derived, Next ... >::registerComponent ( );
......@@ -217,6 +229,9 @@ public:
template < class Derived, class ComponentType, class ComponentCategory, class ComponentName, class ... ComponentNames, class ... Next >
class Components < Derived, ComponentType, ComponentCategory, std::tuple < ComponentName, ComponentNames ... >, Next ... > : public Component < Derived, ComponentType, ComponentCategory, ComponentName >, public Components < Derived, ComponentType, ComponentCategory, std::tuple < ComponentNames ... >, Next ... > {
public:
/**
* Allow less initialization values then number of components. They need to allow to be defaulty constructed then.
*/
Components ( ) {
}
 
......@@ -238,6 +253,9 @@ public:
*/
using Components < Derived, ComponentType, ComponentCategory, std::tuple < ComponentNames ... >, Next ... >::accessComponent;
 
/**
* Dispatcher for registration functions in subclasses.
*/
static void registerComponent ( ) {
Component < Derived, ComponentType, ComponentCategory, ComponentName >::registerComponent ( );
Components < Derived, ComponentType, ComponentCategory, std::tuple < ComponentNames ... >, Next ... >::registerComponent ( );
......@@ -250,6 +268,9 @@ public:
template < class Derived, class ComponentType, class ComponentCategory, class ... Next >
class Components < Derived, ComponentType, ComponentCategory, std::tuple < >, Next ... > : public Components < Derived, Next ... > {
public:
/**
* Allow less initialization values then number of components. They need to allow to be defaulty constructed then.
*/
Components ( ) {
}
 
......@@ -265,6 +286,9 @@ public:
*/
using Components < Derived, Next ... >::accessComponent;
 
/**
* Dispatcher for registration functions in subclasses.
*/
static void registerComponent ( ) {
Components < Derived, Next ... >::registerComponent ( );
}
......
......@@ -114,6 +114,9 @@ public:
SetComponent ( SetComponentType data ) : m_data ( std::move ( data ) ) {
}
 
/**
* Constructs a empty set.
*/
SetComponent ( ) {
}
 
......@@ -225,12 +228,21 @@ public:
template < class Derived, class ComponentType, class ComponentName >
class Component < Derived, ComponentType, component::Set, ComponentName > : public SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName > {
public:
/**
* Allow value construction of this component.
*/
Component ( ComponentType data ) : SetComponent < Derived, ComponentType, typename ComponentType::value_type, ComponentName > ( std::move ( data ) ) {
}
 
/**
* Allow default construction of this component.
*/
Component ( ) {
}
 
/**
* Register this component's accessors to abstraction
*/
static void registerComponent ( ) {
std::array < std::string, 0 > emptyNames;
std::array < std::string, 1 > elementNames = { { "element" } };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment