Kanzi Connect  3.9.9
Kanzi Connect C++ API
kanzi::connect::ClientIdManager Class Reference

Client id allocation facility. More...

#include <client_id_manager.hpp>

Public Member Functions

size_t allocate (const string &type, int handle)
 Allocates client identifier. More...
 
 ClientIdManager ()
 Constructor. More...
 
void free (size_t handle)
 Frees an object. More...
 
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. More...
 
int translate (size_t handle) const
 Translate a pseudo handle to a native handle. More...
 
int translateAndFree (size_t handle)
 Translate a pseudo handle to a native handle and with same call free the mapping. More...
 
const string & typeOf (size_t handle) const
 Returns the type identifier of the specific handle. More...
 

Static Public Attributes

static const string TYPE_HTTP
 
static const string TYPE_SCRIPTING
 
static const string TYPE_SHAREDMEMORY
 
static const string TYPE_SOCKET
 

Detailed Description

Client id allocation facility.

Constructor & Destructor Documentation

◆ ClientIdManager()

kanzi::connect::ClientIdManager::ClientIdManager ( )

Constructor.

Member Function Documentation

◆ allocate()

size_t kanzi::connect::ClientIdManager::allocate ( const string &  type,
int  handle 
)

Allocates client identifier.

Parameters
typethe type of client identifier to allocate.
handle
Returns
identifier. 0 (=INVALID_CLIENT_IDENTIFIER) indicates invalid value.

◆ free()

void kanzi::connect::ClientIdManager::free ( size_t  handle)

Frees an object.

Parameters
handlethe handle to free.

◆ registerConnectionType()

bool kanzi::connect::ClientIdManager::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
connectionTypeIdentifies the connection type
maxConnectionCountHow many connections of this type are allowed simultaneously to be reserved

◆ translate()

int kanzi::connect::ClientIdManager::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
handlethe handle to translate
Returns
native handle. -1 is returned if not found.

◆ translateAndFree()

int kanzi::connect::ClientIdManager::translateAndFree ( size_t  handle)

Translate a pseudo handle to a native handle and with same call free the mapping.

Parameters
handlethe handle to translate
Returns
native handle. -1 is returned if not found.

◆ typeOf()

const string& kanzi::connect::ClientIdManager::typeOf ( size_t  handle) const

Returns the type identifier of the specific handle.

Parameters
handlehandle to examine
Returns
type identifier string. empty string returned if not found.

Member Data Documentation

◆ TYPE_HTTP

const string kanzi::connect::ClientIdManager::TYPE_HTTP
static

◆ TYPE_SCRIPTING

const string kanzi::connect::ClientIdManager::TYPE_SCRIPTING
static

◆ TYPE_SHAREDMEMORY

const string kanzi::connect::ClientIdManager::TYPE_SHAREDMEMORY
static

◆ TYPE_SOCKET

const string kanzi::connect::ClientIdManager::TYPE_SOCKET
static

The documentation for this class was generated from the following file: