peary::hal::Component
peary::hal::Component
This class serves as base class for a unified interface to hardware components. More…
#include <peary/hal/Components.hpp>
Public Functions
| Name | |
|---|---|
| template <typename… Args> requires std::constructible_from< Interface, Args… > | Component(Args &&… args)Constructor which stores argument pack in a functional to generate the interface when accessed. |
| Component() =delete | |
| virtual | ~Component() =default |
| Interface & | interface()Accessor function for the interface. |
Detailed Description
template <typename Interface >
class peary::hal::Component;
This class serves as base class for a unified interface to hardware components.
Public Functions Documentation
function Component
template <typename... Args>
inline explicit requires std::constructible_from< Interface, Args... > Component(
Args &&... args
)
Constructor which stores argument pack in a functional to generate the interface when accessed.
Parameters:
- args Argument pack passed on to the interface endpoint constructor
This constructor takes an argument pack, passes it to a lambda for generating an interface endpoint instance, and stored this lambda as generator function. This way we do not have to template the entire class with the argument pack, and therefore do not need to repeat the argument types when instantiation a Component class - but only the Interface. A concept ensures that we can construct the interface.
function Component
Component() =delete
function ~Component
virtual ~Component() =default
function interface
inline Interface & interface()
Accessor function for the interface.
Return: Reference to interface endpoint
When the interface has not been instantiated yet, this calls the generator function and returns a reference to the interface, otherwise it returns the reference directly. This implements lazy interface endpoint instantiation by only opening the connection when requested.
Updated on 2026-01-30 at 22:01:05 +0100