ChimeraTK-ControlSystemAdapter-OPCUAAdapter  04.00.01
loggingLevel_type.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Helmholtz-Zentrum Dresden-Rossendorf, FWKE, ChimeraTK Project <chimeratk-support@desy.de>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 #pragma once
4 
5 #include <open62541/plugin/log.h>
6 #include <open62541/server.h>
7 /*
8  * loggingLevel_type.h
9  *
10  * Created on: Jun 12, 2024
11  * Author: Klaus Zenker (HZDR)
12  */
13 
14 // We can not use UA_LogLevel because the enum type expects 0,1,... and UA_LogLevel uses 100,200,...
15 typedef enum {
24 
25 UA_STATIC_ASSERT(sizeof(UA_LoggingLevel) == sizeof(UA_Int32), enum_must_be_32bit);
26 
27 static UA_INLINE UA_LogLevel toLogLevel(const UA_LoggingLevel l) {
28  UA_LogLevel dest;
29  switch(l) {
31  dest = UA_LOGLEVEL_TRACE;
32  break;
34  dest = UA_LOGLEVEL_DEBUG;
35  break;
37  dest = UA_LOGLEVEL_INFO;
38  break;
40  dest = UA_LOGLEVEL_WARNING;
41  break;
43  dest = UA_LOGLEVEL_ERROR;
44  break;
46  dest = UA_LOGLEVEL_FATAL;
47  break;
48  default:
49  dest = UA_LOGLEVEL_INFO;
50  break;
51  }
52  return dest;
53 }
54 
55 static UA_INLINE UA_LoggingLevel toLoggingLevel(const UA_LogLevel l) {
57  switch(l) {
58  case UA_LOGLEVEL_TRACE:
60  break;
61  case UA_LOGLEVEL_DEBUG:
63  break;
64  case UA_LOGLEVEL_INFO:
66  break;
67  case UA_LOGLEVEL_WARNING:
69  break;
70  case UA_LOGLEVEL_ERROR:
72  break;
73  case UA_LOGLEVEL_FATAL:
75  break;
76  default:
78  break;
79  }
80  return dest;
81 }
82 
83 static const UA_DataType LoggingLevelType = {
84  UA_TYPENAME("LoggingLevels") /* .typeName */
85  {1, UA_NODEIDTYPE_STRING, {.string = {13, (UA_Byte*)"LoggingLevels"}}}, /* .typeId */
86  {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .binaryEncodingId */
87  sizeof(UA_LoggingLevel), /* .memSize */
88  UA_DATATYPEKIND_ENUM, /* .typeKind */
89  true, /* .pointerFree */
90  UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */
91  0, /* .membersSize */
92  NULL /* .members */
93 };
94 static UA_INLINE void UA_LoggingLevel_init(UA_LoggingLevel* p) {
95  memset(p, 0, sizeof(UA_LoggingLevel));
96 }
97 
98 static UA_INLINE UA_LoggingLevel* UA_LoggingLevel_new(void) {
99  return (UA_LoggingLevel*)UA_new(&LoggingLevelType);
100 }
101 
102 static UA_INLINE UA_StatusCode UA_LoggingLevel_copy(const UA_LoggingLevel* src, UA_LoggingLevel* dst) {
103  return UA_copy(src, dst, &LoggingLevelType);
104 }
105 
106 UA_DEPRECATED static UA_INLINE void UA_LoggingLevel_deleteMembers(UA_LoggingLevel* p) {
107  UA_clear(p, &LoggingLevelType);
108 }
109 
110 static UA_INLINE void UA_LoggingLevel_clear(UA_LoggingLevel* p) {
111  UA_clear(p, &LoggingLevelType);
112 }
113 
114 static UA_INLINE void UA_LoggingLevel_delete(UA_LoggingLevel* p) {
115  UA_delete(p, &LoggingLevelType);
116 }
117 static UA_INLINE UA_Boolean UA_LoggingLevel_equal(const UA_LoggingLevel* p1, const UA_LoggingLevel* p2) {
118  return (UA_order(p1, p2, &LoggingLevelType) == UA_ORDER_EQ);
119 }
UA_LoggingLevel
UA_LoggingLevel
Definition: loggingLevel_type.h:15
UA_LOGGINGLEVEL_ERROR
@ UA_LOGGINGLEVEL_ERROR
Definition: loggingLevel_type.h:20
UA_LOGGINGLEVEL_FATAL
@ UA_LOGGINGLEVEL_FATAL
Definition: loggingLevel_type.h:21
UA_LOGGINGLEVEL_TRACE
@ UA_LOGGINGLEVEL_TRACE
Definition: loggingLevel_type.h:16
__UA_LOGGINGLEVEL_FORCE32BIT
@ __UA_LOGGINGLEVEL_FORCE32BIT
Definition: loggingLevel_type.h:22
UA_LOGGINGLEVEL_WARNING
@ UA_LOGGINGLEVEL_WARNING
Definition: loggingLevel_type.h:19
UA_LOGGINGLEVEL_INFO
@ UA_LOGGINGLEVEL_INFO
Definition: loggingLevel_type.h:18
UA_LOGGINGLEVEL_DEBUG
@ UA_LOGGINGLEVEL_DEBUG
Definition: loggingLevel_type.h:17
create_self-signed.dest
dest
Definition: create_self-signed.py:27
UA_STATIC_ASSERT
UA_STATIC_ASSERT(sizeof(UA_LoggingLevel)==sizeof(UA_Int32), enum_must_be_32bit)