Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
FlowInterface< MessageType >::GenericHandler Class Reference
Inheritance diagram for FlowInterface< MessageType >::GenericHandler:
FlowInterface< MessageType >

Public Types

typedef std::function< void(message_type *)> HandlerFn
 Interface of the callback function.
 
- Public Types inherited from FlowInterface< MessageType >
typedef MessageType message_type
 Stores the message template type for external reference.
 

Public Member Functions

 GenericHandler (HandlerFn handler)
 Constructor.
 
template<class T >
 GenericHandler (T *ptr, void(T::*fn)(message_type *))
 Constructor to be called with an object member function.
 
void send (MessageType *message, unsigned priority) OVERRIDE
 Overridden method for sending the message.
 
- Public Member Functions inherited from FlowInterface< MessageType >
virtual Poolpool ()
 
virtual MessageType * type_helper ()
 This function is never user in the code, but GDB can use it to infer the correct message types.
 
MessageType * alloc ()
 Synchronously allocates a message buffer from the pool of this flow.
 
void alloc_async (Executable *target)
 Asynchronously allocates a message buffer from the pool of this flow.
 

Private Attributes

HandlerFn handler_
 The configured handler callback.
 

Additional Inherited Members

- Static Public Member Functions inherited from FlowInterface< MessageType >
static MessageType * cast_alloc (QMember *entry)
 Down casts and initializes an asynchronous allocation result to the appropriate flow's buffer type.
 

Detailed Description

template<class MessageType>
class FlowInterface< MessageType >::GenericHandler

Definition at line 1186 of file StateFlow.hxx.

Member Typedef Documentation

◆ HandlerFn

template<class MessageType >
typedef std::function<void(message_type *)> FlowInterface< MessageType >::GenericHandler::HandlerFn

Interface of the callback function.

Definition at line 1191 of file StateFlow.hxx.

Constructor & Destructor Documentation

◆ GenericHandler() [1/2]

template<class MessageType >
FlowInterface< MessageType >::GenericHandler::GenericHandler ( HandlerFn  handler)
inline

Constructor.

Parameters
handlerwill be called upon every incoming message with the argument being set to the arrived message. The handler function is typically responsible for unref-ing the incoming message buffer.

Definition at line 1196 of file StateFlow.hxx.

◆ GenericHandler() [2/2]

template<class MessageType >
template<class T >
FlowInterface< MessageType >::GenericHandler::GenericHandler ( T *  ptr,
void(T::*)(message_type *)  fn 
)
inline

Constructor to be called with an object member function.

Parameters
ptris the object whose member function to call.
fnis a member function on ptr, which will be called with each incoming message.

Definition at line 1205 of file StateFlow.hxx.

Member Function Documentation

◆ send()

template<class MessageType >
void FlowInterface< MessageType >::GenericHandler::send ( MessageType *  message,
unsigned  priority 
)
inlinevirtual

Overridden method for sending the message.

Implements FlowInterface< MessageType >.

Definition at line 1209 of file StateFlow.hxx.

Member Data Documentation

◆ handler_

template<class MessageType >
HandlerFn FlowInterface< MessageType >::GenericHandler::handler_
private

The configured handler callback.

Definition at line 1216 of file StateFlow.hxx.


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