Managing Reactions

During system runtime, executing reactions can be managed via the reaction handle. A reaction handle is provided for any binding On Statements. Once an on statement has been bound, the reaction handle will be enabled. If necessary, reactions can toggle between enabled and disabled during runtime.

The reaction handle provides the following functions for managing a reaction:

disable

inline ReactionHandle &NUClear::threading::ReactionHandle::disable()

Disables the reaction.

When disabled, any associated tasks will not be created if triggered. All reaction configuration is still available, so that the reaction can be enabled when required. Note that a reaction which has been bound by an on<Always> request should not be disabled.

enable

Warning

doxygenfunction: Unable to resolve function “NUClear::threading::ReactionHandle::enable” with arguments None in doxygen xml output for project “NUClear” from directory: doxygen. Potential matches:

- ReactionHandle &enable()
- ReactionHandle &enable(const bool &set)

enable(bool set)

Warning

doxygenfunction: Unable to resolve function “NUClear::threading::ReactionHandle::enable” with arguments (bool) in doxygen xml output for project “NUClear” from directory: doxygen. Potential matches:

- ReactionHandle &enable()
- ReactionHandle &enable(const bool &set)

enabled

inline bool NUClear::threading::ReactionHandle::enabled() const

Informs if the reaction is currently enabled.

Returns

true if enabled, false if disabled

unbind

inline void NUClear::threading::ReactionHandle::unbind()

Removes a reaction request from the runtime environment.

This action is not reversible, once a reaction has been unbound, it is no longer available for further use during the instance of runtime. This is most commonly used for the unbinding of network configuration before attempting to re-set configuration details during runtime.