peary::device::DeviceManager

Peary Device Manager. More…

#include <peary/device/DeviceManager.hpp>

Public Functions

Name
DeviceManager()Default constructor.
~DeviceManager()Destructor.
bool hasDevice(std::string_view name) constCheck if a device with this name is registered.
Device * getDevice(size_t id)Get a device by its ID.
Device * getDevice(std::string_view name)Get a device by its unique name.
std::vector< std::pair< std::string, Device * > > getDevices()Get a list of all managed devices.
size_t addDevice(std::string_view name, std::string_view type, const config::Configuration & config)Add a new device by loading its library and instantiating it.
void clearDevices()Clear all devices, deleting their instances.

Detailed Description

  class peary::device::DeviceManager;
  

Peary Device Manager.

This class holds is the interface between the individual devices and the actual setup. It loads the required device device library at runtime, the device library is identified by the device name.

Public Functions Documentation

function DeviceManager

  DeviceManager()
  

Default constructor.

function ~DeviceManager

  ~DeviceManager()
  

Destructor.

function hasDevice

  bool hasDevice(
    std::string_view name
) const
  

Check if a device with this name is registered.

Parameters:

  • name Name of the device

Return: True if a device is registered under this name, false otherwise

function getDevice

  Device * getDevice(
    size_t id
)
  

Get a device by its ID.

Parameters:

  • id ID of the device to be retrieved

Return: Pointer to the device instance

function getDevice

  Device * getDevice(
    std::string_view name
)
  

Get a device by its unique name.

Parameters:

  • name Name of the device to be retrieved

Return: Pointer to the device instance

function getDevices

  std::vector< std::pair< std::string, Device * > > getDevices()
  

Get a list of all managed devices.

Return: Vector with pairs of device name and device pointers for all managed devices

function addDevice

  size_t addDevice(
    std::string_view name,
    std::string_view type,
    const config::Configuration & config
)
  

Add a new device by loading its library and instantiating it.

Parameters:

  • name Name of the device to be added
  • type Type/class name of the device to be added
  • config Configuration object for the device

Return: ID of the newly added device

function clearDevices

  void clearDevices()
  

Clear all devices, deleting their instances.


Updated on 2026-01-30 at 22:01:05 +0100