NDEVR
API Documentation
DeviceManager.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Device.h>
4#include <QObject>
5namespace NDEVR
6{
10 class HARDWARE_API DeviceManager : public QObject
11 {
12 Q_OBJECT
13 public:
23 bool hasDevice(const UUID& id) const
24 {
25 return m_device_lookup.hasKey(id);
26 }
27
32 Device* device(const UUID& id)
33 {
34 return m_device_lookup.get(id);
35 }
36
45 void removeDevice(const UUID& id);
49 void update();
55 signals:
65 void deviceRemovedSignal(const UUID& id);
66
67 protected:
70 };
71}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
void deviceRemovedSignal(const UUID &id)
Emitted when a device has been removed.
DeviceManager()
Constructs an empty DeviceManager.
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.
static DeviceManager & DefaultManager()
Returns the singleton default DeviceManager instance.
Buffer< UUID > m_added_objects
UUIDs of devices added but not yet signaled.
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.
Dictionary< UUID, Device * > m_device_lookup
Map of device UUIDs to their Device pointers.
Device * device(const UUID &id)
Returns the device with the given UUID.
void addDevice(Device *device)
Registers a device with the manager.
A root class which describes some physical object, such as a Motor, Sensor, or Connection.
Definition Device.h:54
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.