25 #ifndef __DOTS_HANDLER_ID_H__
26 #define __DOTS_HANDLER_ID_H__
31 #include <Safir/Dob/Typesystem/Internal/InternalOperations.h>
56 m_handlerId(Internal::DEFAULT_HANDLER_ID),
57 m_handlerIdStr(L
"DEFAULT_HANDLER")
68 m_handlerId(Internal::Generate64BitHash(id)),
96 if (!m_handlerIdStr.empty() && m_handlerId != Internal::Generate64BitHash(idStr))
98 std::wostringstream ostr;
99 ostr <<
"HandlerId two-argument constructor got an inconsistent id. Got ("
100 <<
id <<
", '" << idStr <<
"'), but the string evaluates to " << Internal::Generate64BitHash(idStr) <<
".";
114 void RemoveString() {m_handlerIdStr.clear(); m_CachedUtf8String.clear();}
123 return m_handlerId == other.m_handlerId;
133 return !(*
this==other);
144 return m_handlerId < other.m_handlerId;
181 if (m_handlerIdStr.empty())
186 if (m_CachedUtf8String.empty())
191 return static_cast<Int32>(m_CachedUtf8String.length() + 1);
203 if (!m_handlerIdStr.empty() && m_CachedUtf8String.empty())
207 return m_CachedUtf8String;
214 std::wstring m_handlerIdStr;
216 mutable std::string m_CachedUtf8String;
220 {
return out << handlerId.
ToString();}
const std::wstring & GetRawString() const
Get the string that was used to create this id.
Definition: HandlerId.h:171
Int32 Utf8StringLength() const
Get the length of the string when converted to UTF-8 encoding.
Definition: HandlerId.h:179
Class containing the identity of a handler.
Definition: HandlerId.h:44
Meant to be used when something goes very wrong.
Definition: Exceptions.h:360
DotsC_Int64 Int64
64 bit integer type.
Definition: Defs.h:70
Int64 UnderlyingType
Definition: HandlerId.h:155
HandlerId()
Default constructor.
Definition: HandlerId.h:55
static DOTS_CPP_API const HandlerId ALL_HANDLERS
Constant representing all handlers.
Definition: HandlerId.h:48
bool operator!=(const HandlerId &other) const
Inequality operator.
Definition: HandlerId.h:131
HandlerId(const Int64 id, const std::wstring &idStr)
Constructor.
Definition: HandlerId.h:91
#define __WFILE__
Definition: Exceptions.h:31
bool operator==(const HandlerId &other) const
Equality operator.
Definition: HandlerId.h:121
HandlerId(const Int64 id)
Constructor.
Definition: HandlerId.h:79
UnderlyingType GetRawValue() const
Get the raw 64 bit integer identifier.
Definition: HandlerId.h:162
static std::wostream & operator<<(std::wostream &out, const ChannelId &channelId)
Definition: ChannelId.h:223
const std::string & Utf8String() const
Convert the string to UTF-8.
Definition: HandlerId.h:201
bool operator<(const HandlerId &other) const
Less-than operator.
Definition: HandlerId.h:142
void RemoveString()
Remove the included string from the handler id.
Definition: HandlerId.h:114
DotsC_Int32 Int32
32 bit integer type.
Definition: Defs.h:67
HandlerId(const std::wstring &id)
Constructor.
Definition: HandlerId.h:67
#define DOTS_CPP_API
Definition: Defs.h:33
DOTS_CPP_API const std::string ToUtf8(const std::wstring &wstr)
Convert a std::wstring to UTF8-encoded std::string.
DOTS_CPP_API const std::wstring ToString() const
Return a string representation of the handler id.