Chris@67: Chris@67: #ifndef DEBUG_H_INCLUDED Chris@67: #define DEBUG_H_INCLUDED Chris@67: Chris@67: #include Chris@67: #include Chris@67: Chris@67: class MyDebug Chris@67: { Chris@67: public: Chris@67: MyDebug() : want(std::getenv("VAMPY_VERBOSE") != 0) { } Chris@67: Chris@67: template Chris@67: MyDebug &operator<<(const T &t) { Chris@67: if (want) std::cerr << t; Chris@67: return *this; Chris@67: } Chris@67: Chris@67: MyDebug &operator<<(std::ostream &(*o)(std::ostream &)) { Chris@67: if (want) std::cerr << o; Chris@67: return *this; Chris@67: } Chris@67: Chris@67: private: Chris@67: bool want; Chris@67: }; Chris@67: Chris@67: #define DSTREAM (MyDebug()) Chris@67: Chris@67: #endif