camera_common.cpp
Go to the documentation of this file.
00001 #include "image_transport/camera_common.h"
00002 #include <boost/algorithm/string/classification.hpp>
00003 #include <boost/algorithm/string/split.hpp>
00004 #include <boost/algorithm/string/join.hpp>
00005 #include <vector>
00006 
00007 namespace image_transport {
00008 
00009 std::string getCameraInfoTopic(const std::string& base_topic)
00010 {
00011   // Split into separate names
00012   std::vector<std::string> names;
00013   boost::algorithm::split(names, base_topic, boost::algorithm::is_any_of("/"),
00014                           boost::algorithm::token_compress_on);
00015   // Get rid of empty tokens from trailing slashes
00016   while (names.back().empty())
00017     names.pop_back();
00018   // Replace image name with "camera_info"
00019   names.back() = "camera_info";
00020   // Join back together into topic name
00021   return boost::algorithm::join(names, "/");
00022 }
00023 
00024 } //namespace image_transport


image_transport
Author(s): Patrick Mihelich
autogenerated on Fri Jan 3 2014 11:24:08