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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
// $Id$
/**
* @file CIAO_common.h
*
* This file collects common CIAO macro definitions.
*
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
#ifndef CIAO_COMMON_H
#define CIAO_COMMON_H
#include /**/ "ace/pre.h"
#include "ace/config-all.h"
#if !defined ACE_LACKS_PRAGMA_ONCE
# pragma once
#endif /* ! ACE_LACKS_PRAGMA_ONCE */
#include "CIAO_Client_Export.h"
#define CIAO_REGISTER_VALUE_FACTORY(ORB,FACTORY,VALUETYPE) {\
CORBA::ValueFactory factory = new FACTORY; \
CORBA::ValueFactory prev_factory = \
ORB->register_value_factory \
(VALUETYPE::_tao_obv_static_repository_id (), \
factory); \
if (prev_factory) prev_factory->_remove_ref (); \
factory->_remove_ref (); }
// By default tracing is turned off.
#if !defined (CIAO_NTRACE)
# if !defined (ACE_NTRACE)
# define CIAO_NTRACE 1
# else
# define CIAO_NTRACE ACE_NTRACE
# endif
#endif /* CIAO_NTRACE */
#if (CIAO_NTRACE == 1)
# if !defined (ACE_NTRACE)
# define CIAO_TRACE(X)
# else
# if (ACE_NTRACE == 0)
# error CIAO_TRACE cannot be disabled if ACE_TRACE is enabled
# else
# define CIAO_TRACE(X)
# endif
# endif
#else
# if !defined (ACE_HAS_TRACE)
# define ACE_HAS_TRACE
# endif /* ACE_HAS_TRACE */
# define CIAO_TRACE(X) ACE_TRACE_IMPL(X)
# include "ace/Trace.h"
#endif /* CIAO_NTRACE */
#if defined (CIAO_NDEBUG)
#define CIAO_DEBUG(X, ...) do {} while (0)
#define CIAO_ERROR(X, ...) do {} while (0)
#else
#define CIAO_DEBUG(X, ...) \
do { \
if (CIAO::debug_level () > X) { \
int __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
ace___->log (LM_DEBUG, __VA_ARGS__); \
} \
} while (0)
#define CIAO_ERROR(X, ...) \
do { \
if (CIAO::debug_level () > X) { \
int __ace_error = ACE_Log_Msg::last_error_adapter (); \
ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \
ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \
ace___->log (LM_ERROR, __VA_ARGS__); \
} \
} while (0)
#endif
namespace CIAO
{
/**
* Return the debug level. The debug level of CIAO is control by
* an environment variable "CIAO_DEBUG_LEVEL". It should be an int
* value. If it is not defined, the default debug level is 0. The
* value of debug value is evaluated on its first use and the value
* is then cached. The actual implementation of this function is in
* Client_init.cpp.
*
* Some recommendation for using the debug_level
*
* > 0 : For component users. Component developers are encouraged
* to develop their own
* > 10 : For CIAO tools
* > 20 : For CIAO core.
*/
CIAO_CLIENT_Export int debug_level (void);
}
#include /**/ "ace/post.h"
#endif /* CIAO_COMMON_H */
|