NDEVR
API Documentation
DeviceManager

Container for all active Devices connected to the software. More...

Collaboration diagram for DeviceManager:
[legend]

Public Member Functions

 DeviceManager ()
 Constructs an empty DeviceManager.
void addDevice (Device *device)
 Registers a device with the manager.
Devicedevice (const UUID &id)
 Returns the device with the given UUID.
void deviceRemovedSignal (const UUID &id)
 Emitted when a device has been removed.
void devicesAddedSignal (const Buffer< UUID > &ids)
 Emitted when one or more devices have been added.
bool hasDevice (const UUID &id) const
 Checks whether a device with the given UUID is registered.
void removeDevice (const UUID &id)
 Removes a device from the manager by its UUID.
void update ()
 Emits signals for any devices that have been added since the last update.

Static Public Member Functions

static DeviceManagerDefaultManager ()
 Returns the singleton default DeviceManager instance.

Protected Attributes

Buffer< UUIDm_added_objects
 UUIDs of devices added but not yet signaled.
Dictionary< UUID, Device * > m_device_lookup
 Map of device UUIDs to their Device pointers.

Detailed Description

Container for all active Devices connected to the software.


Definition at line 10 of file DeviceManager.h.

Member Function Documentation

◆ addDevice()

void DeviceManager::addDevice ( Device * device)

Registers a device with the manager.

Parameters
[in]deviceThe device to add.

References device().

◆ DefaultManager()

DeviceManager & DeviceManager::DefaultManager ( )
static

Returns the singleton default DeviceManager instance.

Returns
A reference to the default DeviceManager.

References DeviceManager().

◆ device()

Device * DeviceManager::device ( const UUID & id)
inline

Returns the device with the given UUID.

Parameters
[in]idThe UUID of the device to retrieve.
Returns
A pointer to the Device, or nullptr if not found.

Definition at line 32 of file DeviceManager.h.

References m_device_lookup.

Referenced by addDevice().

◆ deviceRemovedSignal()

void DeviceManager::deviceRemovedSignal ( const UUID & id)

Emitted when a device has been removed.

Parameters
[in]idThe UUID of the removed device.

◆ devicesAddedSignal()

void DeviceManager::devicesAddedSignal ( const Buffer< UUID > & ids)

Emitted when one or more devices have been added.

Parameters
[in]idsThe UUIDs of the newly added devices.

◆ hasDevice()

bool DeviceManager::hasDevice ( const UUID & id) const
inline

Checks whether a device with the given UUID is registered.

Parameters
[in]idThe UUID of the device to check.
Returns
True if a device with the given id exists in the manager.

Definition at line 23 of file DeviceManager.h.

References m_device_lookup.

◆ removeDevice()

void DeviceManager::removeDevice ( const UUID & id)

Removes a device from the manager by its UUID.

Parameters
[in]idThe UUID of the device to remove.

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