|
Open Model Railroad Network (OpenMRN)
|
Template recursion entry. More...
#include <OptionalArgs.hxx>
Public Types | |
| typedef Specifier | specifier_type |
| This is the type used by the customer to set the value in the initializer list. | |
| typedef Specifier::FetcherType | fetcher_type |
| This is the type we use internally to tag and fetch the value. | |
| typedef Specifier::data_type | data_type |
| The type of the actually stored data. Should be POD. | |
| using | Base = OptionalArg< Decl, TArgs... > |
| Recursion, with all other arguments. | |
Public Member Functions | |
| template<typename... Args> | |
| constexpr | OptionalArg (Args... args) |
| Constructor. | |
| constexpr | OptionalArg () |
| Constructor ending the recursion. | |
| constexpr data_type | get (const fetcher_type) const |
| constexpr bool | has (const fetcher_type) const |
Static Private Member Functions | |
| template<typename... Args> | |
| static constexpr data_type | GetFromArgs (const specifier_type spec, Args... args) |
| This template gets instantiated when the first argument is for us. | |
| template<typename... Args> | |
| static constexpr bool | HasFromArgs (const specifier_type spec, Args... args) |
| Decides whether we have the current argument (from the original list or arguments). | |
| template<typename U , typename... Args> | |
| static constexpr std::enable_if< std::is_convertible< typenamestd::add_lvalue_reference< U >::type, typenamestd::add_lvalue_reference< Base >::type >::value, data_type >::type | GetFromArgs (const U me, Args... args) |
| This template gets instantiated for a copy constructor: when the argument is already an OptionalArg (or reference to it). | |
| template<typename U , typename... Args> | |
| static constexpr std::enable_if< std::is_convertible< typenamestd::add_lvalue_reference< U >::type, typenamestd::add_lvalue_reference< Base >::type >::value, bool >::type | HasFromArgs (const U me, Args... args) |
| This template gets instantiated for a copy constructor: when the argument is already an OptionalArg (or reference to it). | |
| template<typename T , typename... Args> | |
| static constexpr std::enable_if<!std::is_convertible< typenamestd::add_lvalue_reference< T >::type, typenamestd::add_lvalue_reference< Base >::type >::value, data_type >::type | GetFromArgs (const T t, Args... args) |
| This template gets instantiated only if the argument is not an OptionalArg (hence not called from the copy constructor) and not a Specifier for the current entry. | |
| template<typename T , typename... Args> | |
| static constexpr std::enable_if<!std::is_convertible< typenamestd::add_lvalue_reference< T >::type, typenamestd::add_lvalue_reference< Base >::type >::value, bool >::type | HasFromArgs (const T t, Args... args) |
| This template gets instantiated only if the argument is not an OptionalArg (hence not called from the copy constructor) and not a Specifier for the current entry. | |
| static constexpr data_type | GetFromArgs () |
| If we've run out of all arguments, we take the default value. | |
| static constexpr bool | HasFromArgs () |
| If we've run out of all arguments, there is no specifier. | |
Private Attributes | |
| data_type | d_ |
| Data that the user specified (or the default). | |
| bool | has_ |
| Whether the user has specified the value or not. | |
Template recursion entry.
We have as many instances of this class in the inheritance stack as the number of data elements we need to carry. Each of these classes stores one single element in the private variable d_.
The constructor picks out the specifier for the current entry to fill in the current storage. All arguments are forwarded to the base class. This allows arbitrary order of the specified arguments; it is the responsibility of the innermost class to check for spurious arguments.
The get method either recognizes the Fetcher argument as referring to the current entry, or forwards it to the parent class.
Definition at line 187 of file OptionalArgs.hxx.
| using OptionalArg< Decl, Specifier, TArgs... >::Base = OptionalArg<Decl, TArgs...> |
Recursion, with all other arguments.
Definition at line 199 of file OptionalArgs.hxx.
| typedef Specifier::data_type OptionalArg< Decl, Specifier, TArgs... >::data_type |
The type of the actually stored data. Should be POD.
Definition at line 197 of file OptionalArgs.hxx.
| typedef Specifier::FetcherType OptionalArg< Decl, Specifier, TArgs... >::fetcher_type |
This is the type we use internally to tag and fetch the value.
Definition at line 195 of file OptionalArgs.hxx.
| typedef Specifier OptionalArg< Decl, Specifier, TArgs... >::specifier_type |
This is the type used by the customer to set the value in the initializer list.
Definition at line 193 of file OptionalArgs.hxx.
|
inlineconstexpr |
Constructor.
| args | specifies the values to store. |
Definition at line 203 of file OptionalArgs.hxx.
|
inlineconstexpr |
Constructor ending the recursion.
Definition at line 211 of file OptionalArgs.hxx.
|
inlineconstexpr |
Definition at line 218 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
If we've run out of all arguments, we take the default value.
Definition at line 304 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
This template gets instantiated when the first argument is for us.
Definition at line 237 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
This template gets instantiated only if the argument is not an OptionalArg (hence not called from the copy constructor) and not a Specifier for the current entry.
Then we just ignore the first arg and recurse into the rest of them.
| t | is the argument to ignore. |
| args | are the further arguments. |
Definition at line 285 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
This template gets instantiated for a copy constructor: when the argument is already an OptionalArg (or reference to it).
| me | is the copy constructor argument. |
| args | are the further arguments. |
Definition at line 259 of file OptionalArgs.hxx.
|
inlineconstexpr |
Definition at line 224 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
If we've run out of all arguments, there is no specifier.
Definition at line 309 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
Decides whether we have the current argument (from the original list or arguments).
Definition at line 246 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
This template gets instantiated only if the argument is not an OptionalArg (hence not called from the copy constructor) and not a Specifier for the current entry.
Then we just ignore the first arg and recurse into the rest of them.
Definition at line 298 of file OptionalArgs.hxx.
|
inlinestaticconstexprprivate |
This template gets instantiated for a copy constructor: when the argument is already an OptionalArg (or reference to it).
Definition at line 270 of file OptionalArgs.hxx.
|
private |
Data that the user specified (or the default).
Definition at line 315 of file OptionalArgs.hxx.
|
private |
Whether the user has specified the value or not.
Definition at line 317 of file OptionalArgs.hxx.