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";
153 std::vector<std::string> levels;
154 boost::trim_if(levelsStr, boost::is_any_of(
"\"',[]{} "));
155 boost::split(levels, levelsStr, boost::is_any_of(
", "), boost::token_compress_on);
157 for (
int i : boost::irange(0, (
int) levels.size())) {
158 boost::trim_if(levels[i], boost::is_any_of(
"\"',[]{} "));
159 boost::to_upper(levels[i]);
165 if (levels.size() == 0)
167 if (levels.size() == 1) {
168 if (levels.at(0).compare(
"ALL") == 0)
170 if (levels.at(0).compare(
"NONE") == 0)
175 for (
unsigned int i = 0; i < levels.size(); i++) {
176 if (levels.at(i).compare(
"PARAMETERS") == 0) {
179 else if (levels.at(i).compare(
"SERVICE_CALLS") == 0) {
182 else if (levels.at(i).compare(
"VISUALIZATION") == 0) {
185 else if (levels.at(i).compare(
"CALCULATION") == 0) {
188 else if (levels.at(i).compare(
"RATING") == 0) {
191 else if (levels.at(i).compare(
"ROBOT_MODEL") == 0) {
194 else if (levels.at(i).compare(
"MAP") == 0) {
197 else if (levels.at(i).compare(
"FILTER") == 0) {
200 else if (levels.at(i).compare(
"IK_RATING") == 0) {
203 else if (levels.at(i).compare(
"SPACE_SAMPLER") == 0) {
206 else if (levels.at(i).compare(
"HYPOTHESIS_UPDATER") == 0) {
209 else if (levels.at(i).compare(
"WORLD") == 0) {
212 else if (levels.at(i).compare(
"VOXEL_GRID") == 0) {
217 throw "Invalid debug level";
ros::NodeHandle mNodeHandle
std::string getLevelString()
returns the debug levels that are set as string
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
this namespace contains all generally usable classes.
void writeNoticeably(const char *text, DebugLevel level)
writes the text noticeably to the console if it has a level that allows it
static boost::shared_ptr< DebugHelper > getInstance()
void setLevels()
sets the allowed debug levels
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...
bool getParam(const std::string &key, std::string &s) const
#define ROS_ERROR_STREAM(args)
static boost::shared_ptr< DebugHelper > instancePtr
unsigned int getLevel()
returns the debug level that is set
static int parseLevels(std::vector< std::string > levels)
parses the level list to the corresponding integer