13
0
livetrax/libs/audiographer/audiographer/debuggable.h
Sakari Bergen 8da27200d1 - Fix process callbakc handling during export
- Fix filename handling when exporting multiple files
- Some updates to audiographer


git-svn-id: svn://localhost/ardour2/branches/3.0@6402 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-12-27 22:09:40 +00:00

47 lines
935 B
C++

#ifndef AUDIOGRAPHER_DEBUGGABLE_H
#define AUDIOGRAPHER_DEBUGGABLE_H
#ifndef DEFAULT_DEBUG_LEVEL
#define DEFAULT_DEBUG_LEVEL DebugNone
#endif
#include <iostream>
namespace AudioGrapher
{
enum DebugLevel
{
DebugNone, //< Disabled
DebugObject, //< Object level stuff, ctors, initalizers etc.
DebugProcess, //< Process cycle level stuff
DebugVerbose, //< Lots of output, not on sample level
DebugSample //< Sample level stuff
};
/// Class that allows optimizing out debugging code during compile time
template<DebugLevel L = DEFAULT_DEBUG_LEVEL>
class Debuggable
{
protected:
Debuggable(std::ostream & debug_stream = std::cerr)
: stream (debug_stream) {}
bool debug_level (DebugLevel level) {
#ifdef NDEBUG
return false;
#else
return L >= level;
#endif
}
std::ostream & debug_stream() { return stream; }
private:
std::ostream & stream;
};
} // namespace
#endif // AUDIOGRAPHER_DEBUGGABLE_H