From bae4a1f4a6dee138a46b5d7664a00f1df28ee0c4 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 22 Nov 2017 07:37:23 +0100 Subject: [PATCH] add documentation for new code in components --- alib2common/src/core/components.hpp | 24 +++++++++++++++++++ .../src/core/components/setComponents.hpp | 12 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/alib2common/src/core/components.hpp b/alib2common/src/core/components.hpp index 01f1beb77b..ea7d616d83 100644 --- a/alib2common/src/core/components.hpp +++ b/alib2common/src/core/components.hpp @@ -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 ( ); } diff --git a/alib2common/src/core/components/setComponents.hpp b/alib2common/src/core/components/setComponents.hpp index 356e94f2c1..26f60be931 100644 --- a/alib2common/src/core/components/setComponents.hpp +++ b/alib2common/src/core/components/setComponents.hpp @@ -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" } }; -- GitLab