JeVois  1.0
JeVois Smart Embedded Machine Vision Toolkit

Collaboration diagram for String conversions for Parameter:

Functions

template<typename T >
void jevois::paramValToString (T const &val, std::string &result)
 Machine-readable conversion of T to a string, for use in jevois::Parameter. More...
 
template<>
void jevois::paramValToString< unsigned char > (unsigned char const &val, std::string &result)
 Machine-readable conversion of T to a string, specialization to convert unsigned char to number, not character. More...
 
template<typename T >
void jevois::paramStringToVal (std::string const &valstring, T &result)
 Machine-readable conversion from string to T, for use in jevois::Parameter. More...
 
template<typename Q >
void jevois::paramValToString (std::vector< Q > const &val, std::string &result)
 Machine-readable output to a string, for use in jevois::Parameter: outputs [Element1, Element2, ...]. More...
 
template<typename Q >
void jevois::paramStringToVal (std::string const &valstring, std::vector< Q > &result)
 Machine-readable input from a string, for use in jevois::Parameter: reads [Element1, Element2, ...]. More...
 
template<typename K , typename V >
void jevois::paramValToString (std::map< K, V > const &val, std::string &result)
 Machine-readable output to a string, for use in jevois::Parameter: outputs [Key1:Value1, Key2:Value2, ...]. More...
 
template<typename K , typename V >
void jevois::paramStringToVal (std::string const &valstring, std::map< K, V > &result)
 Machine-readable input from a string, for use in jevois::Parameter: reads [Key1:Value1, Key2:Value2, ...]. More...
 
template<>
void jevois::paramValToString< bool > (bool const &val, std::string &result)
 Machine-readable conversion of bool to a string, for use in jevois::Parameter. More...
 
template<>
void jevois::paramStringToVal< bool > (std::string const &valstring, bool &result)
 Machine-readable conversion from string to bool, for use in jevois::Parameter. More...
 
template<>
void jevois::paramValToString< std::string > (std::string const &val, std::string &result)
 Machine-readable conversion of string to a string, for use in jevois::Parameter. More...
 
template<>
void jevois::paramStringToVal< std::string > (std::string const &valstring, std::string &result)
 Machine-readable conversion from string to string, for use in jevois::Parameter. More...
 

Function Documentation

template<typename T >
void jevois::paramStringToVal ( std::string const &  valstring,
T &  result 
)
inline

Machine-readable conversion from string to T, for use in jevois::Parameter.

Exceptions
Implementation-dependentexception encountered during conversion

A default implementation is provided which internally just uses jevois::from_string(). When implementing new types that can be used as parameters, users should supply the appropriate template specialization for this function. This function is used internally by Parameter to set a Parameter value from string.

Definition at line 42 of file ParameterStringConversionImpl.H.

Referenced by jevois::detail::paramValFromString().

template<typename Q >
void jevois::paramStringToVal ( std::string const &  valstring,
std::vector< Q > &  result 
)
inline

Machine-readable input from a string, for use in jevois::Parameter: reads [Element1, Element2, ...].

Exceptions
jevois::exception::Exceptionif input string is malformed. Specialization for std::vector<T> which supports nesting of other vectors and vectors of other types such as Dims and Points

Definition at line 56 of file ParameterStringConversionImpl.H.

template<typename K , typename V >
void jevois::paramStringToVal ( std::string const &  valstring,
std::map< K, V > &  result 
)
inline

Machine-readable input from a string, for use in jevois::Parameter: reads [Key1:Value1, Key2:Value2, ...].

Exceptions
jevois::exception::Exceptionif input string is malformed. Specialization for std::map which supports nesting of other maps/vectors

Definition at line 70 of file ParameterStringConversionImpl.H.

template<>
void jevois::paramStringToVal< bool > ( std::string const &  valstring,
bool &  result 
)
inline

Machine-readable conversion from string to bool, for use in jevois::Parameter.

Exceptions
jevois::exception::Exceptionif input string is malformed.

Specialization for bool so that we can accept nice verbose terms rather than just 0 and 1. Acceptable ways to set a bool Parameter are:

  • "true" or "false"
  • "t" or "f"
  • "yes" or "no"
  • "y" or "n"
  • 1 or 0
  • An empty string will set the Parameter to true, so you may use boolean parameters as switches, e.g., "--myFlag" is equivalent to "--myFlag=true"

Definition at line 84 of file ParameterStringConversionImpl.H.

template<>
void jevois::paramStringToVal< std::string > ( std::string const &  valstring,
std::string &  result 
)

Machine-readable conversion from string to string, for use in jevois::Parameter.

This implementation just returns the original string.

template<typename T >
void jevois::paramValToString ( T const &  val,
std::string &  result 
)
inline

Machine-readable conversion of T to a string, for use in jevois::Parameter.

A default implementation is provided which internally just uses jevois::to_string(). When implementing new types that can be used as parameters, users should supply the appropriate template specialization for this function. This function is used internally by Parameter to get a Parameter value as a string.

Definition at line 27 of file ParameterStringConversionImpl.H.

References jevois::to_string().

Referenced by jevois::ValidValuesSpecRegex< T >::checkValueValidity(), and jevois::detail::paramStringFromVal().

template<typename Q >
void jevois::paramValToString ( std::vector< Q > const &  val,
std::string &  result 
)
inline

Machine-readable output to a string, for use in jevois::Parameter: outputs [Element1, Element2, ...].

Specialization for std::vector<T> which supports nesting of other vectors and vectors of other types such as Dims and Points

Definition at line 49 of file ParameterStringConversionImpl.H.

template<typename K , typename V >
void jevois::paramValToString ( std::map< K, V > const &  val,
std::string &  result 
)
inline

Machine-readable output to a string, for use in jevois::Parameter: outputs [Key1:Value1, Key2:Value2, ...].

Specialization for std::map which supports nesting of other maps/vectors

Definition at line 63 of file ParameterStringConversionImpl.H.

template<>
void jevois::paramValToString< bool > ( bool const &  val,
std::string &  result 
)
inline

Machine-readable conversion of bool to a string, for use in jevois::Parameter.

Returns
"true" or "false".

Definition at line 77 of file ParameterStringConversionImpl.H.

template<>
void jevois::paramValToString< std::string > ( std::string const &  val,
std::string &  result 
)

Machine-readable conversion of string to a string, for use in jevois::Parameter.

This implementation just returns the original string.

template<>
void jevois::paramValToString< unsigned char > ( unsigned char const &  val,
std::string &  result 
)
inline

Machine-readable conversion of T to a string, specialization to convert unsigned char to number, not character.

Definition at line 34 of file ParameterStringConversionImpl.H.

References jevois::to_string().