12 #ifndef __UNI_SessionID_h__
13 #define __UNI_SessionID_h__
31 :
UNI_ID( session_id_number ) {}
39 UNI_GraphID decodeGraphID()
const;
49 template <
typename LOCAL_ID>
87 #define UNI_SESSION_ID_FORMATTER(UniSesID) \
89 UTformatBuffer(char *buffer, size_t buffer_size, const UniSesID &v) \
91 UT::Format::Writer w(buffer, buffer_size); \
92 UT::Format::Formatter f; \
93 return f.format(w, #UniSesID "({}={}:{})", {v.exintValue(), \
94 v.graphID().exintValue(), v.localID().exintValue()}); \
97 UTformatBuffer(char *buffer, size_t buffer_size, const UT_Array<UniSesID> &v) \
99 UT::Format::Writer w(buffer, buffer_size); \
100 UT::Format::Formatter f; \
101 size_t bytesWritten = w("UT_Array<" #UniSesID ">([", \
102 sizeof("UT_Array<" #UniSesID ">([")-1); \
104 for (auto &&item : v) \
106 bytesWritten += f.format(w, first ? "{}" : ", {}", \
107 {item.exintValue()}); \
110 bytesWritten += w("])", 2); \
111 return bytesWritten; \
#define UNI_SESSION_ID_FORMATTER(UniSesID)
String formatting ID for debug printouts, etc:
UNI_SessionID(UNI_GraphID graph_id, LOCAL_ID local_id)
exint NumericType
Numerical representation of the ID.
LOCAL_ID localID() const
Returns the local ID of an item, locating it within the given graph.
UNI_SessionIDCoder(UNI_ID::NumericType session_id_number)
Creates a unique global ID from a raw numerical value.
UNI_ID::NumericType decodeItemID() const
Returns the numeric value of the item ID encoded in this session ID.
UNI_SessionID(UNI_ID::NumericType id=INVALID_ID)
Creates a unique global ID from a raw numerical value.
UNI_GraphID decodeGraphID() const
Returns the graph ID encoded in this session ID.
UNI_GraphID graphID() const
Returns the UNI graph ID encoded in this session ID.
constexpr NumericType numericValue() const
Returns the numeric value of this ID.
static constexpr NumericType INVALID_ID