11 #ifndef __dynamic_reconfigure_test__TESTCONFIG_H__
12 #define __dynamic_reconfigure_test__TESTCONFIG_H__
16 #include <ros/node_handle.h>
34 std::string d, std::string e)
60 std::string a_description, std::string a_edit_method, T
TestConfig::* a_f) :
141 template<
class T,
class PT>
145 GroupDescription(std::string a_name, std::string a_type,
int a_parent,
int a_id,
bool a_s, T PT::* a_f) :
AbstractGroupDescription(a_name, a_type, a_parent, a_id, a_s),
field(a_f)
157 PT*
config = boost::any_cast<PT*>(cfg);
161 for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator
i =
groups.begin();
i !=
groups.end(); ++
i)
163 boost::any n = &((*config).*
field);
164 if(!(*i)->fromMessage(
msg, n))
173 PT*
config = boost::any_cast<PT*>(cfg);
174 T* group = &((*config).*
field);
175 group->state =
state;
177 for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator
i =
groups.begin();
i !=
groups.end(); ++
i)
179 boost::any n = boost::any(&((*config).*
field));
180 (*i)->setInitialState(n);
187 PT*
config = boost::any_cast<PT*>(cfg);
189 T*
f = &((*config).*
field);
192 for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator
i =
groups.begin();
i !=
groups.end(); ++
i)
194 boost::any n = &((*config).*
field);
195 (*i)->updateParams(n, top);
201 const PT
config = boost::any_cast<PT>(cfg);
204 for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator
i =
groups.begin();
i !=
groups.end(); ++
i)
211 std::vector<TestConfig::AbstractGroupDescriptionConstPtr>
groups;
225 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator _i = params.begin(); _i != params.end(); ++_i)
228 (*_i)->getValue(
config, val);
230 if(
"int_enum_"==(*_i)->name){
int_enum_ = boost::any_cast<int>(val);}
231 if(
"int_"==(*_i)->name){
int_ = boost::any_cast<int>(val);}
232 if(
"double_"==(*_i)->name){
double_ = boost::any_cast<double>(val);}
233 if(
"double_no_minmax"==(*_i)->name){
double_no_minmax = boost::any_cast<double>(val);}
234 if(
"double_no_max"==(*_i)->name){
double_no_max = boost::any_cast<double>(val);}
235 if(
"str_"==(*_i)->name){
str_ = boost::any_cast<std::string>(val);}
236 if(
"mstr_"==(*_i)->name){
mstr_ = boost::any_cast<std::string>(val);}
237 if(
"bool_"==(*_i)->name){
bool_ = boost::any_cast<bool>(val);}
238 if(
"level"==(*_i)->name){
level = boost::any_cast<int>(val);}
239 if(
"int_nodefault"==(*_i)->name){
int_nodefault = boost::any_cast<int>(val);}
240 if(
"i"==(*_i)->name){
i = boost::any_cast<int>(val);}
270 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator _i = params.begin(); _i != params.end(); ++_i)
273 (*_i)->getValue(
config, val);
275 if(
"group1_int"==(*_i)->name){
group1_int = boost::any_cast<int>(val);}
295 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator _i = params.begin(); _i != params.end(); ++_i)
298 (*_i)->getValue(
config, val);
300 if(
"group2_double"==(*_i)->name){
group2_double = boost::any_cast<double>(val);}
301 if(
"group2_string"==(*_i)->name){
group2_string = boost::any_cast<std::string>(val);}
302 if(
"some_other"==(*_i)->name){
some_other = boost::any_cast<std::string>(val);}
303 if(
"variable"==(*_i)->name){
variable = boost::any_cast<bool>(val);}
326 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator _i = params.begin(); _i != params.end(); ++_i)
329 (*_i)->getValue(
config, val);
331 if(
"deep_var_int"==(*_i)->name){
deep_var_int = boost::any_cast<int>(val);}
332 if(
"deep_var_bool"==(*_i)->name){
deep_var_bool = boost::any_cast<bool>(val);}
333 if(
"deep_var_double"==(*_i)->name){
deep_var_double = boost::any_cast<double>(val);}
357 name =
"Upper_Group_2";
362 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator _i = params.begin(); _i != params.end(); ++_i)
365 (*_i)->getValue(
config, val);
367 if(
"some_param"==(*_i)->name){
some_param = boost::any_cast<int>(val);}
431 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator
i = __param_descriptions__.begin();
i != __param_descriptions__.end(); ++
i)
432 if ((*i)->fromMessage(
msg, *
this))
435 for (std::vector<AbstractGroupDescriptionConstPtr>::const_iterator
i = __group_descriptions__.begin();
i != __group_descriptions__.end();
i ++)
439 boost::any n = boost::any(
this);
440 (*i)->updateParams(n, *
this);
441 (*i)->fromMessage(
msg, n);
447 ROS_ERROR(
"TestConfig::__fromMessage__ called with an unexpected parameter.");
449 for (
unsigned int i = 0;
i <
msg.bools.size();
i++)
452 for (
unsigned int i = 0;
i <
msg.ints.size();
i++)
455 for (
unsigned int i = 0;
i <
msg.doubles.size();
i++)
458 for (
unsigned int i = 0;
i <
msg.strs.size();
i++)
469 void __toMessage__(
dynamic_reconfigure::Config &msg,
const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__,
const std::vector<AbstractGroupDescriptionConstPtr> &__group_descriptions__)
const
472 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator
i = __param_descriptions__.begin();
i != __param_descriptions__.end(); ++
i)
473 (*i)->toMessage(
msg, *
this);
475 for (std::vector<AbstractGroupDescriptionConstPtr>::const_iterator
i = __group_descriptions__.begin();
i != __group_descriptions__.end(); ++
i)
479 (*i)->toMessage(
msg, *
this);
494 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator
i = __param_descriptions__.begin();
i != __param_descriptions__.end(); ++
i)
495 (*i)->toServer(nh, *
this);
500 static bool setup=
false;
503 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator
i = __param_descriptions__.begin();
i != __param_descriptions__.end(); ++
i)
504 (*i)->fromServer(nh, *
this);
507 for (std::vector<AbstractGroupDescriptionConstPtr>::const_iterator
i = __group_descriptions__.begin();
i != __group_descriptions__.end();
i++){
508 if (!
setup && (*i)->id == 0) {
510 boost::any n = boost::any(
this);
511 (*i)->setInitialState(n);
521 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator
i = __param_descriptions__.begin();
i != __param_descriptions__.end(); ++
i)
522 (*i)->clamp(*
this, __max__, __min__);
529 for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator
i = __param_descriptions__.begin();
i != __param_descriptions__.end(); ++
i)
568 Default.abstract_parameters.push_back(
TestConfig::AbstractParamDescriptionConstPtr(
new TestConfig::ParamDescription<int>(
"int_enum_",
"int", 1,
"Int enum",
"{'enum_description': 'An enum to set the size.', 'enum': [{'srcline': 45, 'description': 'A small constant', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'Small'}, {'srcline': 46, 'description': 'A medium value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 1, 'ctype': 'int', 'type': 'int', 'name': 'Medium'}, {'srcline': 47, 'description': 'A large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 2, 'ctype': 'int', 'type': 'int', 'name': 'Large'}, {'srcline': 48, 'description': 'An extra large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 3, 'ctype': 'int', 'type': 'int', 'name': 'ExtraLarge'}]}", &
TestConfig::int_enum_)));
570 __param_descriptions__.push_back(
TestConfig::AbstractParamDescriptionConstPtr(
new TestConfig::ParamDescription<int>(
"int_enum_",
"int", 1,
"Int enum",
"{'enum_description': 'An enum to set the size.', 'enum': [{'srcline': 45, 'description': 'A small constant', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'Small'}, {'srcline': 46, 'description': 'A medium value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 1, 'ctype': 'int', 'type': 'int', 'name': 'Medium'}, {'srcline': 47, 'description': 'A large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 2, 'ctype': 'int', 'type': 'int', 'name': 'Large'}, {'srcline': 48, 'description': 'An extra large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 3, 'ctype': 'int', 'type': 'int', 'name': 'ExtraLarge'}]}", &
TestConfig::int_enum_)));
731 Group3.
abstract_parameters.push_back(
TestConfig::AbstractParamDescriptionConstPtr(
new TestConfig::ParamDescription<int>(
"deep_var_int",
"int", 0,
"Were very far down now",
"{'enum_description': 'An enum to set the size.', 'enum': [{'srcline': 45, 'description': 'A small constant', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'Small'}, {'srcline': 46, 'description': 'A medium value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 1, 'ctype': 'int', 'type': 'int', 'name': 'Medium'}, {'srcline': 47, 'description': 'A large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 2, 'ctype': 'int', 'type': 'int', 'name': 'Large'}, {'srcline': 48, 'description': 'An extra large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 3, 'ctype': 'int', 'type': 'int', 'name': 'ExtraLarge'}]}", &
TestConfig::deep_var_int)));
733 __param_descriptions__.push_back(
TestConfig::AbstractParamDescriptionConstPtr(
new TestConfig::ParamDescription<int>(
"deep_var_int",
"int", 0,
"Were very far down now",
"{'enum_description': 'An enum to set the size.', 'enum': [{'srcline': 45, 'description': 'A small constant', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'Small'}, {'srcline': 46, 'description': 'A medium value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 1, 'ctype': 'int', 'type': 'int', 'name': 'Medium'}, {'srcline': 47, 'description': 'A large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 2, 'ctype': 'int', 'type': 'int', 'name': 'Large'}, {'srcline': 48, 'description': 'An extra large value', 'srcfile': '/tmp/binarydeb/ros-kinetic-dynamic-reconfigure-1.5.48/cfg/Test.cfg', 'cconsttype': 'const int', 'value': 3, 'ctype': 'int', 'type': 'int', 'name': 'ExtraLarge'}]}", &
TestConfig::deep_var_int)));
886 #endif // __TESTRECONFIGURATOR_H__