![]() |
RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
|
Everything a component creator needs, bundled so every creator can share one signature and live in the factory's lookup map. More...
#include <ComponentCreationContext.h>
Public Member Functions | |
| ComponentCreationContext (const nlohmann::json &entry, std::map< std::string, IAnalogDigitalConverterComponent * > &adcsByType, const RumPiConfig &config) | |
| Binds the references the component creators read from. More... | |
| const nlohmann::json & | GetEntry () const |
| Gets the manifest entry describing the component to build. More... | |
| std::map< std::string, IAnalogDigitalConverterComponent * > & | GetAdcsByType () |
| Gets the map of ADC providers created so far, keyed by type name. More... | |
| const RumPiConfig & | GetConfig () const |
| Gets the loaded library configuration, for components whose settings come from config. More... | |
Private Attributes | |
| const nlohmann::json & | myEntry |
| The manifest entry (a JSON object) describing the component to build - its "type" and its parameters. More... | |
| std::map< std::string, IAnalogDigitalConverterComponent * > & | myAdcsByType |
| ADC providers created earlier in the build pass, keyed by type name. More... | |
| const RumPiConfig & | myConfig |
| The loaded library configuration, for components whose settings come from config (e.g. TSL2591 cutoffs). More... | |
Everything a component creator needs, bundled so every creator can share one signature and live in the factory's lookup map.
The members are references bound once (by the dispatcher) and only read by the creators, so this exposes getters but no setters - a reference cannot be re-pointed after construction.
| RumPi::ComponentCreationContext::ComponentCreationContext | ( | const nlohmann::json & | entry, |
| std::map< std::string, IAnalogDigitalConverterComponent * > & | adcsByType, | ||
| const RumPiConfig & | config | ||
| ) |
Binds the references the component creators read from.
The members are references, so they must be set here (in the initializer list) and cannot be re-pointed afterwards.
| [in] | entry | The manifest entry describing the component to build. |
| [in,out] | adcsByType | The ADC providers created so far, keyed by type name. |
| [in] | config | The loaded library configuration. |
| std::map< std::string, IAnalogDigitalConverterComponent * > & RumPi::ComponentCreationContext::GetAdcsByType | ( | ) |
Gets the map of ADC providers created so far, keyed by type name.
A creator that is an ADC registers itself here; a creator that reads through one looks its ADC up here.
| const RumPiConfig & RumPi::ComponentCreationContext::GetConfig | ( | ) | const |
Gets the loaded library configuration, for components whose settings come from config.
| const nlohmann::json & RumPi::ComponentCreationContext::GetEntry | ( | ) | const |
Gets the manifest entry describing the component to build.
|
private |
ADC providers created earlier in the build pass, keyed by type name.
A creator that IS an ADC registers itself here; a creator that reads through one (e.g. the wind or gas sensors) looks its ADC up here.
|
private |
The loaded library configuration, for components whose settings come from config (e.g. TSL2591 cutoffs).
|
private |
The manifest entry (a JSON object) describing the component to build - its "type" and its parameters.