32 #include <boost/algorithm/string.hpp> 42 void operator()(
void const *)
const {}
47 erase(parameter->key);
53 for(ParameterList::const_iterator it = other.begin(); it != other.end(); ++it) push_back(*it);
58 if (!key.empty()) alias.
key = key;
63 for(ParameterList::const_iterator it = parameters.begin(); it != parameters.end(); ++it) {
66 if (!prefix.empty()) copy->key = prefix + copy->key;
73 copy(std::string(), parameters);
78 for(const_iterator it = begin(); it != end(); ++it) {
79 if ((*it)->key == key) {
83 throw std::runtime_error(
"parameter not found");
87 iterator it = begin();
88 for(; it != end(); ++it) {
89 if ((*it)->key == key)
return erase(it);
100 std::string param_key(boost::algorithm::to_lower_copy(parameter->key));
110 }
catch(std::bad_cast&) {
122 std::string param_key(boost::algorithm::to_lower_copy(parameter->key));
124 if (!nh.
getParam(param_key, vector)) {
127 ROS_DEBUG_STREAM(
"Not registered vector parameter " << param_key <<
". Using defaults.");
131 ROS_WARN_STREAM(
"Found parameter " << param_key <<
", but it's not an array!");
135 for(
int i = 0; i < vector.
size(); ++i) p.
value()[i] = vector[i];
139 }
catch(std::bad_cast&) {
145 template <
typename T>
146 std::ostream& operator<<(std::ostream& os, const std::vector<T>& vector) {
148 for(
typename std::vector<T>::const_iterator it = vector.begin(); it != vector.end(); ++it) {
149 if (it != vector.begin()) os <<
", ";
156 template <
typename T>
162 std::string param_key(boost::algorithm::to_lower_copy(parameter->key));
164 if (!nh.
getParam(param_key, vector)) {
167 ROS_DEBUG_STREAM(
"Not registered vector parameter " << param_key <<
". Using defaults.");
171 ROS_WARN_STREAM(
"Found parameter " << param_key <<
", but it's not an array!");
175 for(
int i = 0; i < vector.
size(); ++i) p.
value()[i] = vector[i];
179 }
catch(std::bad_cast&) {
213 ROS_ERROR(
"Parameter %s has unknown type %s!", parameter->key.c_str(), parameter->type());
217 for(const_iterator it = begin(); it != end(); ++it) {
219 if (parameter->empty())
continue;
220 if (parameter->isAlias())
continue;
bool operator()(const ParameterPtr ¶meter, ros::NodeHandle &nh, bool set_all=false)
ParameterPtr const & get(const std::string &key) const
Type const & getType() const
bool add(const actionlib::TwoIntsGoal &req, actionlib::TwoIntsResult &res)
bool operator()(const ParameterPtr ¶meter, ros::NodeHandle &nh, bool set_all=false)
ParameterList & add(const std::string &key, T &value, const T &default_value)
ColumnVector_< Dynamic >::type ColumnVector
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
virtual void operator()(ParameterPtr)
iterator erase(const std::string &key)
bool getParam(const std::string &key, std::string &s) const
bool operator()(const ParameterPtr ¶meter, ros::NodeHandle &nh, bool set_all=false)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const
boost::function< void(ParameterPtr)> ParameterRegisterFunc
ParameterRegistryROS(ros::NodeHandle nh)
boost::shared_ptr< Parameter > ParameterPtr
ParameterList & copy(const std::string &prefix, ParameterList const ¶meters)
void initialize(ParameterRegisterFunc func) const