[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / bullet3 / src / Bullet3Common / b3Logging.h
1
2 #ifndef B3_LOGGING_H
3 #define B3_LOGGING_H
4
5 #ifdef __cplusplus
6 extern "C"
7 {
8 #endif
9
10 ///We add the do/while so that the statement "if (condition) b3Printf("test"); else {...}" would fail
11 ///You can also customize the message by uncommenting out a different line below
12 #define b3Printf(...) b3OutputPrintfVarArgsInternal(__VA_ARGS__)
13         //#define b3Printf(...) do {b3OutputPrintfVarArgsInternal("b3Printf[%s,%d]:",__FILE__,__LINE__);b3OutputPrintfVarArgsInternal(__VA_ARGS__); } while(0)
14         //#define b3Printf b3OutputPrintfVarArgsInternal
15         //#define b3Printf(...) printf(__VA_ARGS__)
16         //#define b3Printf(...)
17 #define b3Warning(...) do{      b3OutputWarningMessageVarArgsInternal("b3Warning[%s,%d]:\n", __FILE__, __LINE__);b3OutputWarningMessageVarArgsInternal(__VA_ARGS__);} while (0)
18 #define b3Error(...)do  {b3OutputErrorMessageVarArgsInternal("b3Error[%s,%d]:\n", __FILE__, __LINE__);b3OutputErrorMessageVarArgsInternal(__VA_ARGS__);} while (0)
19 #ifndef B3_NO_PROFILE
20
21         void b3EnterProfileZone(const char* name);
22         void b3LeaveProfileZone();
23 #ifdef __cplusplus
24
25         class b3ProfileZone
26         {
27         public:
28                 b3ProfileZone(const char* name)
29                 {
30                         b3EnterProfileZone(name);
31                 }
32
33                 ~b3ProfileZone()
34                 {
35                         b3LeaveProfileZone();
36                 }
37         };
38
39 #define B3_PROFILE(name) b3ProfileZone __profile(name)
40 #endif
41
42 #else  //B3_NO_PROFILE
43
44 #define B3_PROFILE(name)
45 #define b3StartProfile(a)
46 #define b3StopProfile
47
48 #endif  //#ifndef B3_NO_PROFILE
49
50         typedef void(b3PrintfFunc)(const char* msg);
51         typedef void(b3WarningMessageFunc)(const char* msg);
52         typedef void(b3ErrorMessageFunc)(const char* msg);
53         typedef void(b3EnterProfileZoneFunc)(const char* msg);
54         typedef void(b3LeaveProfileZoneFunc)();
55
56         ///The developer can route b3Printf output using their own implementation
57         void b3SetCustomPrintfFunc(b3PrintfFunc* printfFunc);
58         void b3SetCustomWarningMessageFunc(b3WarningMessageFunc* warningMsgFunc);
59         void b3SetCustomErrorMessageFunc(b3ErrorMessageFunc* errorMsgFunc);
60
61         ///Set custom profile zone functions (zones can be nested)
62         void b3SetCustomEnterProfileZoneFunc(b3EnterProfileZoneFunc* enterFunc);
63         void b3SetCustomLeaveProfileZoneFunc(b3LeaveProfileZoneFunc* leaveFunc);
64
65         ///Don't use those internal functions directly, use the b3Printf or b3SetCustomPrintfFunc instead (or warning/error version)
66         void b3OutputPrintfVarArgsInternal(const char* str, ...);
67         void b3OutputWarningMessageVarArgsInternal(const char* str, ...);
68         void b3OutputErrorMessageVarArgsInternal(const char* str, ...);
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif  //B3_LOGGING_H