Dev Essential  1.6.3
Loading...
Searching...
No Matches
dd_common_types.h
Go to the documentation of this file.
1
14
15#ifndef DD_TYPES_H_INCLUDED
16#define DD_TYPES_H_INCLUDED
17
20
21#include <string>
22#include <cstdint>
23
25#define DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(alternative) \
26 DEV_ESSENTIAL_DEPRECATED("Please use ddl::dd::" #alternative \
27 " directly, due to static intialization problem.")
29
30namespace ddl {
31
32namespace dd {
33
39
71
93
98enum Alignment : size_t {
99 e0 = 1,
100 e1 = 1,
101 e2 = 2,
102 e4 = 4,
103 e8 = 8,
104 e16 = 16,
105 e32 = 32,
106 e64 = 64,
107 e_invalid = 255
108};
109
115public:
122 static std::string toString(Alignment alignment);
130 static Alignment fromString(const std::string& alignment,
131 const Alignment& default_val = Alignment::e_invalid);
132};
133
139public:
146 static bool isValid(size_t alignment);
147};
148
153 platform_not_supported = 0x00,
154 plattform_little_endian_8 = 0x01,
155 platform_big_endian_8 = 0x02,
156 e_noe = platform_not_supported,
157 e_le = plattform_little_endian_8,
158 e_be = platform_big_endian_8
159};
160
166public:
173 static std::string toString(ByteOrder byte_order);
181 static ByteOrder fromString(const std::string& byte_order,
182 const ByteOrder& default_val = ByteOrder::platform_not_supported);
183};
184
190public:
197};
198
203class Version {
204public:
215 Version(const std::string& version);
216
223 Version(uint32_t major, uint32_t minor);
224
230 uint32_t getMajor() const;
236 uint32_t getMinor() const;
237
243 std::string toString() const;
244
251 bool isValidVersion() const;
252
260 {
261 return getDefault();
262 }
263
270 static const Version& getLatestVersion();
271
272 /* ignore patch version for all comparisons */
274 bool operator==(const Version& other) const;
275 bool operator!=(const Version& other) const;
276 bool operator>(const Version& other) const;
277 bool operator<(const Version& other) const;
278 bool operator<=(const Version& other) const;
279 bool operator>=(const Version& other) const;
281
286 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(0, 0))
292 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(0, 0))
298 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(1, 0))
304 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(1, 1))
310 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(1, 2))
316 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(2, 0))
322 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(3, 0))
328 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(4, 0))
334 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version(4, 1))
340 DEV_ESSENTIAL_DEPRECATED_STATIC_VERSION(Version::getLatestVersion())
342
343private:
344 uint32_t _major = {};
345 uint32_t _minor = {};
346
347 static const Version& getDefault();
348};
349
355public:
362 static std::string toString(const Version& version);
370 static Version fromString(const std::string& version,
371 const Version& default_val = Version(0, 0));
372};
373
379public:
383 ArraySize() = default;
388 ArraySize(size_t array_size);
394 ArraySize& operator=(size_t array_size);
399 ArraySize(std::string array_size_element_name);
405 ArraySize& operator=(const std::string& array_size_element_name);
410 void setArraySizeValue(size_t array_size);
414 size_t getArraySizeValue() const;
419 void setArraySizeElementName(const std::string& array_size_element_name);
424 const std::string& getArraySizeElementName() const;
428 bool isDynamicArraySize() const;
429
436 bool operator==(const ArraySize& other) const;
443 bool operator!=(const ArraySize& other) const;
444
445private:
446 size_t _array_size = {1};
447 std::string _array_size_element_name = {};
448};
449
450} // namespace dd
451} // namespace ddl
452
453#endif // DD_TYPES_H_INCLUDED
Alignment Conversion utility.
Definition dd_common_types.h:114
static std::string toString(Alignment alignment)
convert alignment to a string.
static Alignment fromString(const std::string &alignment, const Alignment &default_val=Alignment::e_invalid)
convert a string to an alignment.
Alignment ConvValidation utility.
Definition dd_common_types.h:138
static bool isValid(size_t alignment)
check if the Alignment is a valid value
ArraySize & operator=(const std::string &array_size_element_name)
ArraySize(std::string array_size_element_name)
bool operator==(const ArraySize &other) const
size_t getArraySizeValue() const
void setArraySizeValue(size_t array_size)
ArraySize & operator=(size_t array_size)
const std::string & getArraySizeElementName() const
bool operator!=(const ArraySize &other) const
void setArraySizeElementName(const std::string &array_size_element_name)
ArraySize(size_t array_size)
bool isDynamicArraySize() const
ByteOrder Conversion utility.
Definition dd_common_types.h:165
static ByteOrder fromString(const std::string &byte_order, const ByteOrder &default_val=ByteOrder::platform_not_supported)
convert a string to a byte_order.
static std::string toString(ByteOrder byte_order)
convert byte_order to a string.
Default ByteOrder Discovery utility class.
Definition dd_common_types.h:189
static ByteOrder getPlatformDefault()
Get the current Platform Byteorder.
Version conversion utility class.
Definition dd_common_types.h:354
static std::string toString(const Version &version)
Version to string conversion.
static Version fromString(const std::string &version, const Version &default_val=Version(0, 0))
Creates the Version from a string.
DDL Version.
Definition dd_common_types.h:203
static const Version ddl_version_current
Definition dd_common_types.h:341
static const Version ddl_version_40
Definition dd_common_types.h:329
static const Version ddl_version_20
Definition dd_common_types.h:317
Version(const std::string &version)
CTOR - Version from string.
Version(uint32_t major, uint32_t minor)
CTOR.
static const Version ddl_version_11
Definition dd_common_types.h:305
Version()
default CTOR
std::string toString() const
the vrsion as string
static const Version & getLatestVersion()
Get the latest DDL version This is the currently Version(4, 2).
static const Version ddl_version_41
Definition dd_common_types.h:335
uint32_t getMajor() const
Get the Major value.
static const Version ddl_version_10
Definition dd_common_types.h:299
static const Version & getDefaultVersion()
Get the Default Version. This is the currently Version(4, 1).
Definition dd_common_types.h:259
static const Version ddl_version_30
Definition dd_common_types.h:323
static const Version ddl_version_notset
Definition dd_common_types.h:293
static const Version ddl_version_invalid
Definition dd_common_types.h:287
bool isValidVersion() const
is valid or not
static const Version ddl_version_12
Definition dd_common_types.h:311
uint32_t getMinor() const
Get the Minor value.
definition of the dd namespace
Definition datamodel_base.h:26
ByteOrder
Definition dd_common_types.h:152
Alignment
Alignment defintion.
Definition dd_common_types.h:98
@ e0
Definition dd_common_types.h:99
@ e1
Definition dd_common_types.h:100
TypeOfUnit
Classification of unit.
Definition dd_common_types.h:76
@ base_unit
the unit is a base unit (BaseUnit)
Definition dd_common_types.h:91
@ invalid_unit
the type of the unit is unknown
Definition dd_common_types.h:81
@ unit
the unit is a unit (Unit)
Definition dd_common_types.h:86
utility::Optional< size_t > OptionalSize
Optional Size Type.
Definition dd_common_types.h:38
TypeOfType
Classification of a Type.
Definition dd_common_types.h:44
@ invalid_type
the type is unknown
Definition dd_common_types.h:49
@ struct_type
the type is a struct type (StructType)
Definition dd_common_types.h:64
@ data_type
the type is a data type (DataType)
Definition dd_common_types.h:54
@ stream_meta_type
the type is an stream meta type (StreamMetaType)
Definition dd_common_types.h:69
@ enum_type
the type is a enum type (EnumType)
Definition dd_common_types.h:59
definition of the ddl namespace
Definition codec.h:21
An optional template as long as the std::optional is not available here.
Definition access_optional.h:31