X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2FKM_error.h;h=2d3513a6c62d0483006ea2020311d662ca688be4;hb=57ddb7894042229bbc5f14e9257068afcc6f8725;hp=ed171be988e94c3b30f5ca17539a3cb58efa8a4e;hpb=4e83acbf365d9b87dfdc95aef5c46785b33d2269;p=asdcplib.git diff --git a/src/KM_error.h b/src/KM_error.h index ed171be..2d3513a 100755 --- a/src/KM_error.h +++ b/src/KM_error.h @@ -55,13 +55,13 @@ namespace Kumu inline bool operator==(const Result_t& rhs) const { return value == rhs.value; } inline bool operator!=(const Result_t& rhs) const { return value != rhs.value; } - inline bool Success() { return ( value >= 0 ); } - inline bool Failure() { return ( value < 0 ); } + inline bool Success() const { return ( value >= 0 ); } + inline bool Failure() const { return ( value < 0 ); } - inline long Value() { return value; } + inline long Value() const { return value; } inline operator long() const { return value; } - inline const char* Label() { return label; } + inline const char* Label() const { return label; } inline operator const char*() const { return label; } }; @@ -114,6 +114,35 @@ namespace Kumu return Kumu::RESULT_NULL_STR; \ } +namespace Kumu +{ + // simple tracing mechanism + class DTrace_t + { + DTrace_t(); + + protected: + const char* m_Label; + Result_t* m_Watch; + int m_Line; + const char* m_File; + int m_Sequence; + + public: + DTrace_t(const char* Label, Result_t* Watch, int Line, const char* File); + ~DTrace_t(); + }; +} + +#ifdef KM_TRACE +#define WDTRACE(l) DTrace_t __wl__Trace__((l), 0, __LINE__, __FILE__) +#define WDTRACER(l,r) DTrace_t __wl__Trace__((l), &(r), __LINE__, __FILE__) +#else +#define WDTRACE(l) +#define WDTRACER(l,r) +#endif + + #endif // _KM_ERROR_H_ //