Icarus
Vehicle Simulation as a Transformable Computational Graph, built on Vulcan and Janus
Loading...
Searching...
No Matches
icarus::Backplane< Scalar > Class Template Reference

Component-facing facade for signal registration and resolution. More...

#include <Backplane.hpp>

Public Member Functions

 Backplane (SignalRegistry< Scalar > &registry)
void set_context (const std::string &entity, const std::string &component)
 Set current component context.
void set_epoch (const vulcan::time::Epoch< Scalar > *epoch)
 Set epoch reference for component binding.
template<typename ComponentType>
void bind_epoch_to (ComponentType &comp)
 Bind epoch reference to a component.
void clear_context ()
 Clear the current context.
std::string full_prefix () const
 Get full prefix: entity.component (or just component if no entity).
template<typename T>
void register_output (const std::string &local_name, T *data_ptr, const std::string &unit="", const std::string &description="")
 Register a scalar output signal.
template<typename S>
void register_output_vec3 (const std::string &local_name, Vec3< S > *data_ptr, const std::string &unit="", const std::string &description="")
 Register a Vec3 output signal (expands to .x/.y/.z).
template<typename S>
void register_output_quat (const std::string &local_name, Vec4< S > *data_ptr, const std::string &unit="", const std::string &description="")
 Register a quaternion output signal (expands to .w/.x/.y/.z).
template<typename T>
void register_state (const std::string &local_name, T *value, T *derivative, const std::string &unit="", const std::string &description="")
 Register a scalar state with its derivative.
template<typename S>
void register_state_vec3 (const std::string &local_name, Vec3< S > *value, Vec3< S > *derivative, const std::string &unit="", const std::string &description="")
 Register a Vec3 state with its derivative.
template<typename S>
void register_state_quat (const std::string &local_name, Vec4< S > *value, Vec4< S > *derivative, const std::string &unit="", const std::string &description="")
 Register a quaternion state with its derivative.
template<typename T>
SignalHandle< T > resolve (const std::string &full_name)
 Resolve a signal by full path.
template<typename S>
Vec3Handle< S > resolve_vec3 (const std::string &full_name)
 Resolve a Vec3 signal.
template<typename S>
QuatHandle< S > resolve_quat (const std::string &full_name)
 Resolve a quaternion signal.
bool has_signal (const std::string &full_name) const
 Check if a signal exists.
template<typename T>
void register_input (const std::string &local_name, InputHandle< T > *handle, const std::string &units="", const std::string &description="")
 Register an input port.
void register_param (const std::string &local_name, Scalar *storage, Scalar initial_value, const std::string &units="", const std::string &description="")
 Register a Scalar parameter (optimizable).
void register_config (const std::string &local_name, int *storage, int initial_value, const std::string &description="")
 Register an int config value.
void register_config (const std::string &local_name, bool *storage, bool initial_value, const std::string &description="")
 Register a bool config value.
template<typename T>
void wire_input (const std::string &input_name, const std::string &source_name)
 Wire an input to a source signal.
template<typename T>
void declare_output (const std::string &local_name, T *data_ptr, const std::string &unit="", const std::string &description="")
 Declare an output port (Phase 4.0 semantic alias for register_output).
template<typename S>
void declare_output_vec3 (const std::string &local_name, Vec3< S > *data_ptr, const std::string &unit="", const std::string &description="")
 Declare a Vec3 output port.
template<typename T>
void declare_input (const std::string &local_name, InputHandle< T > *handle, const std::string &unit="", const std::string &description="")
 Declare an input port (Phase 4.0 semantic alias for register_input).
template<typename T>
void WireWithGain (const std::string &input_path, const std::string &output_path, double gain=1.0)
 Wire an input to a source with a gain factor.
void WireWithGain (const std::string &input_path, const std::string &output_path, double gain=1.0)
 Wire with gain (type-erased version for SignalRouter).
bool HasOutput (const std::string &full_name) const
 Check if an output signal exists.
bool HasInput (const std::string &full_name) const
 Check if an input port exists.
