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

The concept of parameter in the JeVois framework embodies wrappers around a single value of any type, with associated documentation (description), default values, possible specification of valid values, accessor functions to obtain or change the value, and optional callback functions that are triggered when the value is changed. Parameters are intended to be used in objects that inherit from Component. The goal of parameters is to expose parameters of a given vision algorithm in such a way that any piece of code that is using that algorithm will automatically inherit and expose these parameters.

How to explore this documentation module:

The other classes in this documentation module are mainly for support of the above ones.

Convenience macro to define a Parameter type

JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)

ParamName is the name chosen for the parameter. A new class type will be created with that name, so it must be syntactically correct as a class name. ParamType is the type of the parameter value. The remaining arguments are passed to the constructor of jevois::ParameterDef<T> with T=ParamType.

Convenience macro to define a Parameter type, with callback

JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(ParamName, ParamType, ...)

ParamName is the name chosen for the parameter. A new class type will be created with that name, so it must be syntactically correct as a class name. ParamType is the type of the parameter value. The remaining arguments are passed to the constructor of jevois::ParameterDef<T> with T=ParamType.

In this version with callback, a pure virtual method is included in the new class that is defined, with the following signature:

virtual void onParamChange(ParamName const & param, ParamType const & newval) = 0;

The host class (typically, a Component) that inherits from Parameter<ParamName> must implement an override of this function. A compile-time error will be issued if that override has not been implemented.

Collaboration diagram for Parameter-related classes and functions:

Classes

class  jevois::ParameterSummary
 ParameterSummary provides a summary about a parameter. More...
 
class  jevois::ParameterBase
 Base class for Parameter. More...
 
class  jevois::ParameterCore< T >
 A changeable parameter for a Component, core class. More...
 
class  jevois::Parameter< Param, Tail ... >
 A set of Parameters attached to a component. More...
 
class  jevois::DynamicParameter< T >
 Dynamic parameter added to a component at runtime. More...
 
struct  jevois::ParameterCategory
 A category to which multiple ParameterDef definitions can belong. More...
 
class  jevois::ParameterDefBase
 Base class for a Parameter definition. More...
 
class  jevois::ParameterDef< T >
 A Parameter Definition. More...
 
class  jevois::ParameterRegistry
 A simple registry of all parameters associated with a Component. More...
 

Modules

 String conversions for Parameter
 
 Specification of sets of valid values, e.g., that some Parameter may take
 This is used by ParameterDef to specify valid values that a Parameter may take as unrestricted, from a given list, in a range, matching a regex, etc.
 

Functions

 jevois::ParameterBase::ParameterBase ()
 Constructor. More...
 
virtual jevois::ParameterBase::~ParameterBase ()
 Destructor, will remove the parameter from its owner component. More...
 
virtual const std::string & jevois::ParameterBase::name () const =0
 Get the parameter name. More...
 
virtual std::string jevois::ParameterBase::descriptor () const =0
 Get the parameter fully-qualified name, aka descriptor, including names of owning Component and all parents. More...
 
virtual void jevois::ParameterBase::strset (std::string const &valstring)=0
 Set the value from a string representation of it. More...
 
virtual const std::string jevois::ParameterBase::strget () const =0
 Get the value as a string. More...
 
virtual const ParameterSummary jevois::ParameterBase::summary () const =0
 Get summary info about this parameter. More...
 
void jevois::ParameterBase::freeze ()
 Freeze this parameter, it becomes read-only and will not show up in the help message. More...
 
void jevois::ParameterBase::unFreeze ()
 Unfreeze this parameter, it becomes read-write and will show up in the help message. More...
 
void jevois::ParameterBase::freeze (bool doit)
 Alternate syntax that can be used instead of freeze()/unFreeze(), useful for programmatic freezing. More...
 
virtual void jevois::ParameterBase::reset ()=0
 Reset this parameter to its default value. More...
 

Variables

std::string jevois::ParameterSummary::descriptor
 Descriptor. This is the name of the parameter, qualified by a chain of component names. More...
 
std::string jevois::ParameterSummary::name
 Plain name of the parameter. More...
 
std::string jevois::ParameterSummary::description
 Description of the parameter. More...
 
std::string jevois::ParameterSummary::valuetype
 Parameter value type, as a string. More...
 
std::string jevois::ParameterSummary::defaultvalue
 Default value of the parameter, as a string. More...
 
std::string jevois::ParameterSummary::value
 Current value of the parameter, as a string. More...
 
std::string jevois::ParameterSummary::validvalues
 Description of the parameter's valid values specification, as a string. More...
 
std::string jevois::ParameterSummary::category
 Category of the parameter, as a string. More...
 
std::string jevois::ParameterSummary::categorydescription
 Category description. More...
 
bool jevois::ParameterSummary::frozen
 Flag that indicates whether parameter is frozen. More...
 
boost::shared_mutex jevois::ParameterBase::itsMutex
 Mutex to protect the parameter value. More...
 
volatile bool jevois::ParameterBase::itsFrozen
 When true, parameter is frozen (read-only, does not show up in help message) More...
 
bool jevois::ParameterBase::itsVirgin
 Param has not yet been explicitly set, need to call the callback (if any) at init time. More...
 

