ClientIdManager¶
-
class
kanzi::connect
::
ClientIdManager
¶ Client id allocation facility.
Public Functions
-
ClientIdManager
()¶ Constructor.
-
size_t
allocate
(const string &type, int handle)¶ Allocates client identifier.
- Parameters
type – the type of client identifier to allocate.
handle –
- Returns
identifier. 0 (=INVALID_CLIENT_IDENTIFIER) indicates invalid value.
-
void
free
(size_t handle)¶ Frees an object.
- Parameters
handle – the handle to free.
-
bool
registerConnectionType
(const string &connectionType, unsigned int maxConnectionCount)¶ Register a connection type to the manager Note: double registration is allowed and does not lead to duplicate connection ranges.
- Parameters
connectionType – Identifies the connection type
maxConnectionCount – How many connections of this type are allowed simultaneously to be reserved
-
int
translate
(size_t handle) const¶ Translate a pseudo handle to a native handle.
Type information not passed so searches for suitable native handle from all the types.
- Parameters
handle – the handle to translate
- Returns
native handle. -1 is returned if not found.
-
int
translateAndFree
(size_t handle)¶ Translate a pseudo handle to a native handle and with same call free the mapping.
- Parameters
handle – the handle to translate
- Returns
native handle. -1 is returned if not found.
-
const string &
typeOf
(size_t handle) const¶ Returns the type identifier of the specific handle.
- Parameters
handle – handle to examine
- Returns
type identifier string. empty string returned if not found.
-