Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
~
Functions
a
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
~
Variables
a
c
d
e
f
g
i
l
m
n
u
v
Typedefs
a
c
d
e
g
i
m
n
o
p
s
u
v
Enumerations
_
e
g
h
i
p
Enumerator
_
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
u
v
w
x
y
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
~
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
y
Typedefs
a
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
v
Enumerations
Enumerator
a
c
d
e
f
i
n
o
r
s
t
w
x
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
y
Functions
c
d
e
g
i
l
m
o
p
r
t
Variables
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
p
s
t
u
Enumerations
a
b
c
d
e
f
g
i
p
s
t
u
Enumerator
a
b
c
d
e
f
g
i
l
m
p
r
s
t
u
y
Macros
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
CLog.h
Go to the documentation of this file.
1
/****************************************************************************
2
3
(c) 2017 by STEMMER IMAGING GmbH
4
Project: Modular Logging
5
Author: Quang Nguyen
6
7
License: This file is published under the license of the EMVA GenICam Standard Group.
8
A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
9
If for some reason you are missing this file please contact the EMVA or visit the website
10
(http://www.genicam.org) for a full copy.
11
12
THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
13
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
16
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
17
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
18
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
19
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
POSSIBILITY OF SUCH DAMAGE.
23
24
****************************************************************************/
25
26
27
28
29
#ifndef LOG_CLOG_H_
30
#define LOG_CLOG_H_
31
32
#ifdef _MSC_VER
33
# pragma warning (push, 3)
34
# pragma warning(disable:4706) // assignment within conditional expression
35
#endif
36
//#pragma warning (push, 3)
37
//#pragma warning(disable:4706) // assignment within conditional expression
38
39
#include <stdio.h>
40
#include <map>
41
#include <
Log/LogDll.h
>
42
43
#include <
Base/GCBase.h
>
44
#include <
Log/ILogger.h
>
45
#include <
Log/ILoggerFactory.h
>
46
47
48
namespace
GENICAM_NAMESPACE
49
{
54
class
LOG_DECL
CLog
55
{
56
public
:
60
static
bool
Exist(
const
gcstring &LoggerName);
61
static
bool
Exist(
const
char
* LoggerName);
62
63
66
static
ILogger& GetLogger(
const
gcstring &LoggerName);
67
static
ILogger& GetLogger(
const
char
* LoggerName);
68
69
static
void
PushIndent();
70
static
void
PopIndent();
71
72
// No logger is being used
73
static
void
OmitLogger();
74
75
// Will take ownership of the ILoggerFactory. ShutDown will delete that object
76
static
void
SetLoggerFactory(ILoggerFactory&);
77
static
ILoggerFactory
* GetLoggerFactory();
78
80
static
void
ShutDown(
void
);
81
82
private
:
83
85
#if defined (_WIN32)
86
typedef
HMODULE
lib_handle_t
;
87
#else
88
typedef
void
*
lib_handle_t
;
89
#endif
90
91
// Default initializer
92
static
void
DefaultInitializer();
93
95
static
lib_handle_t
OpenLibrary(
const
gcstring
Name);
96
98
static
void
*FindSymbol(
lib_handle_t
Handle,
const
gcstring
Name);
99
101
static
void
MakeSureLoggerHasBeenFound();
102
103
static
bool
ExistInMap(
gcstring
loggerName);
104
// Delete all available ILoggers
105
static
void
DeleteLoggerMap();
106
107
// Contains the logger factory unless it has not been loaded
108
static
ILoggerFactory
* m_LogFactory;
109
110
111
113
static
lib_handle_t
g_pLibHandle;
114
115
// True if logger has been found
116
static
bool
m_LoggerHasBeenFound;
117
static
bool
m_OmitLogger;
118
119
};
120
121
}
122
123
#if defined(__GNUC__)
124
# pragma GCC diagnostic push
125
# pragma GCC diagnostic ignored "-Wvariadic-macros"
126
#endif
127
128
// Logging macros
129
#define GCLOGINFO( cat, ... ) if(cat && GENICAM_NAMESPACE::CLog::Exist("")) { (cat)->Log(GENICAM_NAMESPACE::ILogger::INFO, ##__VA_ARGS__ ); }
130
#define GCLOGINFOPUSH( cat, ... ) if(cat && GENICAM_NAMESPACE::CLog::Exist("")) { (cat)->Log(GENICAM_NAMESPACE::ILogger::INFO, ##__VA_ARGS__ ); GENICAM_NAMESPACE::CLog::PushIndent();}
131
#define GCLOGWARN( cat, ... ) if(cat && GENICAM_NAMESPACE::CLog::Exist("")) { (cat)->Log(GENICAM_NAMESPACE::ILogger::WARN, ##__VA_ARGS__ ); }
132
#define GCLOGERROR( cat, ... ) if(cat && GENICAM_NAMESPACE::CLog::Exist("")) { (cat)->Log(GENICAM_NAMESPACE::ILogger::ERR, ##__VA_ARGS__ ); }
133
#define GCLOGDEBUG( cat, ... ) if(cat && GENICAM_NAMESPACE::CLog::Exist("")) { (cat)->Log(GENICAM_NAMESPACE::ILogger::DEBUG, ##__VA_ARGS__ ); }
134
#define GCLOGINFOPOP( cat, ... ) if(cat && GENICAM_NAMESPACE::CLog::Exist("")) { (cat)->Log(GENICAM_NAMESPACE::ILogger::INFO, ##__VA_ARGS__ ); GENICAM_NAMESPACE::CLog::PopIndent();}
135
136
137
#if defined(__GNUC__)
138
# pragma GCC diagnostic pop
139
#endif
140
141
#endif // LOG_CLOG_H_
GENICAM_NAMESPACE::ILoggerFactory
Definition:
ILoggerFactory.h:10
GENICAM_NAMESPACE::CLog::lib_handle_t
void * lib_handle_t
A type corresponds to a library handle which can be platform specific.
Definition:
CLog.h:134
GENICAM_NAMESPACE
Definition:
GCArray.h:32
GENICAM_NAMESPACE::gcstring
A string class which is a clone of std::string.
Definition:
GCString.h:52
LogDll.h
declspec's to be used for Log Windows dll
GCBase.h
Common GenICam base include file.
lib_handle_t
void * lib_handle_t
Definition:
CLAllAdapter.h:50
LOG_DECL
#define LOG_DECL
Definition:
LogDll.h:48
ILoggerFactory.h
ILogger.h
rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11