25#ifndef __DOTS_HANDLER_ID_H__
26#define __DOTS_HANDLER_ID_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;
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();}
225 {
return std::hash<HandlerId::UnderlyingType>()(val.
GetRawValue());}
#define __WFILE__
Definition Exceptions.h:31
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition Backdoor.h:31
std::size_t hash_value(const Safir::Dob::Typesystem::ChannelId &val)
Definition ChannelId.h:228
DotsC_Int32 Int32
32 bit integer type.
Definition Defs.h:66
DotsC_Int64 Int64
64 bit integer type.
Definition Defs.h:69
static std::wostream & operator<<(std::wostream &out, const ChannelId &channelId)
Definition ChannelId.h:224
DOTS_CPP_API const std::string ToUtf8(const std::wstring &wstr)
Convert a std::wstring to UTF8-encoded std::string.
Meant to be used when something goes very wrong.
Definition Exceptions.h:364
Class containing the identity of a handler.
Definition HandlerId.h:46
HandlerId(const Int64 id, const std::wstring &idStr)
Constructor.
Definition HandlerId.h:92
const std::wstring & GetRawString() const
Get the string that was used to create this id.
Definition HandlerId.h:172
Int64 UnderlyingType
Definition HandlerId.h:156
HandlerId()
Default constructor.
Definition HandlerId.h:56
static DOTS_CPP_API const HandlerId ALL_HANDLERS
Constant representing all handlers.
Definition HandlerId.h:49
DOTS_CPP_API const std::wstring ToString() const
Return a string representation of the handler id.
const std::string & Utf8String() const
Convert the string to UTF-8.
Definition HandlerId.h:202
UnderlyingType GetRawValue() const
Get the raw 64 bit integer identifier.
Definition HandlerId.h:163
HandlerId(const std::wstring &id)
Constructor.
Definition HandlerId.h:68
HandlerId(const Int64 id)
Constructor.
Definition HandlerId.h:80
Int32 Utf8StringLength() const
Get the length of the string when converted to UTF-8 encoding.
Definition HandlerId.h:180
void RemoveString()
Remove the included string from the handler id.
Definition HandlerId.h:115
bool operator<(const HandlerId &other) const
Less-than operator.
Definition HandlerId.h:143
bool operator!=(const HandlerId &other) const
Inequality operator.
Definition HandlerId.h:132
bool operator==(const HandlerId &other) const
Equality operator.
Definition HandlerId.h:122
#define DOTS_CPP_API
Definition Defs.h:33