JeVois  1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:

#include <jevois/Component/ParameterDef.H>

template<class T>
class jevois::ParameterDef< T >

A Parameter Definition.

ParameterDef is used to specify the name, description, default value, category, and optionally valid values for a Parameter. The value type of the parameter is specified by template parameter T.

See Specification of sets of valid values, e.g., that some Parameter may take for definitions of specifications for valid values, allowing any value, values from a list, values in a range, values that match a regex, etc.

Definition at line 88 of file ParameterDef.H.

Inheritance diagram for jevois::ParameterDef< T >:
Collaboration diagram for jevois::ParameterDef< T >:

Public Member Functions

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

Friends

class ParameterCore< T >
 

Additional Inherited Members

- Protected Attributes inherited from jevois::ParameterDefBase
std::string itsName
 Our name. More...
 
std::string itsDescription
 Our description string. More...
 
ParameterCategory itsCategory
 Our category. More...
 

Constructor & Destructor Documentation

◆ ParameterDef() [1/6]

template<class T >
jevois::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
ParameterCategory const &  category 
)

Construct a ParameterDef with no given valid values, valid values are whatever T can take.

◆ ParameterDef() [2/6]

template<class T >
template<template< typename > class ValidValuesSpec>
jevois::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
ValidValuesSpec< T > const &  validValuesSpec,
ParameterCategory const &  category 
)

Create a Parameter definition with specified valid values from a ValidValueSpec.

◆ ParameterDef() [3/6]

template<class T >
jevois::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
std::vector< T > const &  validvalues,
ParameterCategory const &  category 
)

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<int> KernelSizeDef("kernel_size", "The size of the convolution kernel", 3, { 3, 5, 7, 9} );

The list of valid values will be shown for this parameter in the help message.

◆ ParameterDef() [4/6]

template<class T >
jevois::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
jevois::Range< T > const &  validrange,
ParameterCategory const &  category 
)

Shorthand to create a Parameter definition with specified valid values from a range (bounds inclusive)

◆ ParameterDef() [5/6]

template<class T >
jevois::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
jevois::StepRange< T > const &  validrange,
ParameterCategory const &  category 
)

Shorthand to create a Parameter definition with specified valid values from a step range (bounds inclusive)

◆ ParameterDef() [6/6]

template<class T >
jevois::ParameterDef< T >::ParameterDef ( std::string const &  name,
std::string const &  description,
T const &  defaultValue,
boost::regex const &  validregex,
ParameterCategory const &  category 
)

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)$

Member Function Documentation

◆ defaultValue()

template<class T >
const T jevois::ParameterDef< T >::defaultValue ( ) const

Get the default value that was specified for this Parameter definition.

◆ defaultValueString()

template<class T >
virtual const std::string jevois::ParameterDef< T >::defaultValueString ( ) const
virtual

Default value in string representation.

Implements jevois::ParameterDefBase.

◆ validValuesString()

template<class T >
virtual const std::string jevois::ParameterDef< T >::validValuesString ( ) const
virtual

Valid values in string representation.

Implements jevois::ParameterDefBase.

Friends And Related Function Documentation

◆ ParameterCore< T >

template<class T >
friend class ParameterCore< T >
friend

Definition at line 142 of file ParameterDef.H.


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