Class Parameter¶
Defined in File Parameters.h
Class Documentation¶
-
class
SmartPeak::Parameter¶ This class holds parameter to use with the commands. Value can be validated, applaying constraints, through a schema (another Parameter).
Public Functions
-
inline
Parameter(const std::string &name)¶ uninitialized parameter constructor
-
Parameter(const std::map<std::string, std::string> &properties)¶ constructor from map
example of structure:
{ {“name”, “param1”}, {“type”, “int”}, {“value”, “23”}, {“description”, “param1 description”}, {“tags”, “tag1,tag2,tag3”} {“min”,”0”}, {“max”,”10”} }
-
std::string
getType() const¶ returns the type of parameter as string
-
bool
isValid(bool use_scheme = true) const¶ based constraints of this parameter, return wether the parameter is valid.
- Parameters
use_scheme – [in] use a schema to validate the value, if one is assigned to the parameter.
-
bool
isValid(const CastValue &value, bool use_scheme = true) const¶ based constraints of this parameter, return wether the parameter is valid.
- Parameters
value – [in] a CastValue to valid with the constraints of this parameter.
use_scheme – [in] use a schema’s constraint to validate the value, if one is assigned to the parameter.
-
inline void
setName(const std::string &name)¶ set name of the parameter.
- Parameters
name – [in] the name of the parameter.
-
inline const std::string &
getName() const¶ get name of the parameter.
set constraints min and max.
set constraints list.
-
void
setValueFromString(const std::string &value_as_string, bool allow_change_type = true)¶ set value of the parameter, from a string representation.
- Parameters
value_as_string – [in] the value, as string
allow_change_type – [in] if true, change also the type if the value suggest it. if false, a cast may be tried.
-
inline const std::string
getValueAsString() const¶ return value of the parameter.
-
inline void
setDescription(const std::string &description)¶ sets description of the parameter.
-
inline const std::string &
getDescription(bool use_scheme = true) const¶ get the description of the parameter.
- Parameters
use_scheme – [in] if one schema is associated, use it as description
-
inline void
setTags(const std::vector<std::string> &tags)¶ set tags.
- Parameters
tags – [in] the list of tags
-
inline const std::vector<std::string> &
getTags(bool use_scheme = true) const¶ get tags.
- Parameters
use_scheme – [in] if set, and if a schema is assigned to this parameter, returns the tags of the schema
-
const std::string
getRestrictionsAsString(bool use_scheme = true) const¶ get restrictions of the parameter, as a string representation.
- Parameters
use_scheme – [in] if set, and if a schema is assigned to this parameter, returns the restriction of the schema.
-
inline void
setAsSchema(bool is_schema)¶ set parameter as schema.
-
inline bool
isSchema() const¶ return wether the parameter is schema.
-
inline const std::string
getDefaultValueAsString() const¶ return default value of the parameter (if schema is assigned).
Friends
- friend class Utilities
-
inline