RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
RumPi::ComponentFactory Class Reference

Builds the sensor components described by a JSON manifest and adds them to a ComponentManager. More...

#include <ComponentFactory.h>

Static Public Member Functions

static int BuildComponents (ComponentManager &manager, const nlohmann::json &configJson, const RumPiConfig &config)
 Reads the "components" array from an already-parsed config JSON and adds a live component to 'manager' for each entry. More...
 

Detailed Description

Builds the sensor components described by a JSON manifest and adds them to a ComponentManager.

This is the single place that knows how to construct each concrete component from its manifest entry, so neither the rest of the library nor the client needs to 'new' a specific sensor by hand.

Author
Eddie O'Hagan
Date
8/13/2026

Member Function Documentation

◆ BuildComponents()

int RumPi::ComponentFactory::BuildComponents ( ComponentManager manager,
const nlohmann::json &  configJson,
const RumPiConfig config 
)
static

Reads the "components" array from an already-parsed config JSON and adds a live component to 'manager' for each entry.

If the JSON has no "components" array, a built-in default manifest (the current robot) is used instead, so a usable set is always assembled. Individual bad entries are reported via AlertManager and skipped.

Author
Eddie O'Hagan
Date
8/13/2026
ComponentManager manager;
int built = ComponentFactory::BuildComponents(manager, configJson, config);
static int BuildComponents(ComponentManager &manager, const nlohmann::json &configJson, const RumPiConfig &config)
Reads the "components" array from an already-parsed config JSON and adds a live component to 'manager...
Definition: ComponentFactory.cpp:917
Parameters
[in,out]managerThe component manager to add the built components to.
[in]configJsonThe parsed config JSON (its "components" array drives the build).
[in]configThe loaded library configuration, passed to components that need it.
Returns
The number of components created.

The documentation for this class was generated from the following files: