Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/debug.h @ 3303

Last change on this file since 3303 was 3293, checked in by bensch, 20 years ago

orxonox/trunk: debug.h extended: COUT(debuglevel), PRINT(debuglevel) with not( linenumbers && fileName)

File size: 2.4 KB
RevLine 
[3204]1#ifndef _DEBUG_H
2#define _DEBUG_H
3
[3293]4
5///////////////////////////////////////////////////
6/// PRINTF: prints with filename and linenumber ///
7///////////////////////////////////////////////////
8
[3204]9#ifdef  DEBUG
[3205]10#define PRINTF(x) \
11           PRINTF ## x
12
13#if DEBUG >= 1
14#define PRINTF1 \
15    if (verbose >= 1 ) \
[3212]16      printf("%s:%d::", __FILE__, __LINE__) && printf
[3205]17#else
[3206]18#define PRINTF1 //
[3205]19#endif
20     
21#if DEBUG >= 2
22#define PRINTF2 \
23     if (verbose >= 2 ) \
[3212]24       printf("%s:%d::", __FILE__, __LINE__) && printf
[3206]25         
[3205]26#else
[3206]27#define PRINTF2 //
[3205]28#endif
29     
30#if DEBUG >= 3
31#define PRINTF3 \
32     if (verbose >= 3 ) \
[3212]33       printf("%s:%d::", __FILE__, __LINE__) && printf
[3205]34#else
[3206]35#define PRINTF3 //
[3205]36#endif
37     
38#if DEBUG >= 4
39#define PRINTF4 \
40     if (verbose >= 4 ) \
[3212]41       printf("%s:%d::", __FILE__, __LINE__) && printf
[3205]42#else
[3206]43#define PRINTF4 //
[3205]44#endif
45     
46     
[3204]47#else 
[3206]48#define PRINTF(x) //
[3204]49#endif
50
[3206]51#define PRINTF0 \
[3212]52    printf("%s:%d::", __FILE__, __LINE__) && printf
[3204]53
[3293]54
55
56
57///////////////////////////////////////////////////
58///  PRINT: just prints output as is            ///
59///////////////////////////////////////////////////
60
61#ifdef  DEBUG
62#define PRINT(x) \
63           PRINT ## x
64
65#if DEBUG >= 1
66#define PRINT1 \
67    if (verbose >= 1 ) \
68      printf
69#else
70#define PRINT1 //
71#endif
72     
73#if DEBUG >= 2
74#define PRINT2 \
75     if (verbose >= 2 ) \
76       printf
77
78#else
79#define PRINT2 //
80#endif
81     
82#if DEBUG >= 3
83#define PRINT3 \
84     if (verbose >= 3 ) \
85       printf
86#else
87#define PRINT3 //
88#endif
89     
90#if DEBUG >= 4
91#define PRINT4 \
92     if (verbose >= 4 ) \
93       printf
94#else
95#define PRINT4 //
96#endif
97     
98     
99#else 
100#define PRINT(x) //
101#endif
102
103#define PRINT0 \
104           printf
105
106
107///////////////////////////////////////////////////
108/// COUT: simple cout print with verbose-check  ///
109///////////////////////////////////////////////////
110#ifdef  DEBUG
111#define COUT(x) \
112           COUT ## x
113
114#if DEBUG >= 1
115#define COUT1 \
116    if (verbose >= 1 ) \
117      cout
118#else
119#define COUT1 //
120#endif
121     
122#if DEBUG >= 2
123#define COUT2 \
124     if (verbose >= 2 ) \
125       cout
126
127#else
128#define COUT2 //
129#endif
130     
131#if DEBUG >= 3
132#define COUT3 \
133     if (verbose >= 3 ) \
134       cout
135#else
136#define COUT3 //
137#endif
138     
139#if DEBUG >= 4
140#define COUT4 \
141     if (verbose >= 4 ) \
142       cout
143#else
144#define COUT4 //
145#endif
146     
147     
148#else 
149#define COUT(x) //
150#endif
151
152#define COUT0 \
153           cout
154
[3204]155#endif /* _DEBUG_H */
Note: See TracBrowser for help on using the repository browser.