Template Class ComponentSignals
Defined in File ComponentSignals.hpp
Class Documentation
-
template<typename scalar_type, typename index_type, typename InternalVariables, typename ExternalVariables>
class ComponentSignals Extension object for
Components adding methods and member variables related to signal bus managementThis is used by adding an instance in a field to your class and exposing this field to others
- Invariant
InternalVariables::MAXIMUM is the greatest attainable integer value of the enum
- Invariant
ExternalVariables::MAXIMUM is the greatest attainable integer value of the enum
- Template Parameters:
scalar_type – Scalar value type
index_type – Index type
InternalVariables – An enumeration satisfying
EnumHasMaximumValueAndIsSizeTenumerating internal variables for the componentExternalVariables – An enumeration satisfying
EnumHasMaximumValueAndIsSizeTenumerating external variables for the component
Public Functions
-
template<ExternalVariables variable>
inline auto attachSignalNode(SignalNode<ScalarT, IdxT> *node) Attaches a signal node to an external variable on this component
- Template Parameters:
variable – The external variable to attach the provided signal to
- Parameters:
node – [in] The signal node to attach
- Pre:
The provided pointer to a signal node is not
nullptr- Post:
The provided signal node is attached to the indicated external variable
-
template<ExternalVariables variable>
inline auto isAttached() const -> bool Check if a signal node has been attached to an external variable
- Template Parameters:
variable – The external variable to check
-
template<InternalVariables variable>
inline auto isAssigned() const -> bool Check if a signal node has been assigned to an internal variable
- Template Parameters:
variable – The internal variable to check
-
template<ExternalVariables variable>
inline auto isLinked() const -> bool Check if a signal node has been “set”
- Template Parameters:
variable – The external variable to check
-
template<InternalVariables variable>
inline auto getSignalNode() -> SignalNode<ScalarT, IdxT>* Returns a signal node for an internal signal variable to be attached to an external variable on another component
- Template Parameters:
variable – The internal variable to get the assigned signal node of
- Pre:
A signal node has been assigned to the requested internal variable
-
template<ExternalVariables variable>
inline auto readExternalVariable() const -> ScalarT Returns the value of the specified external variable
- Template Parameters:
variable – The external variable to read from
- Pre:
A signal node has been assigned to the requested external variable
-
template<ExternalVariables variable>
inline auto readExternalVariableIndex() const -> IdxT Returns the global index of the specified external variable
- Template Parameters:
variable – The external variable to read from
- Pre:
A signal node has been assigned to the requested external variable
-
template<ExternalVariables variable>
inline auto writeExternalVariable(ScalarT value) Writes a value to the specified external variable
Warning
This method should be used only in component initialization methods. Use only if you know what you are doing.
- Template Parameters:
variable – The external variable to write to
- Parameters:
value – [in] The value to write to the signal node
- Pre:
A signal node has been assigned to the requested external variable
- Post:
The signal node of the corresponding external variable has the given value written to it
-
template<InternalVariables variable>
inline auto assignSignalNode(SignalNode<ScalarT, IdxT> *node) Assigns a signal node to an internal variable on this component
- Template Parameters:
variable – The internal variable to assign the signal node to
- Parameters:
node – [in] The signal node to assign
- Pre:
The provided pointer to a signal node is not
nullptr- Post:
The provided signal node is assigned to the indicated internal variable