ifw-core  5.0.0-pre2
defines.hpp
Go to the documentation of this file.
1 
6 #ifndef IFW_DIT_DID_DEFINES_HPP_
7 #define IFW_DIT_DID_DEFINES_HPP_
8 
9 #include <string>
10 
11 #include <log4cplus/logger.h>
12 #include <log4cplus/loggingmacros.h>
13 #include <log4cplus/version.h>
14 #include <log4cplus/configurator.h>
15 
16 #include <boost/regex.hpp>
17 #include <boost/exception/diagnostic_information.hpp>
18 
19 #include <fmt/format.h>
20 
21 #include <config-ng/ciiConfigApi.hpp>
22 
23 #include <rad/logger.hpp>
24 #include <rad/exceptions.hpp>
25 
26 namespace core::dit::did {
27 
28 //static constexpr const char* LOG_PROPERTIES_FILE = "config/core/dit/didlib/log.properties";
30 
32 enum class HdrField {
33  NAME = 1,
34  SCOPE = 2,
35  DESCRIPTION = 4,
36 
37  ALL = (NAME | SCOPE | DESCRIPTION)
38 };
39 
40 const std::string DID_SCHEMA_INCLUDE = "!cfg.include schema/core/dit/did/did.schema.yaml";
41 
42 const std::string HDR_TAG = "header";
43 
44 // Dictionary Header Fields.
45 const std::string HDR_FIELD_NAME = "name";
46 const std::string HDR_FIELD_SCOPE = "scope";
47 const std::string HDR_FIELD_DESCRIPTION = "description";
48 
49 const std::map<HdrField, std::string> HDR_FIELDS_NB_MAP = {
53 
54 const std::map<std::string, HdrField> HDR_FIELDS_NAME_MAP{
58 
60 enum class DataType {
61  BOOL = 1,
62  DOUBLE = 2,
63  INTEGER = 4,
64  STRING = 8,
65 
66  ALL = (BOOL | DOUBLE | INTEGER | STRING)
67 };
68 
69 // CII Cfg textual names for the record data types.
70 const std::string REC_TYPE_BOOL = "DidBoolKey";
71 const std::string REC_TYPE_DOUBLE = "DidDblKey";
72 const std::string REC_TYPE_INTEGER = "DidIntKey";
73 const std::string REC_TYPE_STRING = "DidStrKey";
74 
76 DataType DataTypeToNum(const std::string& type);
77 
79 std::string DataTypeToStr(const DataType type);
80 
82 enum class RecField {
83  FORMAT = 1,
84  UNIT = 2,
85  COMMENT = 4,
86  DESCRIPTION = 8,
87  TYPE = 128,
88 
90 };
91 
92 // Dictionary Record Fields.
93 const std::string REC_FIELD_FORMAT = "format";
94 const std::string REC_FIELD_UNIT = "unit";
95 const std::string REC_FIELD_COMMENT = "comment";
96 const std::string REC_FIELD_DESCRIPTION = "description";
97 const std::string REC_FIELD_TYPE = "type";
98 
100 std::string RecFieldToStr(const RecField field);
101 
103 RecField RecFieldToNum(const std::string& field);
104 
105 } // namespace core::dit::did
106 
107 #endif // !IFW_DIT_DID_DEFINES_HPP_
Definition: defines.cpp:11
const std::string REC_TYPE_INTEGER
Definition: defines.hpp:72
DataType
Dictionary data types.
Definition: defines.hpp:60
const std::string HDR_TAG
Definition: defines.hpp:42
std::string RecFieldToStr(const RecField field)
Map record field from numeric to string representation.
Definition: defines.cpp:58
const std::string REC_FIELD_COMMENT
Definition: defines.hpp:95
const std::string REC_TYPE_BOOL
Definition: defines.hpp:70
log4cplus::Logger & Logger()
Definition: defines.cpp:13
const std::string REC_TYPE_STRING
Definition: defines.hpp:73
@ ALL
Definition: did.hpp:25
const std::string REC_FIELD_UNIT
Definition: defines.hpp:94
RecField
Dictionary keyword record field types.
Definition: defines.hpp:82
const std::map< std::string, HdrField > HDR_FIELDS_NAME_MAP
Definition: defines.hpp:54
const std::map< HdrField, std::string > HDR_FIELDS_NB_MAP
Definition: defines.hpp:49
const std::string REC_FIELD_DESCRIPTION
Definition: defines.hpp:96
RecField RecFieldToNum(const std::string &field)
Map record field from string to numeric representation.
Definition: defines.cpp:74
DataType DataTypeToNum(const std::string &type)
Map type from string to numeric representation.
Definition: defines.cpp:25
const std::string HDR_FIELD_SCOPE
Definition: defines.hpp:46
const std::string REC_FIELD_TYPE
Definition: defines.hpp:97
const std::string DID_SCHEMA_INCLUDE
Definition: defines.hpp:40
const std::string REC_TYPE_DOUBLE
Definition: defines.hpp:71
const std::string HDR_FIELD_DESCRIPTION
Definition: defines.hpp:47
std::string DataTypeToStr(const DataType type)
Map type from numeric to string representation.
Definition: defines.cpp:41
const std::string HDR_FIELD_NAME
Definition: defines.hpp:45
const std::string REC_FIELD_FORMAT
Definition: defines.hpp:93
HdrField
Dictionary header field types.
Definition: defines.hpp:32