dd_int_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 DDInt::getName() const {
9  return name_;
10  }
11 
12  void DDInt::prepGroup(Group &group) {
13  ParamDescription desc;
14  desc.name = name_;
15  desc.level = level_;
16  desc.description = desc_;
17  desc.type = "int";
18  group.parameters.push_back(desc);
19  }
20 
21  void DDInt::prepConfig(Config &conf) {
22  IntParameter param;
23  param.name = name_;
24  param.value = val_;
25  conf.ints.push_back(param);
26  }
27 
28  void DDInt::prepConfigDescription(ConfigDescription &conf_desc) {
29  IntParameter param;
30  param.name = name_;
31  param.value = def_;
32  conf_desc.dflt.ints.push_back(param);
33  param.value = max_;
34  conf_desc.max.ints.push_back(param);
35  param.value = min_;
36  conf_desc.min.ints.push_back(param);
37  }
38 
39  int DDInt::getLevel() const {
40  return level_;
41  }
42 
43  bool DDInt::sameType(Value val) {
44  return val.getType() == "int";
45  }
46 
47  bool DDInt::sameValue(Value val) {
48  return val.toInt() == val_;
49  }
50 
51  void DDInt::setValue(Value val) {
52  val_ = val.toInt();
53  }
54 
56  return Value(val_);
57  }
58 }
bool param(const std::string &param_name, T &param_val, const T &default_val)
int def_
the default value (def_), the current value (val_), the minimum allowed value (min_), and the maximum allowed value (max_)
Definition: dd_int_param.h:69
bool sameType(Value val)
checks whether or not the raw value stored in the value is compatible with the given 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_int_param.h:62
int toInt() const
converts the stored value into an integer.
Definition: dd_value.h:97
string name_
the name of the parameter (name_), and its description (desc_)
Definition: dd_int_param.h:74
void prepGroup(Group &group)
updates a group message according to this param's info.
string getName() const
gets the name of the parameter, that is, the ID used in the program when requesting it...
Definition: dd_int_param.cpp:8
Value getValue() const
gets the value of this parameter.
bool sameValue(Value val)
checks whether or not the value stored in the value object, when converted to the type of the interna...
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.
void setValue(Value val)
sets the value of this parameter as this one.
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
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