Registry and dispatcher for I/O devices.
More...
#include <device_manager.h>
|
| std::unique_ptr< Impl > | impl_ |
Registry and dispatcher for I/O devices.
The DeviceManager owns all registered devices (via unique_ptr) and provides lookup by DeviceId for read/write dispatch.
Definition at line 26 of file device_manager.h.
◆ DeviceManager() [1/3]
| contur::DeviceManager::DeviceManager |
( |
| ) |
|
◆ ~DeviceManager()
| contur::DeviceManager::~DeviceManager |
( |
| ) |
|
◆ DeviceManager() [2/3]
| contur::DeviceManager::DeviceManager |
( |
const DeviceManager & | | ) |
|
|
delete |
◆ DeviceManager() [3/3]
| contur::DeviceManager::DeviceManager |
( |
DeviceManager && | | ) |
|
|
noexcept |
◆ deviceCount()
| std::size_t contur::DeviceManager::deviceCount |
( |
| ) |
const |
|
nodiscardnoexcept |
Returns the number of registered devices.
◆ getDevice() [1/2]
| std::optional< std::reference_wrapper< const IDevice > > contur::DeviceManager::getDevice |
( |
DeviceId | id | ) |
const |
|
nodiscardnoexcept |
Returns a const non-owning reference to the device with the given ID, if present.
◆ getDevice() [2/2]
| std::optional< std::reference_wrapper< IDevice > > contur::DeviceManager::getDevice |
( |
DeviceId | id | ) |
|
|
nodiscardnoexcept |
Returns a non-owning reference to the device with the given ID, if present.
◆ hasDevice()
| bool contur::DeviceManager::hasDevice |
( |
DeviceId | id | ) |
const |
|
nodiscardnoexcept |
Returns true if a device with the given ID is registered.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ read()
Reads a value from the device with the given ID.
- Returns
- The read value, or NotFound/DeviceError on failure.
◆ registerDevice()
| Result< void > contur::DeviceManager::registerDevice |
( |
std::unique_ptr< IDevice > | device | ) |
|
|
nodiscard |
Registers a device. Takes ownership.
- Parameters
-
| device | The device to register. |
- Returns
- Success, or AlreadyExists if a device with the same ID is already registered.
◆ unregisterDevice()
Removes and destroys a device by ID.
- Returns
- Success, or NotFound if no device with the given ID exists.
◆ write()
Writes a value to the device with the given ID.
- Returns
- Success, or NotFound/DeviceError on failure.
◆ impl_
| std::unique_ptr<Impl> contur::DeviceManager::impl_ |
|
private |
The documentation for this class was generated from the following file: