MarlinMT  0.1.0
marlinmt::ParameterBase< T > Class Template Reference

ParameterBase<T> class Base interface for user parameters. More...

#include <Parameter.h>

Inherited by marlinmt::Parameter< T >.

Public Types

using ValueType = T
 

Public Member Functions

virtual ~ParameterBase ()=default
 Default destructor. More...
 
 ParameterBase (EParameterType paramType, const std::string &na, const std::string &desc)
 Constructor. More...
 
 ParameterBase (EParameterType paramType, const std::string &na, const std::string &desc, const T &defVal)
 Constructor. More...
 
 ParameterBase (Configurable &conf, EParameterType paramType, const std::string &na, const std::string &desc)
 Constructor. More...
 
 ParameterBase (Configurable &conf, EParameterType paramType, const std::string &na, const std::string &desc, const T &defVal)
 Constructor. More...
 
EParameterType type () const
 Get the parameter type. More...
 
const std::string & name () const
 Get the property name. More...
 
const std::string & description () const
 Get the parameter description. More...
 
bool isSet () const
 Whether the parameter has been set. More...
 
bool hasDefault () const
 Whether the parameter has a default value. More...
 
std::string str () const
 Get the parameter value as string. More...
 
std::string defaultStr () const
 Get the parameter default value as string. More...
 
std::string typeStr () const
 Get the parameter type as string. More...
 
const std::type_index & typeIndex () const
 Get a type index object of the underlying type. More...
 
 operator T () const
 Implicit conversion operator to get the parameter value. More...
 
get () const
 Get the parameter value. More...
 
get (const T &fallback) const
 Get the parameter value. More...
 
void set (const T &value)
 Set the parameter value. More...
 
void reset ()
 Reset the parameter value (only) More...
 
void setValidator (ValidatorFunctionT< T > validator)
 Set the validator function. More...
 

Protected Attributes

std::shared_ptr< T > _value { std::make_shared<T>() }
 The parameter value address. More...
 
std::shared_ptr< ParameterImpl_impl {}
 A shared pointer on the parameter implementation. More...
 

Detailed Description

template<typename T>
class marlinmt::ParameterBase< T >

ParameterBase<T> class Base interface for user parameters.

See daughter classes for usage

Definition at line 427 of file Parameter.h.

Member Typedef Documentation

◆ ValueType

template<typename T>
using marlinmt::ParameterBase< T >::ValueType = T

Definition at line 429 of file Parameter.h.

Constructor & Destructor Documentation

◆ ~ParameterBase()

template<typename T>
virtual marlinmt::ParameterBase< T >::~ParameterBase ( )
virtualdefault

Default destructor.

◆ ParameterBase() [1/4]

template<typename T>
marlinmt::ParameterBase< T >::ParameterBase ( EParameterType  paramType,
const std::string &  na,
const std::string &  desc 
)
inline

Constructor.

Parameters
paramTypethe parameter type
nathe parameter name
descthe parameter description

Definition at line 441 of file Parameter.h.

◆ ParameterBase() [2/4]

template<typename T>
marlinmt::ParameterBase< T >::ParameterBase ( EParameterType  paramType,
const std::string &  na,
const std::string &  desc,
const T &  defVal 
)
inline

Constructor.

Parameters
paramTypethe parameter type
nathe parameter name
descthe parameter description
defValthe default parameter value

Definition at line 453 of file Parameter.h.

◆ ParameterBase() [3/4]

template<typename T>
marlinmt::ParameterBase< T >::ParameterBase ( Configurable conf,
EParameterType  paramType,
const std::string &  na,
const std::string &  desc 
)
inline

Constructor.

Parameters
confa configurable object to which the parameter is added
paramTypethe parameter type
nathe parameter name
descthe parameter description

Definition at line 465 of file Parameter.h.

◆ ParameterBase() [4/4]

template<typename T>
marlinmt::ParameterBase< T >::ParameterBase ( Configurable conf,
EParameterType  paramType,
const std::string &  na,
const std::string &  desc,
const T &  defVal 
)
inline

Constructor.

Parameters
confa configurable object to which the parameter is added
paramTypethe parameter type
nathe parameter name
descthe parameter description
defValthe default parameter value

Definition at line 478 of file Parameter.h.

Member Function Documentation

◆ defaultStr()

template<typename T>
std::string marlinmt::ParameterBase< T >::defaultStr ( ) const
inline

Get the parameter default value as string.

Definition at line 527 of file Parameter.h.

◆ description()

template<typename T>
const std::string& marlinmt::ParameterBase< T >::description ( ) const
inline

Get the parameter description.

Definition at line 499 of file Parameter.h.

◆ get() [1/2]

◆ get() [2/2]

template<typename T>
T marlinmt::ParameterBase< T >::get ( const T &  fallback) const
inline

Get the parameter value.

Returns the fallback value if the parameter is not set and has no default value

Definition at line 564 of file Parameter.h.

◆ hasDefault()

template<typename T>
bool marlinmt::ParameterBase< T >::hasDefault ( ) const
inline

Whether the parameter has a default value.

Definition at line 513 of file Parameter.h.

◆ isSet()

template<typename T>
bool marlinmt::ParameterBase< T >::isSet ( ) const
inline

◆ name()

template<typename T>
const std::string& marlinmt::ParameterBase< T >::name ( ) const
inline

Get the property name.

Definition at line 492 of file Parameter.h.

◆ operator T()

template<typename T>
marlinmt::ParameterBase< T >::operator T ( ) const
inline

Implicit conversion operator to get the parameter value.

Definition at line 548 of file Parameter.h.

◆ reset()

template<typename T>
void marlinmt::ParameterBase< T >::reset ( )
inline

Reset the parameter value (only)

Definition at line 580 of file Parameter.h.

◆ set()

template<typename T>
void marlinmt::ParameterBase< T >::set ( const T &  value)
inline

Set the parameter value.

Parameters
valuethe new parameter value

Definition at line 573 of file Parameter.h.

◆ setValidator()

template<typename T>
void marlinmt::ParameterBase< T >::setValidator ( ValidatorFunctionT< T >  validator)
inline

Set the validator function.

Parameters
validatorthe validator

Definition at line 589 of file Parameter.h.

Referenced by marlinmt::CPUCrunchingProcessor::CPUCrunchingProcessor().

◆ str()

template<typename T>
std::string marlinmt::ParameterBase< T >::str ( ) const
inline

Get the parameter value as string.

Definition at line 520 of file Parameter.h.

◆ type()

template<typename T>
EParameterType marlinmt::ParameterBase< T >::type ( ) const
inline

Get the parameter type.

Definition at line 485 of file Parameter.h.

◆ typeIndex()

template<typename T>
const std::type_index& marlinmt::ParameterBase< T >::typeIndex ( ) const
inline

Get a type index object of the underlying type.

Definition at line 541 of file Parameter.h.

◆ typeStr()

template<typename T>
std::string marlinmt::ParameterBase< T >::typeStr ( ) const
inline

Get the parameter type as string.

Definition at line 534 of file Parameter.h.

Member Data Documentation

◆ _impl

template<typename T>
std::shared_ptr<ParameterImpl> marlinmt::ParameterBase< T >::_impl {}
protected

A shared pointer on the parameter implementation.

Definition at line 597 of file Parameter.h.

◆ _value

template<typename T>
std::shared_ptr<T> marlinmt::ParameterBase< T >::_value { std::make_shared<T>() }
protected

The parameter value address.

Definition at line 595 of file Parameter.h.


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