dd_bool_param.cpp
Go to the documentation of this file.
1 //
2 // Created by Noam Dori on 19/06/18.
3 //
4 
6 
7 namespace ddynamic_reconfigure {
8  string DDBool::getName() const {
9  return name_;
10  }
11 
12  void DDBool::prepGroup(Group &group) {
13  ParamDescription desc;
14  desc.name = name_;
15  desc.level = level_;
16  desc.description = desc_;
17  desc.type = "bool";
18  group.parameters.push_back(desc);
19  }
20 
21  void DDBool::prepConfig(Config &conf) {
22  BoolParameter param;
23  param.name = name_;
24  param.value = (unsigned char)val_;
25  conf.bools.push_back(param);
26  }
27 
28  void DDBool::prepConfigDescription(ConfigDescription &conf_desc) {
29  BoolParameter param;
30  param.name = name_;
31  param.value = (unsigned char)def_;
32  conf_desc.dflt.bools.push_back(param);
33  param.value = (unsigned char)true;
34  conf_desc.max.bools.push_back(param);
35  param.value = (unsigned char)false;
36  conf_desc.min.bools.push_back(param);
37  }
38 
39  int DDBool::getLevel() const {
40  return level_;
41  }
42 
43  bool DDBool::sameType(Value val) {
44  return val.getType() == "bool";
45  }
46 
48  return val.toBool() == val_;
49  }
50 
51  void DDBool::setValue(Value val) {
52  val_ = val.toBool();
53  }
54 
56  return Value(val_);
57  }
58 }
void prepGroup(Group &group)
updates a group message according to this param's info.
bool param(const std::string &param_name, T &param_val, const T &default_val)
void prepConfigDescription(ConfigDescription &conf_desc)
updates a config description message according to this param's info.
int getLevel() const
fetches the level of the parameter
unsigned int level_
the level of the parameter: the degree in which things need to be shut down if this param changes ...
Definition: dd_bool_param.h:55
string getName() const
gets the name of the parameter, that is, the ID used in the program when requesting it...
bool sameValue(Value val)
checks whether or not the value stored in the value object, when converted to the type of the interna...
string name_
the name of the parameter (name_), and its description (desc_)
Definition: dd_bool_param.h:65
bool sameType(Value val)
checks whether or not the raw value stored in the value is compatible with the given parameter...
void setValue(Value val)
sets the value of this parameter as this one.
bool def_
the default value (def_), and the current value (val_)
Definition: dd_bool_param.h:60
Value getValue() const
gets the value of this parameter.
The Value class is used to wrap all basic data-types (bool,int,double,string) in something generic...
Definition: dd_value.h:29
void prepConfig(Config &conf)
updates a config message according to this param's info.
bool toBool() const
converts the stored value into a boolean.
Definition: dd_value.h:152
string getType() const
gets the type this value wrapper stores
Definition: dd_value.h:84


ddynamic_reconfigure
Author(s): Noam Dori
autogenerated on Thu May 16 2019 02:46:37