debug_helper.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 #include <ros/ros.h>
21 #include <string>
22 #include <sstream>
23 #include <vector>
24 
25 namespace world_model {
26 
30 class DebugHelper {
31 
32 public:
33 
34  enum DebugLevel {
39  VIEW_PORT = 16,
41  };
42 
43 private:
44 
48  static const int NONE = 0;
49 
50  unsigned int mLevels;
51 
52 public:
53 
55 
56  static void resetInstance();
57 
63  void write(const char * text, const unsigned int &levels) const;
64 
70  void write(const std::string &text, const unsigned int &levels) const;
71 
77  void write(const std::ostream &text, const unsigned int &levels) const;
78 
84  void writeNoticeably(const char * text, const unsigned int &levels) const;
85 
91  void writeNoticeably(const std::string &text, const unsigned int &levels) const;
92 
98  void writeNoticeably(const std::ostream &text, const unsigned int &levels) const;
99 
104  unsigned int getLevel() const;
105 
110  std::string getLevelString() const;
111 
112 
116  void setLevels();
117 
118 private:
119 
120  DebugHelper();
121 
127  static int parseLevels(const std::vector<std::string> &levels);
128 
134  static void addToString(std::string& s, const std::string& add);
135 
142  bool checkLevel(const unsigned int &levels) const;
143 
149  std::string getDebugLevelString(const unsigned int &levels) const;
150 
151 };
152 
154 }
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
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
boost::shared_ptr< DebugHelper > DebugHelperPtr
The DebugHelper class is responsible for debug output.
static const int ALL
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
static const int NONE


asr_world_model
Author(s): Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Trautmann Jeremias
autogenerated on Thu Jan 9 2020 07:20:01