iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::ParameterDef< T > Class Template Reference

#include <nrt/Core/Model/ParameterDef.H>

template<class T>
class nrt::ParameterDef< T >

A Parameter Definition.

ParameterDef is used to specify the name, description, default value, category, and optionally valid values for a Parameter.

See Also
nrt/Core/Typing/ValidValuesSpec.H for definitions of specifications for valid values.

Definition at line 131 of file ParameterDef.H.

Inheritance diagram for nrt::ParameterDef< T >:
nrt::ParameterDefBase

Public Member Functions

 ParameterDef (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category=ParameterCategory(), ParameterFlags const pflags=ParameterFlags::None)
 Construct a ParameterDef with no given valid values, valid values are whatever T can take.
 
template<template< typename > class ValidValuesSpec>
 ParameterDef (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category=ParameterCategory(), ParameterFlags const pflags=ParameterFlags::None)
 Create a Parameter definition with specified valid values from a ValidValueSpec.
 
 ParameterDef (std::string const &name, std::string const &description, T const &defaultValue, std::vector< T > const &validvalues, ParameterCategory const &category=ParameterCategory(), ParameterFlags const pflags=ParameterFlags::None)
 Shorthand to create a Parameter definition with specified valid values from a list. More...
 
 ParameterDef (std::string const &name, std::string const &description, T const &defaultValue, nrt::Range< T > const &validrange, ParameterCategory const &category=ParameterCategory(), ParameterFlags const pflags=ParameterFlags::None)
 Shorthand to create a Parameter definition with specified valid values from a range (bounds inclusive)
 
 ParameterDef (std::string const &name, std::string const &description, T const &defaultValue, boost::regex const &validregex, ParameterCategory const &category=ParameterCategory(), ParameterFlags const pflags=ParameterFlags::None)
 Shorthand to create a Parameter definition with specified valid values in a regex. More...
 
T const defaultValue () const
 Get the default value that was specified for this Parameter definition.
 
virtual std::string const defaultValueString () const
 Default value in string representation.
 
virtual std::string const validValuesString () const
 Valid values in string representation.
 
- Public Member Functions inherited from nrt::ParameterDefBase
 ParameterDefBase (std::string const &name, std::string const &description, ParameterCategory const &category=ParameterCategory(), ParameterFlags const pflags=ParameterFlags::None)
 Construct a ParameterDefBase.
 
virtual ~ParameterDefBase ()
 Destructor.
 
std::string const & name () const
 The parameter name (without the leading "--")
 
std::string const & description () const
 Description of what the parameter does.
 
ParameterCategory const & category () const
 The Parameter category.
 
ParameterFlags flags () const
 The Parameter Flags.
 

Friends

class ParameterCore< T >
 

Additional Inherited Members

- Protected Attributes inherited from nrt::ParameterDefBase
std::string itsName
 
std::string itsDescription
 
ParameterCategory itsCategory
 
ParameterFlags itsFlags
 

Constructor & Destructor Documentation

template<class T >
nrt::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
std::vector< T > const &  validvalues,
nrt::ParameterCategory const &  category = ParameterCategory(),
nrt::ParameterFlags const  pflags = ParameterFlags::None 
)
inline

Shorthand to create a Parameter definition with specified valid values from a list.

If your Parameter can only be set to a finite list of values, you can use this convenience constructor to specify them.

For example, if you want to create a Parameter for some kernel convolution for which you only have kernels of sizes 3, 5, 7 and 9 you could create a ParameterDef as follows:

ParameterDef<uint> KernelSizeDef("kernel-size", "The size of the convolution kernel", 3, {3,5,7,9});

Parameters created with this kind of list definition will show up as a drop-down box in nrtDesigner, allowing users to select only from your specified list of values.

Definition at line 126 of file ParameterDefImpl.H.

template<class T >
nrt::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
boost::regex const &  validregex,
nrt::ParameterCategory const &  category = ParameterCategory(),
nrt::ParameterFlags const  pflags = ParameterFlags::None 
)
inline

Shorthand to create a Parameter definition with specified valid values in a regex.

This allows for highly flexible valid values definitions. For example, say you want an int parameter to be in range [0..59] but it could also have value 72, your regex would be:

^(([0-5]?[0-9])|72)$

Definition at line 148 of file ParameterDefImpl.H.


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