annotate Debug.h @ 83:ef4989f33648

Remove unreachable code
author Chris Cannam
date Thu, 10 Jan 2019 15:36:13 +0000
parents 146d14ab15e7
children
rev   line source
Chris@67 1
Chris@67 2 #ifndef DEBUG_H_INCLUDED
Chris@67 3 #define DEBUG_H_INCLUDED
Chris@67 4
Chris@67 5 #include <iostream>
Chris@67 6 #include <cstdlib>
Chris@67 7
Chris@67 8 class MyDebug
Chris@67 9 {
Chris@67 10 public:
Chris@67 11 MyDebug() : want(std::getenv("VAMPY_VERBOSE") != 0) { }
Chris@67 12
Chris@67 13 template <typename T>
Chris@67 14 MyDebug &operator<<(const T &t) {
Chris@67 15 if (want) std::cerr << t;
Chris@67 16 return *this;
Chris@67 17 }
Chris@67 18
Chris@67 19 MyDebug &operator<<(std::ostream &(*o)(std::ostream &)) {
Chris@67 20 if (want) std::cerr << o;
Chris@67 21 return *this;
Chris@67 22 }
Chris@67 23
Chris@67 24 private:
Chris@67 25 bool want;
Chris@67 26 };
Chris@67 27
Chris@67 28 #define DSTREAM (MyDebug())
Chris@67 29
Chris@67 30 #endif