13 #ifndef ML_OBJ_MGR_OBJECT_ID_H
14 #define ML_OBJ_MGR_OBJECT_ID_H
19 #include "MLObjMgrSystem.h"
30 typedef std::basic_string<T> inherited;
40 std::basic_ostringstream<T> o;
42 inherited::assign(
"0");
43 printTemplateError(
"omIDType::omIDType(MLint32)",
ML_BAD_DATA_TYPE,
"Conversion of MLint32 to string failed (result '" + o.str() +
"'). Continuing with string id '0'.");
46 inherited::assign(o.str());
54 omIDTypeT(
const std::basic_string<T> &
id) : inherited(id) {}
57 omIDTypeT &operator =(
const std::basic_string<T> &
id) {
58 inherited::assign(
id);
64 operator const std::basic_string<T> &()
const {
71 std::basic_istringstream<T> i(*
this);
82 return inherited::empty();
91 #define omID_DEFAULT (omIDType())
94 #define omID_MAX (ML_UINT32_MAX / 2 - 1)
omIDTypeT(const char *id)
Constructor from char * argument.
bool isDefault() const
Check for default value.
omIDTypeT()
Standard constructor.
omIDTypeT(const std::basic_string< T > &id)
Constructor from std::string argument.
MLint32 getInt() const
Returns numerical value of object Id if possible.
omIDTypeT(MLint32 id)
Constructor from integer argument.
#define ML_BAD_DATA_TYPE
A wrong or unexpected data type has been passed to an algorithm which often is a programming error; t...
void ML_UTILS_EXPORT printTemplateError(const char *location, MLErrorCode reason, const std::string_view &handling)
omIDTypeT< char > omIDType
Define default type for normal use with the typical string char type.