00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00039 #ifndef GRAPH_MAPPING_UTILS_TO_STRING_H
00040 #define GRAPH_MAPPING_UTILS_TO_STRING_H
00041
00042 #include <geometry_msgs/Pose.h>
00043 #include <geometry_msgs/Pose2D.h>
00044 #include <geometry_msgs/Point.h>
00045 #include <string>
00046 #include <boost/format.hpp>
00047 #include <boost/lexical_cast.hpp>
00048 #include <iostream>
00049 #include <set>
00050 #include <numeric>
00051 #include <tf/transform_datatypes.h>
00052
00053 namespace graph_mapping_utils
00054 {
00055
00056 namespace gm=geometry_msgs;
00057
00058 using std::string;
00059 using boost::format;
00060
00061 string toString (const gm::Pose2D& pose);
00062
00063 string toString (const gm::Point& p);
00064
00065 string toString2D (const gm::Pose& pose);
00066 string toString2D (const tf::Pose& pose);
00067
00068 string toString (const gm::Pose& pose);
00069
00070
00071 template <class T>
00072 std::string concatenate (const std::string& s, const T& x)
00073 {
00074 return s + std::string(" ") + boost::lexical_cast<std::string>(x);
00075 }
00076
00077
00078 template <class T>
00079 std::string toString (const std::set<T>& set)
00080 {
00081 const std::string s = std::accumulate(set.begin(), set.end(), std::string(""), concatenate<T>);
00082 return std::string("[") + s + std::string("]");
00083 }
00084
00085 template <class T>
00086 std::string toString (const std::vector<T>& v)
00087 {
00088 const std::string s = std::accumulate(v.begin(), v.end(), std::string(""), concatenate<T>);
00089 return std::string("[") + s + std::string("]");
00090 }
00091
00092 std::string toString (const btTransform& t);
00093 std::string toString (const btVector3& v);
00094 std::string toString (const btQuaternion& q);
00095
00096 }
00097
00098 #endif // include guard