Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
OptionalArg< Decl > Class Template Reference

Terminates the class recursion template. More...

#include <OptionalArgs.hxx>

Inheritance diagram for OptionalArg< Decl >:

Public Member Functions

template<typename... Args>
constexpr OptionalArg (Args... args)
 Constructor.
 
template<class FF >
constexpr FF get (const FF f) const
 End of template recursion.
 
template<class FF >
constexpr bool has (const FF f) const
 End of template recursion.
 

Static Private Member Functions

static constexpr int check_arguments_are_valid (const OptionalArg &a)
 End of recursion with no leftover arguments.
 
template<typename A , typename... Args>
static constexpr int check_all_args (const A a, Args... args)
 Beginning of recursion..
 
static constexpr int check_all_args ()
 End of recursion.
 
static bool tried_to_get_unknown_argument ()
 unimplemented, causes a link error. Do not ever implement it.
 

Private Attributes

const int check_
 This is here only to force computing the check_all_args at compile time (constexpr!).
 

Detailed Description

template<class Decl>
class OptionalArg< Decl >

Terminates the class recursion template.

The constructor is used to check that the customer has specified only known parameters.

The get function throws an error deterministically, because if the compiler gets this deep in the get function, then none of the actual data carrying components matched on the type. This means that the customer is trying to fetch something we didn't store.

Definition at line 122 of file OptionalArgs.hxx.

Constructor & Destructor Documentation

◆ OptionalArg()

template<class Decl >
template<typename... Args>
constexpr OptionalArg< Decl >::OptionalArg ( Args...  args)
inlineconstexpr

Constructor.

Parameters
argsarguments.

Definition at line 127 of file OptionalArgs.hxx.

Member Function Documentation

◆ check_all_args() [1/2]

template<class Decl >
static constexpr int OptionalArg< Decl >::check_all_args ( )
inlinestaticconstexprprivate

End of recursion.

Definition at line 162 of file OptionalArgs.hxx.

◆ check_all_args() [2/2]

template<class Decl >
template<typename A , typename... Args>
static constexpr int OptionalArg< Decl >::check_all_args ( const A  a,
Args...  args 
)
inlinestaticconstexprprivate

Beginning of recursion..

Definition at line 156 of file OptionalArgs.hxx.

◆ check_arguments_are_valid()

template<class Decl >
static constexpr int OptionalArg< Decl >::check_arguments_are_valid ( const OptionalArg< Decl > &  a)
inlinestaticconstexprprivate

End of recursion with no leftover arguments.

Definition at line 149 of file OptionalArgs.hxx.

◆ get()

template<class Decl >
template<class FF >
constexpr FF OptionalArg< Decl >::get ( const FF  f) const
inlineconstexpr

End of template recursion.

Fails to link.

Parameters
funknown argument specification.
Returns
nothing

Definition at line 134 of file OptionalArgs.hxx.

◆ has()

template<class Decl >
template<class FF >
constexpr bool OptionalArg< Decl >::has ( const FF  f) const
inlineconstexpr

End of template recursion.

Fails to link.

Parameters
funknown argument specification.
Returns
nothing.

Definition at line 141 of file OptionalArgs.hxx.

Member Data Documentation

◆ check_

template<class Decl >
const int OptionalArg< Decl >::check_
private

This is here only to force computing the check_all_args at compile time (constexpr!).

Definition at line 172 of file OptionalArgs.hxx.


The documentation for this class was generated from the following file: