JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches

#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.
 
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.
 
 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.
 
 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 (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 (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.
 
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 jevois::ParameterDefBase
 ParameterDefBase (std::string const &name, std::string const &description, ParameterCategory const &category=ParameterCategory())
 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.
 

Friends

class ParameterCore< T >
 

Additional Inherited Members

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

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} );
A Parameter Definition.

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 >
T const jevois::ParameterDef< T >::defaultValue ( ) const

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

◆ defaultValueString()

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

Default value in string representation.

Implements jevois::ParameterDefBase.

◆ validValuesString()

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

Valid values in string representation.

Implements jevois::ParameterDefBase.

Friends And Related Symbol Documentation

◆ ParameterCore< T >

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

Definition at line 139 of file ParameterDef.H.


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