48 const char* cText = text.c_str();
50 this->
write(cText, levels);
56 std::string
s = ss.str();
58 this->
write(s, levels);
72 const char* cText = text.c_str();
81 std::string
s = ss.str();
98 std::string level =
"";
124 std::string level =
"";
149 std::vector<std::string> debugLevels;
150 mNodeHandle.
getParam(
"debugLevels", debugLevels);
152 if (debugLevels.size() == 0) {
154 std::string levelString;
155 mNodeHandle.
getParam(
"debugLevels", levelString);
157 levelString.erase(std::remove(levelString.begin(), levelString.end(),
'['), levelString.end());
158 levelString.erase(std::remove(levelString.begin(), levelString.end(),
']'), levelString.end());
159 levelString.erase(std::remove(levelString.begin(), levelString.end(),
' '), levelString.end());
161 std::stringstream ss(levelString);
163 while (std::getline(ss, item,
',')) {
164 debugLevels.push_back(item);
172 if (levels.size() == 0)
174 if (levels.size() == 1) {
175 if (levels.at(0).compare(
"ALL") == 0)
177 if (levels.at(0).compare(
"NONE") == 0)
182 for (
unsigned int i = 0; i < levels.size(); ++i) {
183 if (levels.at(i).compare(
"PARAMETERS") == 0) {
186 else if (levels.at(i).compare(
"SERVICE_CALLS") == 0) {
189 else if (levels.at(i).compare(
"COMMON_INFORMATION") == 0) {
192 else if (levels.at(i).compare(
"FOUND_OBJECT") == 0) {
195 else if (levels.at(i).compare(
"VIEW_PORT") == 0) {
198 else if (levels.at(i).compare(
"COMPLETE_PATTERN") == 0) {
203 throw "Invalid debug level";
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...
static boost::shared_ptr< DebugHelper > instancePtr
bool checkLevel(const unsigned int &levels) const
checks whether the given level is allowed
std::string getDebugLevelString(const unsigned int &levels) const
returns the name of the given DebugLevel
unsigned int getLevel() const
returns the debug level that is set
ROSCPP_DECL const std::string & getName()
void setLevels()
sets the allowed debug levels
static boost::shared_ptr< DebugHelper > getInstance()
static int parseLevels(const std::vector< std::string > &levels)
parses the level list to the corresponding integer
void write(const char *text, const unsigned int &levels) const
writes the text to the console if it has a level that allows it
#define ROS_DEBUG_STREAM(args)
static void resetInstance()
void writeNoticeably(const char *text, const unsigned int &levels) const
writes the text noticeably to the console if it has a level that allows it
std::string getLevelString() const
returns the debug levels that are set as string
bool getParam(const std::string &key, std::string &s) const
#define ROS_ERROR_STREAM(args)