Radium Engine
1.5.20
|
Base class for visitors with configurable per-type callbacks. Visiting will be prepared at running time by dynamically adding visitor operators for each type one want to visit in the container. The visitor accept type based on either the added operators or an external acceptance functor which can be associated/changed at runtime. This functor is only allowed to reduce the number of visited type as only type for which a visitor operator is registered can be visited. The visitor operators should be any callable that accept to be called using f(const std::string&, T&[, std::any&&]) More...
#include <Core/Containers/VariableSet.hpp>
Public Member Functions | |
~DynamicVisitor () override=default | |
allows the class to be derived | |
void | operator() (std::any &&in, std::any &&userParam) const override |
Execute a visiting operator on accepted types. | |
bool | accept (const std::type_index &id) const override |
Acceptance function for the visitor. | |
template<typename T , typename F > | |
bool | addOperator (F &&f) |
Add a visiting operator. | |
template<typename T > | |
bool | hasOperator () |
Test the existence of an operator associated with a type. | |
template<typename T , typename F > | |
void | addOrReplaceOperator (F &&f) |
Add or replace a visiting operator. | |
template<typename T > | |
bool | removeOperator () |
Remove a visiting operator. | |
Public Member Functions inherited from Ra::Core::VariableSet::DynamicVisitorBase |
Base class for visitors with configurable per-type callbacks. Visiting will be prepared at running time by dynamically adding visitor operators for each type one want to visit in the container. The visitor accept type based on either the added operators or an external acceptance functor which can be associated/changed at runtime. This functor is only allowed to reduce the number of visited type as only type for which a visitor operator is registered can be visited. The visitor operators should be any callable that accept to be called using f(const std::string&, T&[, std::any&&])
Definition at line 309 of file VariableSet.hpp.
|
nodiscardoverridevirtual |
Acceptance function for the visitor.
id | The type to test |
Implements Ra::Core::VariableSet::DynamicVisitorBase.
Definition at line 59 of file VariableSet.cpp.
bool Ra::Core::VariableSet::DynamicVisitor::addOperator | ( | F && | f | ) |
Add a visiting operator.
T | The accepted type for the visit. |
F | The operator type, a callable with profile void(const std::string&, [const ]T[&], std::any&&). |
f | The operator object. |
Definition at line 852 of file VariableSet.hpp.
void Ra::Core::VariableSet::DynamicVisitor::addOrReplaceOperator | ( | F && | f | ) |
Add or replace a visiting operator.
T | |
F |
f | This method is similar to DynamicVisitor::addOperator but replace any existing operator previously associated with the type T |
Definition at line 863 of file VariableSet.hpp.
bool Ra::Core::VariableSet::DynamicVisitor::hasOperator | ( | ) |
Test the existence of an operator associated with a type.
T |
Definition at line 858 of file VariableSet.hpp.
|
overridevirtual |
Execute a visiting operator on accepted types.
in | The variable to process |
userParam | The optional user define parameter to forward to type associated functor The variable in contains a wrapping of the association name->value whose visit is accepted. Visiting the association is done by calling the visit operator associated with the underlying type of the variable in. |
Implements Ra::Core::VariableSet::DynamicVisitorBase.
Definition at line 63 of file VariableSet.cpp.
bool Ra::Core::VariableSet::DynamicVisitor::removeOperator | ( | ) |
Remove a visiting operator.
T |
Definition at line 869 of file VariableSet.hpp.