20 #include <boost/algorithm/string.hpp> 21 #include <boost/range/irange.hpp> 48 const char* cText = text.c_str();
50 this->
write(cText, level);
56 std::string
s = ss.str();
58 this->
write(s, level);
72 const char* cText = text.c_str();
81 std::string
s = ss.str();
98 std::string level =
"";
101 level +=
"PARAMETERS";
123 std::vector<std::string> levels;
129 std::vector<std::string> levels;
130 boost::trim_if(levelsStr, boost::is_any_of(
"\"',[]{} "));
131 boost::split(levels, levelsStr, boost::is_any_of(
", "), boost::token_compress_on);
133 for (
int i : boost::irange(0, (
int) levels.size())) {
134 boost::trim_if(levels[i], boost::is_any_of(
"\"',[]{} "));
135 boost::to_upper(levels[i]);
141 if (levels.size() == 0)
143 if (levels.size() == 1) {
144 if (levels.at(0).compare(
"ALL") == 0)
146 if (levels.at(0).compare(
"NONE") == 0)
152 for (
unsigned int i = 0; i < levels.size(); i++) {
153 if (levels.at(i).compare(
"PARAMETERS") == 0) {
156 else if (levels.at(i).compare(
"RATING") == 0) {
159 else if (levels.at(i).compare(
"ROBOT_MODEL") == 0) {
162 else if (levels.at(i).compare(
"MAP") == 0) {
165 else if (levels.at(i).compare(
"IK_RATING") == 0) {
170 throw "Invalid debug level";
static boost::shared_ptr< DebugHelper > instancePtr
static boost::shared_ptr< DebugHelper > getInstance()
ROSCPP_DECL const std::string & getName()
std::string getLevelString()
returns the debug levels that are set as string
static void addToString(std::string &s, const std::string &add)
adds a string to a given string s. Puts a comma between them if the string s has a size bigger than 0...
void writeNoticeably(const char *text, DebugLevel level)
writes the text noticeably to the console if it has a level that allows it
void setLevels()
sets the allowed debug levels
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
this namespace contains all generally usable classes.
static int parseLevels(std::vector< std::string > levels)
parses the level list to the corresponding integer
void write(const char *text, DebugLevel level)
writes the text to the console if it has a level that allows it
bool checkLevel(DebugLevel level)
checks whether the given level is allowed
unsigned int getLevel()
returns the debug level that is set
#define ROS_ERROR_STREAM(args)
ros::NodeHandle mNodeHandle