00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ESTAR_PDEBUG_HPP
00022 #define ESTAR_PDEBUG_HPP
00023
00050 #include <string>
00051 #include <stdio.h>
00052
00053 #define PDEBUG_ERR(fmt, arg...) fprintf(stderr, "%s(): "fmt, __func__, ## arg)
00054 #define PDEBUG_OUT(fmt, arg...) fprintf(stdout, "%s(): "fmt, __func__, ## arg)
00055 #define PDEBUG_OFF(fmt, arg...)
00056
00057 #ifdef ESTAR_VERBOSE_DEBUG
00058 # define ESTAR_DEBUG
00059 # define PVDEBUG PDEBUG_OUT
00060 #else
00061 # define PVDEBUG PDEBUG_OFF
00062 #endif
00063
00064 #ifdef ESTAR_DEBUG
00065 # include <sstream>
00066 # define PDEBUG PDEBUG_OUT
00067 #else
00068 # define PDEBUG PDEBUG_OFF
00069 #endif
00070
00071 namespace estar {
00072
00078 class fakeos {
00079 public:
00080 template<class Foo>
00081 fakeos & operator << (const Foo &) { return * this; }
00082 std::string str() const { return std::string(); }
00083 };
00084
00085 #ifdef ESTAR_VERBOSE_DEBUG
00086 typedef std::ostringstream vdebugos;
00087 #else
00088 typedef fakeos vdebugos;
00089 #endif
00090
00091 #ifdef ESTAR_DEBUG
00092 typedef std::ostringstream debugos;
00093 #else
00094 typedef fakeos debugos;
00095 #endif
00096
00097 }
00098
00099 #endif // ESTAR_PDEBUG_HPP