-
Notifications
You must be signed in to change notification settings - Fork 0
/
Debug.h
35 lines (29 loc) · 868 Bytes
/
Debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Utility debugging functions.
*
* @author Francis BISSON
*/
#ifndef DEBUG_H
#define DEBUG_H
// MACRO DEFINITIONS ///////////////////////////////////////////////////////////
#ifdef NDEBUG
# define DEBUG_ASSERT(cond)
# define DEBUG_ASSERT2(cond, msg)
# define TRACE(msg)
#else
# include <iostream>
# define DEBUG_ASSERT(cond) Debug::Assert2(cond, #cond, __FILE__, __LINE__)
# define DEBUG_ASSERT2(cond, msg) Debug::Assert2(cond, msg, __FILE__, __LINE__)
# define TRACE(msg) (std::cerr << msg << std::endl)
// CLASS DEFINITION ////////////////////////////////////////////////////////////
class Debug
{
private:
Debug();
~Debug();
public:
static void Assert(bool condition, const char* file, int line);
static void Assert2(bool condition, std::string message, const char* file, int line);
};
#endif
#endif // DEBUG_H