Icarus
Vehicle Simulation as a Transformable Computational Graph, built on Vulcan and Janus
Loading...
Searching...
No Matches
icarus::ComponentConfig Struct Reference

Configuration container for components. More...

#include <ComponentConfig.hpp>

Public Member Functions

template<typename T>
Require (const std::string &key) const
 Get a required config value (throws if missing).
template<typename T>
Get (const std::string &key, const T &default_value) const
 Get an optional config value with default.
template<typename T>
bool Has (const std::string &key) const
 Check if a key exists.
std::string FullPath () const
 Get the full component path: entity.name (or just name if no entity).
template<>
double Get (const std::string &key, const double &def) const
template<>
double Require (const std::string &key) const
template<>
bool Has (const std::string &key) const
template<>
int Get (const std::string &key, const int &def) const
template<>
int Require (const std::string &key) const
template<>
bool Has (const std::string &key) const
template<>
int64_t Get (const std::string &key, const int64_t &def) const
template<>
int64_t Require (const std::string &key) const
template<>
bool Has (const std::string &key) const
template<>
bool Get (const std::string &key, const bool &def) const
template<>
bool Require (const std::string &key) const
template<>
bool Has (const std::string &key) const
template<>
Vec3< double > Get (const std::string &key, const Vec3< double > &def) const
template<>
Vec3< double > Require (const std::string &key) const
template<>
bool Has (const std::string &key) const
template<>
Vec4< double > Get (const std::string &key, const Vec4< double > &def) const
template<>
Vec4< double > Require (const std::string &key) const
template<>
bool Has (const std::string &key) const

Public Attributes

std::string name
 Component instance name.
std::string entity
 Entity namespace (optional).
std::string type
 Component type name.
std::unordered_map< std::string, double > scalars
std::unordered_map< std::string, std::vector< double > > vectors
 Vec3 stored as [x,y,z].
std::unordered_map< std::string, std::vector< double > > arrays
std::unordered_map< std::string, std::string > strings
std::unordered_map< std::string, int64_t > integers
std::unordered_map< std::string, bool > booleans
std::vector< std::string > sources
 List-based config (for aggregators with variable source counts, etc.).
std::vector< std::string > body_sources
 Frame-categorized source lists (for ForceAggregator frame transformations).
std::vector< std::string > ecef_sources
 Sources outputting in ECEF frame.

Detailed Description

Configuration container for components.

Passed to Provision() and Stage(). Components request values using typed accessors. This is the ONLY way to configure a component beyond the constructor (which only takes name/entity).

Example usage in Provision():

void Provision(Backplane<Scalar>& bp, const ComponentConfig& cfg) override {
mass_ = cfg.Require<double>("mass"); // Throws if missing
cd_ = cfg.Get<double>("drag_coefficient", 0.5); // With default
position_ = cfg.Get<Vec3<double>>("initial_position", Vec3<double>::Zero());
}
Component-facing facade for signal registration and resolution.
Definition Backplane.hpp:32
@ Provision
Definition Error.hpp:231
Configuration container for components.
Definition ComponentConfig.hpp:37
T Get(const std::string &key, const T &default_value) const
Get an optional config value with default.
T Require(const std::string &key) const
Get a required config value (throws if missing).

Member Function Documentation

◆ FullPath()

std::string icarus::ComponentConfig::FullPath ( ) const
inlinenodiscard

Get the full component path: entity.name (or just name if no entity).

◆ Get() [1/7]

template<>
bool icarus::ComponentConfig::Get ( const std::string & key,
const bool & def ) const
inline

◆ Get() [2/7]

template<>
double icarus::ComponentConfig::Get ( const std::string & key,
const double & def ) const
inline

◆ Get() [3/7]

template<>
int icarus::ComponentConfig::Get ( const std::string & key,
const int & def ) const
inline

◆ Get() [4/7]

template<>
int64_t icarus::ComponentConfig::Get ( const std::string & key,
const int64_t & def ) const
inline

◆ Get() [5/7]

