UniRec  3.3.1
unirecTypes.hpp
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include "ipAddress.hpp"
13 #include "macAddress.hpp"
14 #include "urTime.hpp"
15 
16 #include <cstddef>
17 #include <string>
18 #include <string_view>
19 #include <unirec/unirec.h>
20 
21 namespace Nemea {
22 
29 template<typename T>
31 
32 template<>
33 constexpr ur_field_type_t getExpectedUnirecType<std::byte*>()
34 {
35  return UR_TYPE_BYTES;
36 }
37 
38 template<>
40 {
41  return UR_TYPE_CHAR;
42 }
43 
44 template<>
45 constexpr ur_field_type_t getExpectedUnirecType<std::string>()
46 {
47  return UR_TYPE_STRING;
48 }
49 
50 template<>
51 constexpr ur_field_type_t getExpectedUnirecType<std::string_view>()
52 {
53  return UR_TYPE_STRING;
54 }
55 
56 template<>
58 {
59  return UR_TYPE_STRING;
60 }
61 
62 template<>
64 {
65  return UR_TYPE_UINT8;
66 }
67 
68 template<>
70 {
71  return UR_TYPE_A_UINT8;
72 }
73 
74 template<>
76 {
77  return UR_TYPE_INT8;
78 }
79 
80 template<>
82 {
83  return UR_TYPE_A_INT8;
84 }
85 
86 template<>
88 {
89  return UR_TYPE_UINT16;
90 }
91 
92 template<>
94 {
95  return UR_TYPE_A_UINT16;
96 }
97 
98 template<>
100 {
101  return UR_TYPE_INT16;
102 }
103 
104 template<>
106 {
107  return UR_TYPE_A_INT16;
108 }
109 
110 template<>
112 {
113  return UR_TYPE_UINT32;
114 }
115 
116 template<>
118 {
119  return UR_TYPE_A_UINT32;
120 }
121 
122 template<>
124 {
125  return UR_TYPE_INT32;
126 }
127 
128 template<>
130 {
131  return UR_TYPE_A_INT32;
132 }
133 
134 template<>
136 {
137  return UR_TYPE_UINT64;
138 }
139 
140 template<>
142 {
143  return UR_TYPE_A_UINT64;
144 }
145 
146 template<>
148 {
149  return UR_TYPE_INT64;
150 }
151 
152 template<>
154 {
155  return UR_TYPE_A_INT64;
156 }
157 
158 template<>
160 {
161  return UR_TYPE_FLOAT;
162 }
163 
164 template<>
166 {
167  return UR_TYPE_A_FLOAT;
168 }
169 
170 template<>
172 {
173  return UR_TYPE_DOUBLE;
174 }
175 
176 template<>
178 {
179  return UR_TYPE_A_DOUBLE;
180 }
181 
182 template<>
184 {
185  return UR_TYPE_MAC;
186 }
187 
188 template<>
190 {
191  return UR_TYPE_A_MAC;
192 }
193 
194 template<>
196 {
197  return UR_TYPE_IP;
198 }
199 
200 template<>
202 {
203  return UR_TYPE_A_IP;
204 }
205 
206 template<>
208 {
209  return UR_TYPE_TIME;
210 }
211 
212 template<>
214 {
215  return UR_TYPE_A_TIME;
216 }
217 
218 } // namespace Nemea
Header file containing the definition of the IpAddress class.
constexpr ur_field_type_t getExpectedUnirecType< int64_t >()
constexpr ur_field_type_t getExpectedUnirecType< double * >()
constexpr ur_field_type_t getExpectedUnirecType< IpAddress * >()
constexpr ur_field_type_t getExpectedUnirecType< int8_t >()
Definition: unirecTypes.hpp:75
constexpr ur_field_type_t getExpectedUnirecType< float * >()
constexpr ur_field_type_t getExpectedUnirecType< uint16_t >()
Definition: unirecTypes.hpp:87
constexpr ur_field_type_t getExpectedUnirecType< float >()
constexpr ur_field_type_t getExpectedUnirecType< IpAddress >()
constexpr ur_field_type_t getExpectedUnirecType< uint8_t * >()
Definition: unirecTypes.hpp:69
constexpr ur_field_type_t getExpectedUnirecType< int64_t * >()
constexpr ur_field_type_t getExpectedUnirecType< uint16_t * >()
Definition: unirecTypes.hpp:93
constexpr ur_field_type_t getExpectedUnirecType< uint32_t * >()
constexpr ur_field_type_t getExpectedUnirecType< uint8_t >()
Definition: unirecTypes.hpp:63
constexpr ur_field_type_t getExpectedUnirecType< int32_t * >()
constexpr ur_field_type_t getExpectedUnirecType< UrTime >()
constexpr ur_field_type_t getExpectedUnirecType< int8_t * >()
Definition: unirecTypes.hpp:81
constexpr ur_field_type_t getExpectedUnirecType< uint64_t >()
constexpr ur_field_type_t getExpectedUnirecType< uint32_t >()
constexpr ur_field_type_t getExpectedUnirecType< int16_t >()
Definition: unirecTypes.hpp:99
constexpr ur_field_type_t getExpectedUnirecType< int16_t * >()
constexpr ur_field_type_t getExpectedUnirecType< MacAddress * >()
constexpr ur_field_type_t getExpectedUnirecType()
Determines the expected UniRec field type for a given C++ type T.
constexpr ur_field_type_t getExpectedUnirecType< MacAddress >()
constexpr ur_field_type_t getExpectedUnirecType< char >()
Definition: unirecTypes.hpp:39
constexpr ur_field_type_t getExpectedUnirecType< int32_t >()
constexpr ur_field_type_t getExpectedUnirecType< uint64_t * >()
constexpr ur_field_type_t getExpectedUnirecType< char * >()
Definition: unirecTypes.hpp:57
constexpr ur_field_type_t getExpectedUnirecType< UrTime * >()
constexpr ur_field_type_t getExpectedUnirecType< double >()
Definition of UniRec structures and functions.
ur_field_type_t
Definition: unirec.h:95
@ UR_TYPE_A_UINT32
unsigned int (32b) array
Definition: unirec.h:118
@ UR_TYPE_UINT64
unsigned int (64b)
Definition: unirec.h:105
@ UR_TYPE_A_UINT16
unsigned int (16b) array
Definition: unirec.h:116
@ UR_TYPE_A_INT64
int (64b) array
Definition: unirec.h:121
@ UR_TYPE_A_DOUBLE
double (64b) array
Definition: unirec.h:123
@ UR_TYPE_A_IP
IP address (128b) array.
Definition: unirec.h:124
@ UR_TYPE_INT16
int (8b)
Definition: unirec.h:102
@ UR_TYPE_A_INT32
int (32b) array
Definition: unirec.h:119
@ UR_TYPE_A_INT8
int (8b) array
Definition: unirec.h:115
@ UR_TYPE_A_INT16
int (8b) array
Definition: unirec.h:117
@ UR_TYPE_IP
IP address (128b)
Definition: unirec.h:109
@ UR_TYPE_INT8
int (8b)
Definition: unirec.h:100
@ UR_TYPE_CHAR
char
Definition: unirec.h:98
@ UR_TYPE_A_UINT8
unsigned int (8b) array
Definition: unirec.h:114
@ UR_TYPE_DOUBLE
double (64b)
Definition: unirec.h:108
@ UR_TYPE_A_FLOAT
float (32b) array
Definition: unirec.h:122
@ UR_TYPE_A_UINT64
unsigned int (64b) array
Definition: unirec.h:120
@ UR_TYPE_A_MAC
MAC address (48b) array.
Definition: unirec.h:125
@ UR_TYPE_TIME
time (64b)
Definition: unirec.h:111
@ UR_TYPE_UINT8
unsigned int (8b)
Definition: unirec.h:99
@ UR_TYPE_INT64
int (64b)
Definition: unirec.h:106
@ UR_TYPE_STRING
var-len fields (string where only printable characters are expected; '\0' at the end should NOT be in...
Definition: unirec.h:96
@ UR_TYPE_A_TIME
time (64b) array
Definition: unirec.h:126
@ UR_TYPE_INT32
int (32b)
Definition: unirec.h:104
@ UR_TYPE_UINT16
unsigned int (16b)
Definition: unirec.h:101
@ UR_TYPE_UINT32
unsigned int (32b)
Definition: unirec.h:103
@ UR_TYPE_MAC
MAC address (48b)
Definition: unirec.h:110
@ UR_TYPE_BYTES
var-len fields (generic string of bytes)
Definition: unirec.h:97
@ UR_TYPE_FLOAT
float (32b)
Definition: unirec.h:107