Go to the documentation of this file.
29 template<
typename ResultType,
typename ParamServerType>
38 static ResultType
toResult(
const ParamServerType& value)
40 return static_cast<ResultType
>(value);
51 template<
typename ParamServerType>
66 static bool toParam(const ::XmlRpc::XmlRpcValue& x, ParamServerType& v,
bool skipNonConvertible =
false,
67 ::std::list<::std::string>* errors =
nullptr)
101 template<
typename ResultType>
114 template<typename ResultType, typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type>
123 typedef ::std::function<ResultType(
const ParamServerType& value)>
ToResultFn;
137 typedef ::std::function<bool(
138 const ::XmlRpc::XmlRpcValue& xmlValue,
139 ParamServerType& value,
140 const bool skipNonConvertible,
181 template<
typename R1,
typename P1>
206 this->paramToStr = other.paramToStr;
207 this->resultToStr = other.resultToStr;
208 this->toResult = other.toResult;
209 this->toParam = other.toParam;
221 template<
typename NewParamServerType>
223 typename ::cras::GetParamOptions<ResultType, NewParamServerType>::ToResultFn newToResult =
227 typename ::cras::GetParamOptions<ResultType, NewParamServerType>::ToParamFn newToParam =
228 [](const ::XmlRpc::XmlRpcValue& x, NewParamServerType& v,
bool skipNonConvertible =
false,
229 ::std::list<::std::string>* errors =
nullptr) ->
bool {
235 {{}, {}, {}, {}, {}, {}, {}, {}, newToResult, newToParam};
bool allowNestedParams
Allow parameters of form a/b/c (leads to recursive parsing of the sub-namespaces).
Default function for converting XmlRpcValue to an intermediate value of type ParamServerType.
::cras::ToStringFn< ResultType > resultToStr
A function that converts ResultType values to string for use in log messages.
GetParamOptions & operator=(const ::cras::GetParamOptions< R1, P1 > &other)
Assign from options of a different type. Only the non-function members are copied!
Default function for converting param server types to result types.
Default ParamServerType for the given ResultType.
::std::function<::std::string(const T &)> ToStringFn
Type of function that converts anything to a string.
Utils for working with strings.
::std::function< ResultType(const ParamServerType &value)> ToResultFn
Function converting ParamServerType values to ResultType.
static bool toParam(const ::XmlRpc::XmlRpcValue &x, ParamServerType &v, bool skipNonConvertible=false, ::std::list<::std::string > *errors=nullptr)
Function converting XmlRpcValue to an intermediate value of type ParamServerType.
ToResultFn toResult
A function converting ParamServerType values to ResultType.
bool printDefaultAsWarn
Whether defaulted parameters are reported as warning or info level messages.
ResultType type
The ParamServerType to be used as intermediate type when reading values of type ResultType.
::std::string to_string(const T &value)
Convert the given value to a string representation.
::std::string origParamName
The human-friendly parameter name to be reported in log messages.
bool throwIfConvertFails
Throw GetParamException if any conversion fails. If false, the default value is used instead of a val...
::std::string origNamespace
The human-friendly namespace to be reported in log messages.
::cras::GetParamOptions< ResultType, NewParamServerType > asType(typename ::cras::GetParamOptions< ResultType, NewParamServerType >::ToResultFn newToResult=&::cras::DefaultToResultFn< ResultType, NewParamServerType >::toResult, ::cras::ToStringFn< NewParamServerType > newParamToStr=[](const NewParamServerType &s){ return ::cras::to_string(s);}, typename ::cras::GetParamOptions< ResultType, NewParamServerType >::ToParamFn newToParam=[](const ::XmlRpc::XmlRpcValue &x, NewParamServerType &v, bool skipNonConvertible=false, ::std::list<::std::string > *errors=nullptr) -> bool { return ::cras::convert(x, v, skipNonConvertible, errors);}) const
Convert this options object to a similar object with a different ParamServerType.
::std::function< bool(const ::XmlRpc::XmlRpcValue &xmlValue, ParamServerType &value, const bool skipNonConvertible, ::std::list<::std::string > *errors)> ToParamFn
Function converting XmlRpcValue to an intermediate value of type ParamServerType.
static ResultType toResult(const ParamServerType &value)
Function converting ParamServerType values to ResultType.
inline ::std::string to_string(const ::Eigen::Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols > &value)
Default function for converting values to string in getParam(Verbose) functions. Uses cras::to_string...
bool printMessages
Whether to print error messages to log.
ToParamFn toParam
A function converting XmlRpcValue to an intermediate value of type ParamServerType.
::cras::ToStringFn< ParamServerType > paramToStr
A function that converts ParamServerType values to string for use in log messages.
GetParamOptions & operator=(const ::cras::GetParamOptions< ResultType, ParamServerType > &other)
Assign from options of the same type. Non-function members are also copied.
Utilities for working with XmlRpcValues.
bool convert(const ::XmlRpc::XmlRpcValue &x, ::XmlRpc::XmlRpcValue &v, bool=false, ::std::list<::std::string > *errors=nullptr)
Convert XmlRpcValue x to value v.
Options specifying behavior of getParam() calls.
cras_cpp_common
Author(s): Martin Pecka
autogenerated on Tue Nov 26 2024 03:49:04