std::vector< std::string > GetDeclaredInputs () const
 Get all declared input paths.
std::vector< std::string > GetDeclaredOutputs () const
 Get all declared output paths.
const std::vector< std::string > & registered_outputs () const
 Get outputs registered by current component.
const std::vector< std::string > & registered_inputs () const
 Get inputs registered by current component (Phase 2.4).
const std::vector< std::string > & resolved_inputs () const
 Get legacy resolved inputs by current component.
const std::vector< std::string > & registered_params () const
 Get parameters registered by current component (Phase 2.4).
const std::vector< std::string > & registered_config () const
 Get config registered by current component (Phase 2.4).
void clear_tracking ()
 Clear tracking for next component.
SignalRegistry< Scalar > & registry ()
const SignalRegistry< Scalar > & registry () const

Detailed Description

template<typename Scalar>
class icarus::Backplane< Scalar >

Component-facing facade for signal registration and resolution.

Backplane adds:

  • Automatic full name generation (entity.component.signal)
  • Context tracking for dependency discovery
  • Cleaner API for component authors
Template Parameters
ScalarThe numeric type (double or casadi::MX)

Constructor & Destructor Documentation

◆ Backplane()

template<typename Scalar>
icarus::Backplane< Scalar >::Backplane ( SignalRegistry< Scalar > & registry)
inlineexplicit

Member Function Documentation

◆ bind_epoch_to()

template<typename Scalar>
template<typename ComponentType>
void icarus::Backplane< Scalar >::bind_epoch_to ( ComponentType & comp)
inline

Bind epoch reference to a component.

Called during Stage() to give the component read-only access to epoch. Component can then use GetEpoch()->jd_tt() etc. for time-dependent calcs.

◆ clear_context()

template<typename Scalar>
void icarus::Backplane< Scalar >::clear_context ( )
inline

Clear the current context.

◆ clear_tracking()

template<typename Scalar>
void icarus::Backplane< Scalar >::clear_tracking ( )
inline

Clear tracking for next component.

◆ declare_input()

template<typename Scalar>
template<typename T>
void icarus::Backplane< Scalar >::declare_input ( const std::string & local_name,
InputHandle< T > * handle,
const std::string & unit = "",
const std::string & description = "" )
inline

Declare an input port (Phase 4.0 semantic alias for register_input).

Use this in Provision() to declare what signals this component needs. SignalRouter will wire this input to its source.

Parameters
local_nameSignal name (without entity/component prefix)
handlePointer to InputHandle owned by component
unitPhysical unit
descriptionHuman-readable description

◆ declare_output()

template<typename Scalar>
template<typename T>
void icarus::Backplane< Scalar >::declare_output ( const std::string & local_name,
T * data_ptr,
const std::string & unit = "",
const std::string & description = "" )
inline

Declare an output port (Phase 4.0 semantic alias for register_output).

Use this in Provision() to declare what signals this component produces. SignalRouter will connect consumers to this output.

Parameters
local_nameSignal name (without entity/component prefix)
data_ptrPointer to component-owned storage
unitPhysical unit
descriptionHuman-readable description

◆ declare_output_vec3()

template<typename Scalar>
template<typename S>
void icarus::Backplane< Scalar >::declare_output_vec3 ( const std::string & local_name,
Vec3< S > * data_ptr,
const std::string & unit = "",
const std::string & description = "" )
inline

Declare a Vec3 output port.

◆ full_prefix()

template<typename Scalar>
std::string icarus::Backplane< Scalar >::full_prefix ( ) const
inlinenodiscard

Get full prefix: entity.component (or just component if no entity).

◆ GetDeclaredInputs()

template<typename Scalar>
std::vector< std::string > icarus::Backplane< Scalar >::GetDeclaredInputs ( ) const
inlinenodiscard

Get all declared input paths.

Used by SignalRouter to find unwired inputs.

◆ GetDeclaredOutputs()

template<typename Scalar>
std::vector< std::string > icarus::Backplane< Scalar >::GetDeclaredOutputs ( ) const
inlinenodiscard

