Skip to main content

CommandHandlerRef Struct Template

Typed reference wrapper for invoking a registered handler. More...

Declaration

template <typename CommandType> struct helios::engine::runtime::messaging::command::CommandHandlerRef<CommandType> { ... }

Public Operators Index

template <typename CommandType>
operator bool () const noexcept

Checks if this reference points to a valid handler. More...

Public Member Functions Index

template <typename CommandType>
boolsubmit (CommandType &&cmd) const noexcept

Submits (and consumes) a command via the referenced handler. More...

Public Member Attributes Index

template <typename CommandType>
void *owner = nullptr

Pointer to the handler instance. More...

template <typename CommandType>
bool(*submitFn)(void *, void *) noexcept = nullptr

Type-erased trampoline for command dispatch. More...

Description

Typed reference wrapper for invoking a registered handler.

Template Parameters
CommandType

The specific command type this reference handles.

Definition at line 46 of file CommandHandlerRegistry.ixx.

Public Operators

operator bool()

template <typename CommandType>
helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::operator bool ()
inline explicit noexcept

Checks if this reference points to a valid handler.

Returns

True if both owner and submitFn are non-null.

Definition at line 63 of file CommandHandlerRegistry.ixx.

63 [[nodiscard]] explicit operator bool() const noexcept {
64 return owner && submitFn;
65 }

References helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::owner and helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::submitFn.

Public Member Functions

submit()

template <typename CommandType>
bool helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::submit (CommandType && cmd)
inline noexcept

Submits (and consumes) a command via the referenced handler.

Parameters
cmd

The command instance to forward.

Returns

True if the command was accepted/handled.

Definition at line 73 of file CommandHandlerRegistry.ixx.

73 bool submit(CommandType&& cmd) const noexcept {
74 return submitFn(owner, std::addressof(cmd));
75 }

References helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::owner, helios::engine::runtime::registerComponents and helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::submitFn.

Public Member Attributes

owner

template <typename CommandType>
void* helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::owner = nullptr

submitFn

template <typename CommandType>
bool(* helios::engine::runtime::messaging::command::CommandHandlerRef< CommandType >::submitFn) (void *, void *) noexcept = nullptr

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.