ClientIdManager::Range

class kanzi::connect::ClientIdManager::Range

Defines a range for connection type.

Public Functions

Range(size_t base, size_t amount)

Constructor.

Parameters
  • base – the base number where to start allocating of numbers. Must be greater than 0.

  • amount – the size of range. Must be greater than 0.

bool contains(size_t handle) const

Determines whether the range contains a specific handle.

Parameters

handle – the handle

Returns

true if contains handle

bool tryAllocate(size_t &result, int handle)

Tries to allocate new slot.

Parameters
  • result – will hold the result value.

  • handle – the handle to store.

Returns

true if successfully allocated an object.

bool tryFree(size_t handle)

Tries to free previously allocated handle.

Parameters

handle – the handle to allocate

Returns

true if successfully free (i.e. object was in a range).

bool tryTranslate(size_t handle, int &nativeHandle) const

Tries to translate provided pseudo handle to a native handle.

Parameters
  • handle – pseudo handle

  • nativeHandle – the native handle that is returned

Returns

true if translation succeeded, false if not found.