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

Type-safe handle for accessing a signal value. More...

#include <Handle.hpp>

Public Member Functions

 SignalHandle (T *ptr, const SignalDescriptor *meta)
 Construct a SignalHandle with pointer and metadata.
 SignalHandle ()
 Default constructor (creates invalid handle).
T & operator* ()
 Dereference to get/set the signal value.
const T & operator* () const
T * operator-> ()
 Arrow operator for member access (if T is a class).
const T * operator-> () const
T * ptr ()
 Get raw pointer for integration with Eigen loops.
const T * ptr () const
const std::string & name () const
 Get the signal name.
const std::string & unit () const
 Get the signal unit.
SignalLifecycle lifecycle () const
 Get the signal lifecycle.
const SignalDescriptordescriptor () const
 Get the full signal descriptor.
 operator bool () const
 Check if handle is valid (bound to a signal).
bool valid () const
 Check if handle is valid.

Detailed Description

template<typename T>
class icarus::SignalHandle< T >

Type-safe handle for accessing a signal value.

SignalHandle provides:

  • Zero-overhead dereferencing (hot path): operator*, operator->
  • Raw pointer access for integration with Eigen loops
  • Metadata access (cold path): name(), unit(), lifecycle()
  • Validity checking: operator bool()

Usage pattern:

// During Stage phase: bind once
SignalHandle<double> thrust = registry.resolve<double>("thrust");
// During Step phase: read forever (zero overhead)
double current_thrust = *thrust;
thrust->some_method(); // if T is a class
SignalHandle(T *ptr, const SignalDescriptor *meta)
Construct a SignalHandle with pointer and metadata.
Definition Handle.hpp:48
Template Parameters
TThe signal value type (must have a TypeTraits specialization)

Constructor & Destructor Documentation

◆ SignalHandle() [1/2]

template<typename T>
icarus::SignalHandle< T >::SignalHandle ( T * ptr,
const SignalDescriptor * meta )
inline

Construct a SignalHandle with pointer and metadata.

Parameters
ptrPointer to the signal storage
metaPointer to the signal descriptor (metadata)

◆ SignalHandle() [2/2]

template<typename T>
icarus::SignalHandle< T >::SignalHandle ( )
inline

Default constructor (creates invalid handle).

Member Function Documentation

◆ descriptor()

template<typename T>
const SignalDescriptor * icarus::SignalHandle< T >::descriptor ( ) const
inlinenodiscard

Get the full signal descriptor.

Precondition
Handle must be valid

◆ lifecycle()

template<typename T>
SignalLifecycle icarus::SignalHandle< T >::lifecycle ( ) const
inlinenodiscard

Get the signal lifecycle.

Precondition
Handle must be valid

◆ name()

template<typename T>
const std::string & icarus::SignalHandle< T >::name ( ) const
inlinenodiscard

Get the signal name.

Precondition
Handle must be valid (check with valid() or operator bool())

◆ operator bool()

template<typename T>
icarus::SignalHandle< T >::operator bool ( ) const
inlineexplicit

Check if handle is valid (bound to a signal).

◆ operator*() [1/2]

template<typename T>
T & icarus::SignalHandle< T >::operator* ( )
inline

Dereference to get/set the signal value.

◆ operator*() [2/2]

template<typename T>
const T & icarus::SignalHandle< T >::operator* ( ) const
inline

◆ operator->() [1/2]

template<typename T>
T * icarus::SignalHandle< T >::operator-> ( )
inline

Arrow operator for member access (if T is a class).

◆ operator->() [2/2]

template<typename T>
const T * icarus::SignalHandle< T >::operator-> ( ) const
inline

◆ ptr() [1/2]

template<typename T>
T * icarus::SignalHandle< T >::ptr ( )
inline

Get raw pointer for integration with Eigen loops.

◆ ptr() [2/2]

template<typename T>
const T * icarus::SignalHandle< T >::ptr ( ) const
inline

◆ unit()

template<typename T>
const std::string & icarus::SignalHandle< T >::unit ( ) const
inlinenodiscard

Get the signal unit.

Precondition
Handle must be valid

◆ valid()

template<typename T>
bool icarus::SignalHandle< T >::valid ( ) const
inlinenodiscard

Check if handle is valid.


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