15 #ifndef DD_PREDEFINED_DATATYPES_H_INCLUDED
16 #define DD_PREDEFINED_DATATYPES_H_INCLUDED
26 #include <type_traits>
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,
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.
DataType(const std::string &name)
CTOR.
DataType(const std::string &name)
CTOR.
DataType(const std::string &name)
CTOR.
Generator template to create DataType for the plain c-types.
DataType(const std::string &)
CTOR.
Predefined types of the DataDefinition.
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.
PredefinedDataTypes()
Construct a new Predefined Data Types object.
std::vector< std::string > getAliasTypes(const std::string &name) const
Get the aliases for this type to determine similar type (like tBool and bool)
~PredefinedDataTypes()
Destructor.
std::shared_ptr< dd::datamodel::DataType > getPredefinedType(const std::string &name) const
Get the Predefined Type object by name.
static const PredefinedDataTypes & getInstance()
Get the Instance object.
observable DataDefinition object class to describe (POD) DataType.
OO DataDefinition Type objects (DataType, EnumType, StructType, StreamMetaType)
OO DataDefinition Common Design.
#define DDL_DATA_TYPE_INT(type, default_name)
Expands to DataType<type> inheriting from dd::datamodel::DataType.
Definition of preprocessor macros to disable/enable compiler warnings.
definition of the ddl namespace
Utility for the Neutrino gcc5 compiler which has really no std::to_string implementation!