36 #include <boost/algorithm/string.hpp> 37 #include <boost/utility/string_ref.hpp> 38 #include <boost/utility/string_ref.hpp> 40 #include <boost/regex.hpp> 41 #include <boost/algorithm/string/regex.hpp> 47 std::istringstream messageDescriptor(msg_def);
48 boost::match_results<std::string::const_iterator> what;
50 for (std::string line; std::getline(messageDescriptor, line,
'\n') ; )
52 std::string::const_iterator begin = line.begin(), end = line.end();
55 if (boost::regex_search( begin, end, what,
56 boost::regex(
"(^\\s*$|^\\s*#)")))
62 line.erase(line.begin(), std::find_if(line.begin(), line.end(),
63 std::not1(std::ptr_fun<int, int>(std::isspace))));
65 if( line.compare(0, 5,
"MSG: ") == 0)
84 for (
const ROSType* known_type: all_types)
const boost::string_ref & pkgName() const
ex.: geometry_msgs/Pose -> "geometry_msgs"
ROSMessage(const std::string &msg_def)
void setPkgName(boost::string_ref new_pkg)
const ROSField & field(size_t index) const
Get field by index.
const ROSType & type() const
std::vector< ROSField > _fields
A ROSMessage will contain one or more ROSField(s). Each field is little more than a name / type pair...
void updateMissingPkgNames(const std::vector< const ROSType * > &all_types)
const boost::string_ref & msgName() const
ex.: geometry_msgs/Pose -> "Pose"