ClientIdManager¶
-
class
kanzi::connect
::
ClientIdManager
¶ Client id allocation facility.
Public Functions
-
ClientIdManager
()¶ Constructor.
-
size_t
allocate
(const string &type, int handle)¶ Allocates client identifier.
- Return
identifier. 0 (=INVALID_CLIENT_IDENTIFIER) indicates invalid value.
- Parameters
type
: the type of client identifier to allocate.handle
:
-
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 typemaxConnectionCount
: 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.
- Return
native handle. -1 is returned if not found.
- Parameters
handle
: the handle to translate
-
int
translateAndFree
(size_t handle)¶ Translate a pseudo handle to a native handle and with same call free the mapping.
- Return
native handle. -1 is returned if not found.
- Parameters
handle
: the handle to translate
-
const string &
typeOf
(size_t handle) const¶ Returns the type identifier of the specific handle.
- Return
type identifier string. empty string returned if not found.
- Parameters
handle
: handle to examine
-