Get all declared output paths.

◆ has_signal()

template<typename Scalar>
bool icarus::Backplane< Scalar >::has_signal ( const std::string & full_name) const
inlinenodiscard

Check if a signal exists.

◆ HasInput()

template<typename Scalar>
bool icarus::Backplane< Scalar >::HasInput ( const std::string & full_name) const
inlinenodiscard

Check if an input port exists.

◆ HasOutput()

template<typename Scalar>
bool icarus::Backplane< Scalar >::HasOutput ( const std::string & full_name) const
inlinenodiscard

Check if an output signal exists.

◆ register_config() [1/2]

template<typename Scalar>
void icarus::Backplane< Scalar >::register_config ( const std::string & local_name,
bool * storage,
bool initial_value,
const std::string & description = "" )
inline

Register a bool config value.

◆ register_config() [2/2]

template<typename Scalar>
void icarus::Backplane< Scalar >::register_config ( const std::string & local_name,
int * storage,
int initial_value,
const std::string & description = "" )
inline

Register an int config value.

◆ register_input()

template<typename Scalar>
template<typename T>
void icarus::Backplane< Scalar >::register_input ( const std::string & local_name,
InputHandle< T > * handle,
const std::string & units = "",
const std::string & description = "" )
inline

Register an input port.

Template Parameters
TThe value type
Parameters
local_nameLocal signal name
handlePointer to InputHandle owned by component
unitsPhysical units
descriptionHuman-readable description

◆ register_output()

template<typename Scalar>
template<typename T>
void icarus::Backplane< Scalar >::register_output ( const std::string & local_name,
T * data_ptr,
const std::string & unit = "",
const std::string & description = "" )
inline

Register a scalar output signal.

Parameters
local_nameSignal name (without entity/component prefix)
data_ptrPointer to component-owned storage
unitPhysical unit
descriptionHuman-readable description

◆ register_output_quat()

template<typename Scalar>
template<typename S>
void icarus::Backplane< Scalar >::register_output_quat ( const std::string & local_name,
Vec4< S > * data_ptr,
const std::string & unit = "",
const std::string & description = "" )
inline

Register a quaternion output signal (expands to .w/.x/.y/.z).

◆ register_output_vec3()

template<typename Scalar>
template<typename S>
void icarus::Backplane< Scalar >::register_output_vec3 ( const std::string & local_name,
Vec3< S > * data_ptr,
const std::string & unit = "",
const std::string & description = "" )
inline

Register a Vec3 output signal (expands to .x/.y/.z).

◆ register_param()

template<typename Scalar>
void icarus::Backplane< Scalar >::register_param ( const std::string & local_name,
Scalar * storage,
Scalar initial_value,
const std::string & units = "",
const std::string & description = "" )
inline

Register a Scalar parameter (optimizable).

◆ register_state()

template<typename Scalar>
template<typename T>
void icarus::Backplane< Scalar >::register_state ( const std::string & local_name,
T * value,
T * derivative,
const std::string & unit = "",
const std::string & description = "" )
inline

Register a scalar state with its derivative.

The state value is published as an output signal AND marked for integration. StateManager discovers these during DiscoverStates().

Template Parameters
TThe scalar type
Parameters
local_nameState name (without entity/component prefix)
valuePointer to state value storage
derivativePointer to derivative storage
unitPhysical unit
descriptionHuman-readable description

◆ register_state_quat()

template<typename Scalar>
template<typename S>
void icarus::Backplane< Scalar >::register_state_quat ( const std::string & local_name,
Vec4< S > * value,
Vec4< S > * derivative,
const std::string & unit = "",
const std::string & description = "" )
inline

Register a quaternion state with its derivative.

Creates 8 signals: 4 for value (.w/.x/.y/.z) and 4 for derivative (_dot.w/.x/.y/.z).

◆ register_state_vec3()

template<typename Scalar>
template<typename S>
void icarus::Backplane< Scalar >::register_state_vec3 ( const std::string & local_name,
Vec3< S > * value,
Vec3< S > * derivative,
const std::string & unit = "",
const std::string & description = "" )
inline

