15 #ifndef DD_PREDEFINED_UNITS_H_INCLUDED
16 #define DD_PREDEFINED_UNITS_H_INCLUDED
22 #include <type_traits>
23 #include <unordered_map>
61 namespace unit_prefix {
73 #define DDL_BASE_UNIT_DEFINITION(classname, baseunitname, baseunitsymbol, baseunitdescription) \
76 constexpr static const char* const _name = baseunitname; \
77 constexpr static const char* const _symbol = baseunitsymbol; \
78 constexpr static const char* const _description = baseunitdescription; \
81 static_assert(true, "Simply to make sure a closing semicolon ';' is used for the macro")
91 #define DDL_UNIT_PREFIX_DEFINITION(classname, unitprefixname, unitprefixsymbol, unitprefixpower) \
92 namespace unit_prefix { \
94 constexpr static const char* const _name = unitprefixname; \
95 constexpr static const char* const _symbol = unitprefixsymbol; \
96 constexpr static const int32_t _power = unitprefixpower; \
99 static_assert(true, "Simply to make sure a closing semicolon ';' is used for the macro")
212 const std::string& name)
const;
228 const std::unordered_map<std::string, std::shared_ptr<dd::datamodel::BaseUnit>>
230 const std::unordered_map<std::string, std::shared_ptr<dd::datamodel::UnitPrefix>>
231 _defined_unit_prefixes;
Static class for predefined units.
~PredefinedUnits()
Destructor.
std::shared_ptr< dd::datamodel::BaseUnit > getPredefinedBaseUnit(const std::string &name) const
Get the Predefined Base Unit by name.
static const PredefinedUnits & getInstance()
Get the Instance object.
std::vector< std::shared_ptr< dd::datamodel::UnitPrefix > > getPredefinedUnitPrefixes() const
Gets a vector of all the predefined unit prefixes types.
std::vector< std::shared_ptr< dd::datamodel::BaseUnit > > getPredefinedBaseUnits() const
Gets a vector of all the predefined base units.
PredefinedUnits()
Construct a new Predefined Units object.
std::shared_ptr< dd::datamodel::UnitPrefix > getPredefinedUnitPrefix(const std::string &name) const
Get the Predefined Unit Prefix by name.
Unit Prefix - datamodel pefixes.
DataDefinition Unit definitions.
#define DDL_UNIT_PREFIX_DEFINITION(classname, unitprefixname, unitprefixsymbol, unitprefixpower)
Unit prefix template definiton.
#define DDL_BASE_UNIT_DEFINITION(classname, baseunitname, baseunitsymbol, baseunitdescription)
Base unit template definiton.
datamodel::BaseUnit BaseUnit
Reuse of datamodel base unit class - ddl::dd::datamodel::BaseUnit.
datamodel::UnitPrefix UnitPrefix
Reuse of datamodel unit prefix class - ddl::dd::datamodel::UnitPrefix.
@ unit
the unit is a unit (Unit)
definition of the ddl namespace
Generator template to create baseunits.
Generator template to create UnitPrefix.