OpcUaCanOpen
CANopen OPC-UA server
LogItInstance.h
Go to the documentation of this file.
1
/* © Copyright CERN, 2015. All rights not expressly granted are reserved.
2
* LogItInstance.h
3
*
4
* Created on: Apr 4, 2016
5
* Author: Benjamin Farnham <benjamin.farnham@cern.ch>
6
*
7
* This file is part of Quasar.
8
*
9
* Quasar is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU Lesser General Public Licence as published by
11
* the Free Software Foundation, either version 3 of the Licence.
12
*
13
* Quasar is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Lesser General Public Licence for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with Quasar. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
#ifndef THEDYNLIB_LOGIT_LOGITINSTANCE_H_
22
#define THEDYNLIB_LOGIT_LOGITINSTANCE_H_
23
24
#include <vector>
25
#include <map>
26
#include <memory>
27
#include <unordered_map>
28
#include <mutex>
29
#include "
LogItStaticDefinitions.h
"
30
#include "
LogLevels.h
"
31
#include "
ComponentAttributes.h
"
32
#include "
LogSinks.h
"
33
34
class
LogItInstance
35
{
36
private
:
37
typedef
std::vector<ComponentAttributes>
LoggingComponentsArray
;
38
typedef
std::unordered_map<std::string, Log::LogComponentHandle>
MapOfComponentNameToHandle
;
39
typedef
std::shared_ptr<MapOfComponentNameToHandle>
MapOfComponentNameToHandlePtr
;
40
41
public
:
42
static
bool
instanceExists
();
43
SHARED_LIB_EXPORT_DEFN
static
LogItInstance
*
getInstance
();
44
static
bool
setInstance
(
LogItInstance
* remoteInstance);
45
static
LogItInstance
*
createInstance
();
46
47
private
:
48
LogItInstance
();
49
virtual
~LogItInstance
();
50
static
LogItInstance
*
g_sLogItInstance
;
51
52
public
:
53
ComponentAttributes
&
registerLoggingComponent
(
const
std::string
& componentName,
const
Log::LOG_LEVEL
& nonComponentLogLevel);
54
55
bool
getComponentAttributes
(
const
Log::LogComponentHandle
& componentHandle,
ComponentAttributes
*& componentAttributes);
56
bool
getComponentHandle
(
const
std::string
& componentName,
Log::LogComponentHandle
& componentHandle);
57
std::map<Log::LogComponentHandle, std::string>
getLoggingComponentsList
()
const
;
58
59
bool
m_isLoggingInitialized
;
60
LogSinks
m_logSinksInstance
;
61
Log::LOG_LEVEL
m_nonComponentLogLevel
;
62
63
private
:
64
LoggingComponentsArray
m_components
;
65
MapOfComponentNameToHandlePtr
m_componentNames
;
66
mutable
std::mutex
m_componentsLock
;
67
};
68
69
#endif
/* THEDYNLIB_LOGIT_LOGITINSTANCE_H_ */
LogIt
include
LogItInstance.h
Generated on Fri Sep 11 2020 14:30:08 for OpcUaCanOpen by
1.8.14