25 #ifndef __DOTS_HANDLER_ID_H__
26 #define __DOTS_HANDLER_ID_H__
31 #include <Safir/Dob/Typesystem/Internal/KernelDefs.h>
32 #include <Safir/Dob/Typesystem/Internal/InternalOperations.h>
57 m_handlerId(Internal::DEFAULT_HANDLER_ID),
58 m_handlerIdStr(L
"DEFAULT_HANDLER")
69 m_handlerId(Internal::Generate64BitHash(id)),
97 if (!m_handlerIdStr.empty() && m_handlerId != Internal::Generate64BitHash(idStr))
99 std::wostringstream ostr;
100 ostr <<
"HandlerId two-argument constructor got an inconsistent id. Got ("
101 <<
id <<
", '" << idStr <<
"'), but the string evaluates to " << Internal::Generate64BitHash(idStr) <<
".";
115 void RemoveString() {m_handlerIdStr.clear(); m_CachedUtf8String.clear();}
124 return m_handlerId == other.m_handlerId;
134 return !(*
this==other);
145 return m_handlerId < other.m_handlerId;
151 DOTS_API
const std::wstring
ToString()
const;
182 if (m_handlerIdStr.empty())
187 if (m_CachedUtf8String.empty())
192 return static_cast<Int32>(m_CachedUtf8String.length() + 1);
204 if (!m_handlerIdStr.empty() && m_CachedUtf8String.empty())
208 return m_CachedUtf8String;
215 std::wstring m_handlerIdStr;
217 mutable std::string m_CachedUtf8String;
221 {
return out << handlerId.
ToString();}
const std::wstring & GetRawString() const
Get the string that was used to create this id.
Definition: HandlerId.h:172
Int32 Utf8StringLength() const
Get the length of the string when converted to UTF-8 encoding.
Definition: HandlerId.h:180
Class containing the identity of a handler.
Definition: HandlerId.h:45
Meant to be used when something goes very wrong.
Definition: Exceptions.h:360
DotsC_Int64 Int64
64 bit integer type.
Definition: Dob/Typesystem/Defs.h:72
Int64 UnderlyingType
Definition: HandlerId.h:156
static DOTS_API const HandlerId ALL_HANDLERS
Constant representing all handlers.
Definition: HandlerId.h:49
HandlerId()
Default constructor.
Definition: HandlerId.h:56
bool operator!=(const HandlerId &other) const
Inequality operator.
Definition: HandlerId.h:132
DOTS_API const std::wstring ToString() const
Return a string representation of the handler id.
HandlerId(const Int64 id, const std::wstring &idStr)
Constructor.
Definition: HandlerId.h:92
#define __WFILE__
Definition: Exceptions.h:31
bool operator==(const HandlerId &other) const
Equality operator.
Definition: HandlerId.h:122
DOTS_API const std::string ToUtf8(const std::wstring &wstr)
Convert a std::wstring to UTF8-encoded std::string.
HandlerId(const Int64 id)
Constructor.
Definition: HandlerId.h:80
UnderlyingType GetRawValue() const
Get the raw 64 bit integer identifier.
Definition: HandlerId.h:163
static std::wostream & operator<<(std::wostream &out, const ChannelId &channelId)
Definition: ChannelId.h:224
const std::string & Utf8String() const
Convert the string to UTF-8.
Definition: HandlerId.h:202
bool operator<(const HandlerId &other) const
Less-than operator.
Definition: HandlerId.h:143
void RemoveString()
Remove the included string from the handler id.
Definition: HandlerId.h:115
DotsC_Int32 Int32
32 bit integer type.
Definition: Dob/Typesystem/Defs.h:69
HandlerId(const std::wstring &id)
Constructor.
Definition: HandlerId.h:68