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.

Return

true if contains handle

Parameters
  • handle: the handle

bool tryAllocate(size_t &result, int handle)

Tries to allocate new slot.

Return

true if successfully allocated an object.

Parameters
  • result: will hold the result value.

  • handle: the handle to store.

bool tryFree(size_t handle)

Tries to free previously allocated handle.

Return

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

Parameters
  • handle: the handle to allocate

bool tryTranslate(size_t handle, int &nativeHandle) const

Tries to translate provided pseudo handle to a native handle.

Return

true if translation succeeded, false if not found.

Parameters
  • handle: pseudo handle

  • nativeHandle: the native handle that is returned