Friends

class jevois::ParameterBase::ParameterRegistry
 

Function Documentation

◆ descriptor()

virtual std::string jevois::ParameterBase::descriptor ( ) const
pure virtual

Get the parameter fully-qualified name, aka descriptor, including names of owning Component and all parents.

Implemented in jevois::ParameterCore< T >.

◆ freeze() [1/2]

void jevois::ParameterBase::freeze ( )

Freeze this parameter, it becomes read-only and will not show up in the help message.

Referenced by jevois::Component::freezeParam().

◆ freeze() [2/2]

void jevois::ParameterBase::freeze ( bool  doit)

Alternate syntax that can be used instead of freeze()/unFreeze(), useful for programmatic freezing.

◆ name()

virtual const std::string& jevois::ParameterBase::name ( ) const
pure virtual

◆ ParameterBase()

jevois::ParameterBase::ParameterBase ( )

Constructor.

◆ reset()

virtual void jevois::ParameterBase::reset ( )
pure virtual

Reset this parameter to its default value.

Implemented in jevois::ParameterCore< T >.

◆ strget()

virtual const std::string jevois::ParameterBase::strget ( ) const
pure virtual

Get the value as a string.

Implemented in jevois::ParameterCore< T >.

Referenced by jevois::Component::getParamString().

◆ strset()

virtual void jevois::ParameterBase::strset ( std::string const &  valstring)
pure virtual

Set the value from a string representation of it.

Exceptions
std::range_errorif the given string cannot be converted to a Parameter value, or the value is invalid according to our valid values spec or rejected by the Parameter's callback (if any).

Implemented in jevois::ParameterCore< T >.

Referenced by jevois::Component::setParamString().

◆ summary()

virtual const ParameterSummary jevois::ParameterBase::summary ( ) const
pure virtual

Get summary info about this parameter.

Implemented in jevois::ParameterCore< T >.

Referenced by jevois::GUIhelper::drawParameters().

◆ unFreeze()

void jevois::ParameterBase::unFreeze ( )

Unfreeze this parameter, it becomes read-write and will show up in the help message.

Referenced by jevois::Component::unFreezeParam().

◆ ~ParameterBase()

virtual jevois::ParameterBase::~ParameterBase ( )
virtual

Destructor, will remove the parameter from its owner component.

Variable Documentation

◆ category

std::string jevois::ParameterSummary::category

Category of the parameter, as a string.

Definition at line 108 of file Parameter.H.

Referenced by jevois::GUIhelper::drawParameters(), and jevois::Component::paramInfo().

◆ categorydescription

std::string jevois::ParameterSummary::categorydescription

Category description.

Definition at line 111 of file Parameter.H.

Referenced by jevois::Component::paramInfo().

◆ defaultvalue

std::string jevois::ParameterSummary::defaultvalue

Default value of the parameter, as a string.

Definition at line 99 of file Parameter.H.

Referenced by jevois::Component::paramInfo().

◆ description

std::string jevois::ParameterSummary::description

Description of the parameter.

Definition at line 93 of file Parameter.H.

Referenced by jevois::Component::paramInfo().

◆ descriptor

std::string jevois::ParameterSummary::descriptor

Descriptor. This is the name of the parameter, qualified by a chain of component names.

Definition at line 87 of file Parameter.H.

◆ frozen

bool jevois::ParameterSummary::frozen

Flag that indicates whether parameter is frozen.

Definition at line 114 of file Parameter.H.

Referenced by jevois::Component::paramInfo().

◆ itsFrozen

volatile bool jevois::ParameterBase::itsFrozen
protected

When true, parameter is frozen (read-only, does not show up in help message)

Definition at line 161 of file Parameter.H.

◆ itsMutex

boost::shared_mutex jevois::ParameterBase::itsMutex
mutableprotected

Mutex to protect the parameter value.

Definition at line 160 of file Parameter.H.

◆ itsVirgin

bool jevois::ParameterBase::itsVirgin
protected

Param has not yet been explicitly set, need to call the callback (if any) at init time.

Definition at line 162 of file Parameter.H.

◆ name

std::string jevois::ParameterSummary::name

Plain name of the parameter.

Definition at line 90 of file Parameter.H.

Referenced by jevois::GUIhelper::drawParameters(), and jevois::Component::paramInfo().

◆ validvalues

std::string jevois::ParameterSummary::validvalues

Description of the parameter's valid values specification, as a string.

Definition at line 105 of file Parameter.H.

Referenced by jevois::Component::paramInfo().

◆ value

std::string jevois::ParameterSummary::value

Current value of the parameter, as a string.

Definition at line 102 of file Parameter.H.

Referenced by jevois::Component::paramInfo().

◆ valuetype

std::string jevois::ParameterSummary::valuetype

Parameter value type, as a string.

Definition at line 96 of file Parameter.H.

Referenced by jevois::Component::paramInfo().

Friends

◆ ParameterRegistry

friend class ParameterRegistry
friend

Definition at line 165 of file Parameter.H.

onParamChange
void onParamChange(manager::loglevel const &param, manager::LogLevel const &newval) override
Parameter callback.