51 #if ROS_VERSION_MINIMUM(1, 12, 0) 54 #else //#if ROS_VERSION_MINIMUM(1, 12, 0) 57 #endif //#if ROS_VERSION_MINIMUM(1, 12, 0) 64 bool &value,
const bool print_default)
const {
77 std::string &value,
const bool print_default)
const {
83 loadSub(name, value, print_default, result);
90 std::string &value,
const bool print_default)
const {
93 std::string value_resolved;
98 if (value_resolved == value) {
99 loadSub(name, value, print_default, result);
101 loadSub(name, value +
" == " + value_resolved, print_default, result);
102 value = value_resolved;
110 std::string &value,
const bool print_default)
const {
117 loadSub(name, value, print_default, result);
124 int &value,
const bool print_default)
const {
130 std::stringstream value_s;
132 loadSub(name, value_s.str(), print_default, result);
139 double &value,
const bool print_default)
const {
145 std::stringstream value_s;
147 loadSub(name, value_s.str(), print_default, result);
154 std::vector<bool> &value,
const bool print_default)
const {
158 std::vector<bool> value_temp;
160 if (result) {value = value_temp;}
162 std::stringstream value_s;
164 if (value.size() > 0) {
166 for (
int i = 1; i < value.size(); i++) {
171 loadSub(name, value_s.str(), print_default, result);
178 std::vector<std::string> &value,
const bool print_default)
const {
182 std::vector<std::string> value_temp;
184 if (result) {value = value_temp;}
186 std::stringstream value_s;
188 if (value.size() > 0) {
190 for (
int i = 1; i < value.size(); i++) {
191 value_s <<
", " << value[i];
195 loadSub(name, value_s.str(), print_default, result);
202 std::vector<int> &value,
const bool print_default)
const {
206 std::vector<int> value_temp;
208 if (result) {value = value_temp;}
210 std::stringstream value_s;
212 if (value.size() > 0) {
214 for (
int i = 1; i < value.size(); i++) {
215 value_s <<
", " << value[i];
219 loadSub(name, value_s.str(), print_default, result);
226 std::vector<double> &value,
const bool print_default)
const {
230 std::vector<double> value_temp;
232 if (result) {value = value_temp;}
234 std::stringstream value_s;
236 if (value.size() > 0) {
238 for (
int i = 1; i < value.size(); i++) {
239 value_s <<
", " << value[i];
243 loadSub(name, value_s.str(), print_default, result);
250 Eigen::MatrixXf &value,
const bool print_default)
const {
264 for (
int y = 0; y < xml.
size(); y++) {
267 (xml[y].
size() < 1)) {
274 mat.resize((
int) xml.
size(),(int) xml[y].size());
275 }
else if (xml[y].size() != mat.cols()){
280 for (
int x = 0; x < xml[y].
size(); x++) {
281 if (result ==
false) {
break;}
283 switch (xml[y][x].getType()) {
285 mat(y,x) = (double) xml[y][x];
288 mat(y,x) = (int) xml[y][x];
296 if (result ==
false) {
302 if (result) {value = mat;}
304 std::stringstream value_s;
306 for (
int y = 0; y < value.rows(); y++) {
307 if (y > 0) { value_s <<
", ";}
309 for (
int x = 0; x < value.cols(); x++) {
310 if (x > 0) { value_s <<
", ";}
311 value_s << value(y,x);
318 value_s << std::endl <<
"Vergleich:" << std::endl << value;
320 loadSub(name, value_s.str(), print_default, result);
330 std::string::size_type
start;
331 start = (int) path.find(
"$(find ");
332 if ((start < 0) || (start >= path.length())) {
return true;}
334 std::string::size_type end;
335 end = path.find(
")", (std::string::size_type) start);
336 if ((end < 0) || (end >= path.length())) {
return false;}
342 path.substr(start + 2, end - start - 2));
343 }
catch (std::runtime_error &e) {
346 if (replace ==
"") {
return false;}
349 std::string::size_type pos_save = 0;
350 std::string::size_type pos_current;
351 for (pos_current = 0; pos_current < replace.length(); pos_current++) {
353 c = replace[pos_current];
355 if ((c ==
'\r') || (c ==
'\n') || (c ==
' ') || (c ==
'\t')) {
359 if (pos_save != pos_current) {
360 replace[pos_save] = c;
364 if (pos_save != replace.length()) {
365 replace.resize(pos_save);
369 path = path.substr(0,start) + replace + path.substr(end + 1);
376 if (name ==
"") {
return "";}
378 bool full_path =
false;
379 bool end_with_slash = name[name.length()-1] ==
'/';
386 if (parts.front() ==
"" ) {
389 }
else if (parts.front() ==
"." ) {
390 parts.front() =
"..";
391 parts.push_front(
"~");
394 std::list<std::string>::iterator iter = parts.begin();
395 while (iter != parts.end()) {
398 if (((parts.front() ==
"~") || (parts.front() ==
"")) &&
399 (full_path ==
false)) {
404 std::list<std::string>::iterator iter_temp = temp.end();
410 if (parts.front() !=
"~") {
417 for ( ; iter_temp != temp.end(); iter_temp--) {
418 parts.push_front(*iter_temp);
423 iter = parts.begin();
428 if ((*iter ==
"") or (*iter ==
".")) {
429 iter = parts.erase(iter);
435 if (iter == parts.begin()) {
439 iter = parts.erase(iter);
443 parts.push_front(
"");
449 iter = parts.erase(iter);
450 iter = parts.erase(iter);
459 if (full_path) { result =
"/";}
461 if (parts.size() > 0) {
462 result+= parts.front();
464 for (iter = ++parts.begin() ; iter != parts.end(); iter++) {
469 if (end_with_slash && (parts.size() > 0)) {
490 std::string &value,
const bool print_default)
const {
492 return loadTopic(name, value, print_default);
497 std::string &value,
const bool print_default)
const {
499 return loadPath(name, value, print_default);
523 const bool p,
const bool r)
const {
528 result =
"load parameter " + n +
" (" + v +
")";
530 result =
"parameter " + n +
" not set";
533 result+=
" (defaults to " + v +
")";
542 const std::string name) {
544 std::list<std::string> result;
546 std::string::size_type pos = 0;
548 while(pos < name.length()) {
550 std::string::size_type end;
551 end = (int) name.find(
"/", pos);
553 if ((end < 0) || (end > name.length())) {
558 result.push_back(name.substr(pos, end - pos));
560 result.push_back(
"");
bool loadPath(const std::string name, std::string &value, const bool print_default=true) const
bool load_path(const std::string name, std::string &value, const bool print_default=true) const
ROSCPP_DECL std::string resolve(const std::string &name, bool remap=true)
Type const & getType() const
bool loadTopic(const std::string name, std::string &value, const bool print_default=true) const
bool load_topic(const std::string name, std::string &value, const bool print_default=true) const
deprecated function names, just for compatibility
bool load(const std::string name, bool &value, const bool print_default=true) const
static bool replaceFindpack(std::string &path)
static std::list< std::string > splitRessourcename(const std::string name)
ROSLIB_DECL std::string command(const std::string &cmd)
static void resolve_ressourcename(std::string &name)
static std::string boolToStr(const bool value)
static std::string resolveRessourcename(const std::string name)
void loadSub(const std::string &n, const std::string &v, const bool p, const bool r) const
private functions
#define ROS_INFO_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
static bool replace_findpack(std::string &path)
static std::string bool_to_str(const bool value)