|
CbmRoot
|
An utility, which allows to apply a callable to selected variables of a class in a loop. More...
#include <CbmStructLooper.h>
Public Member Functions | |
| constexpr | StructLooper (Variables Handler::*... vars) |
| Constructor. | |
| template<typename HandlerPtr, class Visitor, std::enable_if_t< is_pointer_to_v< HandlerPtr, Handler >, bool > = true> | |
| constexpr void | ForEachValue (HandlerPtr handler, Visitor &&visitor) const |
| Applies a visitor callable to values, which are stored in registered variables. | |
| template<typename HandlerPtr, class Visitor, std::enable_if_t< is_pointer_to_v< HandlerPtr, Handler >, bool > = true> | |
| constexpr void | ForEachVariable (HandlerPtr handler, Visitor &&visitor) const |
| Applies a visitor callable to variables. | |
Private Member Functions | |
| template<class Visitor, class VarPtrType, typename HandlerPtr, std::enable_if_t< is_pointer_to_v< HandlerPtr, Handler >, bool > = true> | |
| constexpr void | VisitValue (HandlerPtr handler, Visitor &&visitor, VarPtrType &&varAddr) const |
| A visit function for variables. | |
Private Attributes | |
| const std::tuple< Variables Handler::*... > | fVariableTuple |
| A tuple, containing addresses of the class variables. | |
An utility, which allows to apply a callable to selected variables of a class in a loop.
| Handler | A type of the handler composite class, in which the looper is instantiated |
| Variables | Variadic types of variables, which are registered in the instance |
Definition at line 113 of file CbmStructLooper.h.
|
inlineconstexpr |
Constructor.
| vars | Pointers to variables of a class/structure, which are registered in the instance |
Definition at line 117 of file CbmStructLooper.h.
References fVariableTuple.
|
inlineconstexpr |
Applies a visitor callable to values, which are stored in registered variables.
Definition at line 128 of file CbmStructLooper.h.
References fVariableTuple, v, and VisitValue().
|
inlineconstexpr |
Applies a visitor callable to variables.
Definition at line 139 of file CbmStructLooper.h.
References fVariableTuple, and v.
|
inlineconstexprprivate |
A visit function for variables.
| Visitor | A type of visitor |
| VarPtrType | A type of variable pointer |
| HandlerPtr | A type of handler pointer (const/mutable) |
| handler | A pointer to this handler (const/mutable) |
| visitor | A callable visitor |
| varAddr | An address of a variable |
Definition at line 157 of file CbmStructLooper.h.
References cbm::util::is_std_optional_v.
Referenced by ForEachValue().
|
private |
A tuple, containing addresses of the class variables.
Definition at line 146 of file CbmStructLooper.h.
Referenced by ForEachValue(), ForEachVariable(), and StructLooper().