15#ifndef DD_PREDEFINED_DATATYPES_H_INCLUDED
16#define DD_PREDEFINED_DATATYPES_H_INCLUDED
27#include <unordered_map>
45 static_assert(std::is_arithmetic<T>::value,
46 "To use this type, only primitive types are allowed");
54 static_assert(std::is_arithmetic<T>::value,
55 "To use this type, only primitive types are allowed");
61#if defined(__GNUC__) && ((__GNUC__ == 5) && (__GNUC_MINOR__ == 2))
62#pragma GCC diagnostic push
63#pragma GCC diagnostic ignored "-Wattributes"
71#define DDL_DATA_TYPE_INT(type, default_name) \
74 class DataType<type> : public dd::datamodel::DataType { \
76 DataType(const std::string& name) \
77 : dd::datamodel::DataType(name, \
79 std::string("Predefined DataType for ") + name, \
82 std::to_string((std::numeric_limits<type>::min)()), \
83 std::to_string((std::numeric_limits<type>::max)()), \
87 DataType() : DataType(default_name) \
92 static_assert(true, "Simply to make sure a closing semicolon ';' is used for the macro")
124 std::string(
"Predefined DataType for ") + name,
157 std::string(
"Predefined DataType for ") + name,
190 std::string(
"Predefined DataType for ") + name,
223 std::string(
"Predefined DataType for ") + name,
271class PredefinedDataTypes {
277 PredefinedDataTypes();
282 ~PredefinedDataTypes();
321 std::shared_ptr<dd::datamodel::DataType> _type;
322 std::vector<std::string> _aliases;
324 const std::unordered_map<std::string, PredefInfo> _defined_types;
329#if defined(__GNUC__) && ((__GNUC__ == 5) && (__GNUC_MINOR__ == 2))
330#pragma GCC diagnostic pop
DataType(const std::string &name)
CTOR. creates the datatype with a different name then defined by default.
Definition dd_predefined_datatypes.h:121
DataType()
CTOR. creates the datatype with the default name for the type bool.
Definition dd_predefined_datatypes.h:136
DataType()
CTOR. creates the datatype with the default name for the type char.
Definition dd_predefined_datatypes.h:169
DataType(const std::string &name)
CTOR. creates the datatype with a different name then defined by default.
Definition dd_predefined_datatypes.h:154
DataType(const std::string &name)
CTOR. creates the datatype with a different name then defined by default.
Definition dd_predefined_datatypes.h:220
DataType()
CTOR. creates the datatype with the default name for the type double.
Definition dd_predefined_datatypes.h:235
DataType(const std::string &name)
CTOR. creates the datatype with a different name then defined by default.
Definition dd_predefined_datatypes.h:187
DataType()
CTOR. creates the datatype with the default name for the type float.
Definition dd_predefined_datatypes.h:202
DataType(const std::string &)
CTOR. creates the datatype with a different name then defined by default.
Definition dd_predefined_datatypes.h:43
DataType()
CTOR. creates the datatype with the default name for the type T.
Definition dd_predefined_datatypes.h:52
std::shared_ptr< dd::datamodel::DataType > getPredefinedType(const std::string &name) const
Get the Predefined Type object by name.
std::vector< std::string > getAliasTypes(const std::string &name) const
Get the aliases for this type to determine similar type (like tBool and bool)
static const PredefinedDataTypes & getInstance()
Get the Instance object.
std::vector< std::shared_ptr< dd::datamodel::DataType > > getPredefinedTypes() const
Gets a vector of all the predefined data types.
dd::OptionalSize getDefaultAlignment(const std::string &name) const
Get the default alignment of a Predefined Type by name.
observable DataDefinition object class to describe (POD) DataType.
Definition datamodel_types.h:113
#define DDL_DATA_TYPE_INT(type, default_name)
Definition dd_predefined_datatypes.h:71
definition of the dd namespace
Definition datamodel_base.h:26
utility::Optional< size_t > OptionalSize
Optional Size Type.
Definition dd_common_types.h:38
definition of the ddl namespace
Definition codec.h:21