template<typename T>
T icarus::ComponentConfig::Get ( const std::string & key,
const T & default_value ) const

Get an optional config value with default.

Template Parameters
TValue type
Parameters
keyConfiguration key
default_valueValue to return if key is missing
Returns
Value of type T, or default_value if missing

◆ Get() [6/7]

template<>
Vec3< double > icarus::ComponentConfig::Get ( const std::string & key,
const Vec3< double > & def ) const
inline

◆ Get() [7/7]

template<>
Vec4< double > icarus::ComponentConfig::Get ( const std::string & key,
const Vec4< double > & def ) const
inline

◆ Has() [1/7]

template<>
bool icarus::ComponentConfig::Has ( const std::string & key) const
inline

◆ Has() [2/7]

template<>
bool icarus::ComponentConfig::Has ( const std::string & key) const
inline

◆ Has() [3/7]

template<>
bool icarus::ComponentConfig::Has ( const std::string & key) const
inline

◆ Has() [4/7]

template<>
bool icarus::ComponentConfig::Has ( const std::string & key) const
inline

◆ Has() [5/7]

template<>
bool icarus::ComponentConfig::Has ( const std::string & key) const
inline

◆ Has() [6/7]

template<>
bool icarus::ComponentConfig::Has ( const std::string & key) const
inline

◆ Has() [7/7]

template<typename T>
bool icarus::ComponentConfig::Has ( const std::string & key) const
nodiscard

Check if a key exists.

Template Parameters
TValue type (determines which storage to check)
Parameters
keyConfiguration key
Returns
True if key exists in appropriate storage

◆ Require() [1/7]

template<>
Vec4< double > icarus::ComponentConfig::Require ( const std::string & key) const
inline

◆ Require() [2/7]

template<>
Vec3< double > icarus::ComponentConfig::Require ( const std::string & key) const
inline

◆ Require() [3/7]

template<>
bool icarus::ComponentConfig::Require ( const std::string & key) const
inline

◆ Require() [4/7]

template<>
int64_t icarus::ComponentConfig::Require ( const std::string & key) const
inline

◆ Require() [5/7]

template<>
int icarus::ComponentConfig::Require ( const std::string & key) const
inline

◆ Require() [6/7]

template<>
double icarus::ComponentConfig::Require ( const std::string & key) const
inline

◆ Require() [7/7]

template<typename T>
T icarus::ComponentConfig::Require ( const std::string & key) const

Get a required config value (throws if missing).

Template Parameters
TValue type
Parameters
keyConfiguration key
Returns
Value of type T
Exceptions
ConfigErrorif key is missing

Member Data Documentation

◆ arrays

std::unordered_map<std::string, std::vector<double> > icarus::ComponentConfig::arrays

◆ body_sources

std::vector<std::string> icarus::ComponentConfig::body_sources

Frame-categorized source lists (for ForceAggregator frame transformations).

Sources outputting in body frame

◆ booleans

std::unordered_map<std::string, bool> icarus::ComponentConfig::booleans

◆ ecef_sources

std::vector<std::string> icarus::ComponentConfig::ecef_sources

Sources outputting in ECEF frame.

◆ entity

std::string icarus::ComponentConfig::entity

Entity namespace (optional).

◆ integers

std::unordered_map<std::string, int64_t> icarus::ComponentConfig::integers

◆ name

std::string icarus::ComponentConfig::name

Component instance name.

◆ scalars

std::unordered_map<std::string, double> icarus::ComponentConfig::scalars

◆ sources

std::vector<std::string> icarus::ComponentConfig::sources

List-based config (for aggregators with variable source counts, etc.).

◆ strings

std::unordered_map<std::string, std::string> icarus::ComponentConfig::strings

◆ type

std::string icarus::ComponentConfig::type

Component type name.

◆ vectors

std::unordered_map<std::string, std::vector<double> > icarus::ComponentConfig::vectors

Vec3 stored as [x,y,z].


The documentation for this struct was generated from the following file: