DebugHelper.hpp
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include <ros/ros.h>
23 #include <string>
24 #include <sstream>
25 #include <vector>
26 
28 
32 class DebugHelper {
33 
34 public:
35 
36  enum DebugLevel {
38  RATING = 2,
40  MAP = 8,
41  IK_RATING = 16
42  };
43 
44 private:
45 
47  static const int ALL = PARAMETERS
49  static const int NONE = 0;
50 
52  unsigned int mLevels;
53 
54 public:
55 
57 
63  void write(const char * text, DebugLevel level);
64 
70  void write(const std::string &text, DebugLevel level);
71 
77  void write(const std::ostream &text, DebugLevel level);
78 
84  void writeNoticeably(const char * text, DebugLevel level);
85 
91  void writeNoticeably(const std::string &text, DebugLevel level);
92 
98  void writeNoticeably(const std::ostream &text, DebugLevel level);
99 
104  unsigned int getLevel();
105 
110  std::string getLevelString();
111 
112 
117  void setLevels(std::string levelsStr);
118 
122  void setLevels();
123 
124 private:
125 
126  DebugHelper();
127 
133  static int parseLevels(std::vector<std::string> levels);
134 
140  static void addToString(std::string& s, const std::string& add);
141 
148  bool checkLevel(DebugLevel level);
149 
150 };
151 
153 }
static boost::shared_ptr< DebugHelper > instancePtr
Definition: DebugHelper.hpp:46
static boost::shared_ptr< DebugHelper > getInstance()
Definition: DebugHelper.cpp:29
boost::shared_ptr< DebugHelper > DebugHelperPtr
std::string getLevelString()
returns the debug levels that are set as string
Definition: DebugHelper.cpp:91
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...
The DebugHelper class is responsible for debug output.
Definition: DebugHelper.hpp:32
void writeNoticeably(const char *text, DebugLevel level)
writes the text noticeably to the console if it has a level that allows it
Definition: DebugHelper.cpp:61
void setLevels()
sets the allowed debug levels
this namespace contains all generally usable classes.
Definition: DebugHelper.hpp:27
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
Definition: DebugHelper.cpp:40
bool checkLevel(DebugLevel level)
checks whether the given level is allowed
unsigned int getLevel()
returns the debug level that is set
Definition: DebugHelper.cpp:86


asr_robot_model_services
Author(s): Aumann Florian, Borella Jocelyn, Heller Florian, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij
autogenerated on Mon Jun 10 2019 12:49:59