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

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 F , typename S >
void jevois::paramValToString (std::pair< F, S > const &val, std::string &result)
 Machine-readable output to a string, for use in jevois::Parameter: outputs first second. More...
 
template<typename F , typename S >
void jevois::paramStringToVal (std::string const &valstring, std::pair< F, S > &result)
 Machine-readable input from a string, for use in jevois::Parameter: reads first second. More...
 
template<typename T >
void jevois::paramValToString (cv::Point_< T > const &val, std::string &result)
 Machine-readable output to a string, for use in jevois::Parameter: outputs x y. More...
 
template<typename T >
void jevois::paramStringToVal (std::string const &valstring, cv::Point_< T > &result)
 Machine-readable input from a string, for use in jevois::Parameter: reads x y. More...
 
template<typename T >
void jevois::paramValToString (cv::Size_< T > const &val, std::string &result)
 Machine-readable output to a string, for use in jevois::Parameter: outputs width height. More...
 
template<typename T >
void jevois::paramStringToVal (std::string const &valstring, cv::Size_< T > &result)
 Machine-readable input from a string, for use in jevois::Parameter: reads width height. More...
 
template<typename T >
void jevois::paramValToString (cv::Scalar_< T > const &val, std::string &result)
 Machine-readable output to a string, for use in jevois::Parameter: outputs r g b a. More...
 
template<typename T >
void jevois::paramStringToVal (std::string const &valstring, cv::Scalar_< T > &result)
 Machine-readable input from a string, for use in jevois::Parameter: reads r g b a or subsets. More...
 
template<>
void jevois::paramValToString< ImColor > (ImColor const &val, std::string &result)
 Machine-readable output to a string, for use in jevois::Parameter: outputs R G B A, each 0..255. More...
 
template<>
void jevois::paramStringToVal< ImColor > (std::string const &valstring, ImColor &result)
 Machine-readable input from a string, for use in jevois::Parameter: reads R G B A, each 0..255. 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

◆ paramStringToVal() [1/7]

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

Machine-readable input from a string, for use in jevois::Parameter: reads x y.

◆ paramStringToVal() [2/7]

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

Machine-readable input from a string, for use in jevois::Parameter: reads r g b a or subsets.

◆ paramStringToVal() [3/7]

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

Machine-readable input from a string, for use in jevois::Parameter: reads width height.

◆ paramStringToVal() [4/7]

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, ...].

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

◆ paramStringToVal() [5/7]

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

Machine-readable input from a string, for use in jevois::Parameter: reads first second.

◆ paramStringToVal() [6/7]

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, ...].

Overload for std::vector<T> which supports nesting of other vectors and vectors of other types

◆ paramStringToVal() [7/7]

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

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.

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

◆ paramStringToVal< bool >()

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

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"
  • "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"

◆ paramStringToVal< ImColor >()

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

Machine-readable input from a string, for use in jevois::Parameter: reads R G B A, each 0..255.

◆ paramStringToVal< std::string >()

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.

◆ paramValToString() [1/7]

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

Machine-readable output to a string, for use in jevois::Parameter: outputs x y.

◆ paramValToString() [2/7]

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

Machine-readable output to a string, for use in jevois::Parameter: outputs r g b a.

◆ paramValToString() [3/7]

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

Machine-readable output to a string, for use in jevois::Parameter: outputs width height.

◆ paramValToString() [4/7]

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, ...].

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

◆ paramValToString() [5/7]

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

Machine-readable output to a string, for use in jevois::Parameter: outputs first second.

◆ paramValToString() [6/7]

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, ...].

Overload for std::vector<T> which supports nesting of other vectors and vectors of other types

◆ paramValToString() [7/7]

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.

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.

◆ paramValToString< bool >()

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

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

Returns
"true" or "false".

◆ paramValToString< ImColor >()

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

Machine-readable output to a string, for use in jevois::Parameter: outputs R G B A, each 0..255.

◆ paramValToString< std::string >()

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.

◆ paramValToString< unsigned char >()

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.