Register a Vec3 state with its derivative.

Creates 6 signals: 3 for value (.x/.y/.z) and 3 for derivative (_dot.x/.y/.z).

◆ registered_config()

template<typename Scalar>
const std::vector< std::string > & icarus::Backplane< Scalar >::registered_config ( ) const
inlinenodiscard

Get config registered by current component (Phase 2.4).

◆ registered_inputs()

template<typename Scalar>
const std::vector< std::string > & icarus::Backplane< Scalar >::registered_inputs ( ) const
inlinenodiscard

Get inputs registered by current component (Phase 2.4).

◆ registered_outputs()

template<typename Scalar>
const std::vector< std::string > & icarus::Backplane< Scalar >::registered_outputs ( ) const
inlinenodiscard

Get outputs registered by current component.

◆ registered_params()

template<typename Scalar>
const std::vector< std::string > & icarus::Backplane< Scalar >::registered_params ( ) const
inlinenodiscard

Get parameters registered by current component (Phase 2.4).

◆ registry() [1/2]

template<typename Scalar>
SignalRegistry< Scalar > & icarus::Backplane< Scalar >::registry ( )
inlinenodiscard

◆ registry() [2/2]

template<typename Scalar>
const SignalRegistry< Scalar > & icarus::Backplane< Scalar >::registry ( ) const
inlinenodiscard

◆ resolve()

template<typename Scalar>
template<typename T>
SignalHandle< T > icarus::Backplane< Scalar >::resolve ( const std::string & full_name)
inlinenodiscard

Resolve a signal by full path.

Tracks the resolution for dependency discovery.

Parameters
full_nameFull signal path (e.g., "Environment.Atm.density")
Returns
SignalHandle<T> for zero-overhead access

◆ resolve_quat()

template<typename Scalar>
template<typename S>
QuatHandle< S > icarus::Backplane< Scalar >::resolve_quat ( const std::string & full_name)
inlinenodiscard

Resolve a quaternion signal.

◆ resolve_vec3()

template<typename Scalar>
template<typename S>
Vec3Handle< S > icarus::Backplane< Scalar >::resolve_vec3 ( const std::string & full_name)
inlinenodiscard

Resolve a Vec3 signal.

◆ resolved_inputs()

template<typename Scalar>
const std::vector< std::string > & icarus::Backplane< Scalar >::resolved_inputs ( ) const
inlinenodiscard

Get legacy resolved inputs by current component.

◆ set_context()

template<typename Scalar>
void icarus::Backplane< Scalar >::set_context ( const std::string & entity,
const std::string & component )
inline

Set current component context.

Called by Simulator before invoking component lifecycle methods.

◆ set_epoch()

template<typename Scalar>
void icarus::Backplane< Scalar >::set_epoch ( const vulcan::time::Epoch< Scalar > * epoch)
inline

Set epoch reference for component binding.

Called by Simulator before Stage() to make epoch available to components.

◆ wire_input()

template<typename Scalar>
template<typename T>
void icarus::Backplane< Scalar >::wire_input ( const std::string & input_name,
const std::string & source_name )
inline

Wire an input to a source signal.

◆ WireWithGain() [1/2]

template<typename Scalar>
void icarus::Backplane< Scalar >::WireWithGain ( const std::string & input_path,
const std::string & output_path,
double gain = 1.0 )
inline

Wire with gain (type-erased version for SignalRouter).

Uses the input's registered type to determine how to wire.

◆ WireWithGain() [2/2]

template<typename Scalar>
template<typename T>
void icarus::Backplane< Scalar >::WireWithGain ( const std::string & input_path,
const std::string & output_path,
double gain = 1.0 )
inline

Wire an input to a source with a gain factor.

Called by SignalRouter to connect signals with optional scaling. The gain factor is applied when reading the input value.

Parameters
input_pathFull path of input (Entity.Component.signal)
output_pathFull path of source output
gainScale factor (default 1.0)

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