param.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*
3  * Copyright (C) 2009, Willow Garage, Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the names of Willow Garage, Inc. nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef ROSCPP_PARAM_H
30 #define ROSCPP_PARAM_H
31 
32 #include "forwards.h"
33 #include "common.h"
34 #include "xmlrpcpp/XmlRpcValue.h"
35 
36 #include <vector>
37 #include <map>
38 
39 namespace roswrap
40 {
41 
45 namespace param
46 {
47 
54 ROSCPP_DECL void set(const std::string& key, const XmlRpc::XmlRpcValue& v);
61 ROSCPP_DECL void set(const std::string& key, const std::string& s);
68 ROSCPP_DECL void set(const std::string& key, const char* s);
75 ROSCPP_DECL void set(const std::string& key, double d);
82 ROSCPP_DECL void set(const std::string& key, int i);
89 ROSCPP_DECL void set(const std::string& key, bool b);
90 
91 
98 ROSCPP_DECL void set(const std::string& key, const std::vector<std::string>& vec);
105 ROSCPP_DECL void set(const std::string& key, const std::vector<double>& vec);
112 ROSCPP_DECL void set(const std::string& key, const std::vector<float>& vec);
119 ROSCPP_DECL void set(const std::string& key, const std::vector<int>& vec);
126 ROSCPP_DECL void set(const std::string& key, const std::vector<bool>& vec);
127 
134 ROSCPP_DECL void set(const std::string& key, const std::map<std::string, std::string>& map);
141 ROSCPP_DECL void set(const std::string& key, const std::map<std::string, double>& map);
148 ROSCPP_DECL void set(const std::string& key, const std::map<std::string, float>& map);
155 ROSCPP_DECL void set(const std::string& key, const std::map<std::string, int>& map);
162 ROSCPP_DECL void set(const std::string& key, const std::map<std::string, bool>& map);
163 
164 
173 ROSCPP_DECL bool get(const std::string& key, std::string& s);
182 ROSCPP_DECL bool get(const std::string& key, double& d);
191 ROSCPP_DECL bool get(const std::string& key, float& f);
200 ROSCPP_DECL bool get(const std::string& key, int& i);
209 ROSCPP_DECL bool get(const std::string& key, bool& b);
218 ROSCPP_DECL bool get(const std::string& key, XmlRpc::XmlRpcValue& v);
219 
233 ROSCPP_DECL bool getCached(const std::string& key, std::string& s);
247 ROSCPP_DECL bool getCached(const std::string& key, double& d);
261 ROSCPP_DECL bool getCached(const std::string& key, float& f);
275 ROSCPP_DECL bool getCached(const std::string& key, int& i);
289 ROSCPP_DECL bool getCached(const std::string& key, bool& b);
303 ROSCPP_DECL bool getCached(const std::string& key, XmlRpc::XmlRpcValue& v);
304 
313 ROSCPP_DECL bool get(const std::string& key, std::vector<std::string>& vec);
322 ROSCPP_DECL bool get(const std::string& key, std::vector<double>& vec);
331 ROSCPP_DECL bool get(const std::string& key, std::vector<float>& vec);
340 ROSCPP_DECL bool get(const std::string& key, std::vector<int>& vec);
349 ROSCPP_DECL bool get(const std::string& key, std::vector<bool>& vec);
350 
364 ROSCPP_DECL bool getCached(const std::string& key, std::vector<std::string>& vec);
378 ROSCPP_DECL bool getCached(const std::string& key, std::vector<double>& vec);
392 ROSCPP_DECL bool getCached(const std::string& key, std::vector<float>& vec);
406 ROSCPP_DECL bool getCached(const std::string& key, std::vector<int>& vec);
420 ROSCPP_DECL bool getCached(const std::string& key, std::vector<bool>& vec);
421 
430 ROSCPP_DECL bool get(const std::string& key, std::map<std::string, std::string>& map);
439 ROSCPP_DECL bool get(const std::string& key, std::map<std::string, double>& map);
448 ROSCPP_DECL bool get(const std::string& key, std::map<std::string, float>& map);
457 ROSCPP_DECL bool get(const std::string& key, std::map<std::string, int>& map);
466 ROSCPP_DECL bool get(const std::string& key, std::map<std::string, bool>& map);
467 
481 ROSCPP_DECL bool getCached(const std::string& key, std::map<std::string, std::string>& map);
495 ROSCPP_DECL bool getCached(const std::string& key, std::map<std::string, double>& map);
509 ROSCPP_DECL bool getCached(const std::string& key, std::map<std::string, float>& map);
523 ROSCPP_DECL bool getCached(const std::string& key, std::map<std::string, int>& map);
537 ROSCPP_DECL bool getCached(const std::string& key, std::map<std::string, bool>& map);
538 
546 ROSCPP_DECL bool has(const std::string& key);
554 ROSCPP_DECL bool del(const std::string& key);
555 
570 ROSCPP_DECL bool search(const std::string& ns, const std::string& key, std::string& result);
571 
586 ROSCPP_DECL bool search(const std::string& key, std::string& result);
587 
593 ROSCPP_DECL bool getParamNames(std::vector<std::string>& keys);
594 
608 template<typename T>
609 bool param(const std::string& param_name, T& param_val, const T& default_val)
610 {
611  if (has(param_name))
612  {
613  if (get(param_name, param_val))
614  {
615  return true;
616  }
617  }
618 
619  param_val = default_val;
620  return false;
621 }
622 
640 template<typename T>
641 T param(const std::string& param_name, const T& default_val)
642 {
643  T param_val;
644  param(param_name, param_val, default_val);
645  return param_val;
646 }
647 
648 } // namespace param
649 
650 } // namespace roswrap
651 
652 #endif // ROSCPP_PARAM_H
roswrap::param::has
bool has(const std::string &key)
Check whether a parameter exists on the parameter server.
Definition: param_modi.cpp:210
forwards.h
roswrap::param::get
bool get(const std::string &key, std::string &s)
Get a string value from the parameter server.
Definition: param_modi.cpp:414
s
XmlRpcServer s
sick_ldmrs_driver::param
bool param(rosNodePtr node, const std::string &param_name, T &value, const T &default_value)
Definition: sick_ldmrs_config.hpp:71
roswrap::param::getCached
bool getCached(const std::string &key, std::string &s)
Get a string value from the parameter server, with local caching.
Definition: param_modi.cpp:444
roswrap::param::set
void set(const std::string &key, const XmlRpc::XmlRpcValue &v)
Set an arbitrary XML/RPC value on the parameter server.
Definition: param_modi.cpp:66
roswrap::param::del
bool del(const std::string &key)
Delete a parameter from the parameter server.
Definition: param_modi.cpp:227
f
f
d
d
roswrap
Definition: param_modi.cpp:41
roswrap::param::search
bool search(const std::string &key, std::string &result_out)
Search up the tree for a parameter with a given key. This version defaults to starting in the current...
Definition: param_modi.cpp:752
common.h
sick_scan_base.h
roswrap::param::getParamNames
bool getParamNames(std::vector< std::string > &keys)
Get the list of all the parameters in the server.
Definition: param_modi.cpp:722
ROSCPP_DECL
#define ROSCPP_DECL
Definition: roswrap/src/cfgsimu/sick_scan/ros/common.h:63
roswrap::param::param
bool param(const std::string &param_name, T &param_val, const T &default_val)
Assign value from parameter server, with default.
Definition: param_modi.h:609
XmlRpc::XmlRpcValue
RPC method arguments and results are represented by Values.
Definition: XmlRpcValue.h:25


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:09