node_utils.h
Go to the documentation of this file.
1 // Test utils for nodes
2 // Author: Max Schwarz <max.schwarz@ais.uni-bonn.de>
3 
4 #ifndef NODE_UTILS_H
5 #define NODE_UTILS_H
6 
7 #include <catch_ros/catch.hpp>
8 
9 #include "../../src/launch/node.h"
10 
11 namespace Catch
12 {
13  template<>
14  struct StringMaker<rosmon::launch::Node::Ptr>
15  {
16  static std::string convert(const rosmon::launch::Node::Ptr& node)
17  {
18  if(node)
19  return "NodePtr(name='" + node->name() + "', namespace='" + node->namespaceString() + "')";
20  else
21  return "NodePtr()";
22  }
23  };
24 
25  template<>
26  struct StringMaker<std::vector<rosmon::launch::Node::Ptr>>
27  {
28  static std::string convert(const std::vector<rosmon::launch::Node::Ptr>& nodes)
29  {
30  std::stringstream ss;
31  ss << "{ ";
32  for(auto& n : nodes)
33  ss << StringMaker<rosmon::launch::Node::Ptr>::convert(n) << ", ";
34  ss << "}";
35 
36  return ss.str();
37  }
38  };
39 }
40 
41 std::string printMapping(const std::map<std::string, std::string>& mapping);
42 
43 rosmon::launch::Node::Ptr getNode(const std::vector<rosmon::launch::Node::Ptr>& nodes, const std::string& name, const std::string& namespaceString="");
44 
45 #endif
static std::string convert(const std::vector< rosmon::launch::Node::Ptr > &nodes)
Definition: node_utils.h:28
std::shared_ptr< Node > Ptr
Definition: node.h:23
rosmon::launch::Node::Ptr getNode(const std::vector< rosmon::launch::Node::Ptr > &nodes, const std::string &name, const std::string &namespaceString="")
Definition: node_utils.cpp:23
static std::string convert(const rosmon::launch::Node::Ptr &node)
Definition: node_utils.h:16
std::string printMapping(const std::map< std::string, std::string > &mapping)
Definition: node_utils.cpp:10


rosmon_core
Author(s): Max Schwarz
autogenerated on Wed Jul 10 2019 03:10:12