Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
GenericHubFlow< D > Class Template Reference

Templated implementation of the HubFlow. More...

#include <Hub.hxx>

Inheritance diagram for GenericHubFlow< D >:
DispatchFlow< Buffer< D >, 1 > TypedStateFlow< MessageType, Base > FlowInterface< MessageType >

Public Types

typedef D value_type
 Payload of the buffer.
 
typedef Buffer< value_typebuffer_type
 Type of a biffer being forwarded.
 
typedef FlowInterface< buffer_typeport_type
 Base type of an individual port.
 
- Public Types inherited from DispatchFlow< Buffer< D >, 1 >
typedef TypedStateFlow< Buffer< D >, DispatchFlowBase< BASE_NUM_PRIO > > Base
 Helper typedef of the base class of *this.
 
typedef StateFlowBase::Action Action
 Imports types and functions to allow less typing for the implementation.
 
typedef FlowInterface< Buffer< D > > HandlerType
 Interface type for handlers that can be registered.
 
typedef MessageType::value_type::id_type ID
 Maskable type of the dispatched messages upon which handlers can configure to trigger.
 
- Public Types inherited from TypedStateFlow< MessageType, Base >
typedef Base::Action Action
 Allows using Action without having StateFlowBase:: prefix in front of it.
 
- Public Types inherited from FlowInterface< MessageType >
typedef MessageType message_type
 Stores the message template type for external reference.
 

Public Member Functions

 GenericHubFlow (Service *s)
 Constructor.
 
void register_port (port_type *port)
 Adds a new port.
 
void unregister_port (port_type *port)
 Removes a previously added port.
 
- Public Member Functions inherited from DispatchFlow< Buffer< D >, 1 >
 DispatchFlow (Service *service)
 Constructor.
 
Action entry () OVERRIDE
 Override method that will be called after each incoming message is dequeued.
 
void register_handler (HandlerType *handler, ID id, ID mask)
 Adds a new handler to this dispatcher.
 
void unregister_handler (HandlerType *handler, ID id, ID mask)
 Removes a specific instance of a handler from this dispatcher.
 
void unregister_handler_all (HandlerType *handler)
 Removes all instances of a handler from this dispatcher.
 
void register_fallback_handler (HandlerType *handler)
 Sets one handler to receive all messages that no other handler has matched.
 
Action call_immediately (Callback c)
 Imediately call the next state upon return.
 
Action allocate_and_call (FlowInterface< Buffer< T > > *target_flow, Callback c, Pool *pool=nullptr)
 Allocates a buffer from a pool and proceed to the next state when allocation is successful.
 
Action allocate_and_call (Callback c, QAsync *queue)
 Allocates an entry from an asynchronous queue, and transitions to a state once the allocation is complete.
 
Buffer< T > * get_allocation_result (FlowInterface< Buffer< T > > *target_flow)
 Takes the result of the asynchronous allocation.
 
- Public Member Functions inherited from TypedStateFlow< MessageType, Base >
 TypedStateFlow (Service *service)
 Constructor.
 
virtual ~TypedStateFlow ()
 Destructor.
 
void send (MessageType *msg, unsigned priority=UINT_MAX) OVERRIDE
 Sends a message to the state flow for processing.
 
- 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.
 

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.
 
- Protected Member Functions inherited from DispatchFlow< Buffer< D >, 1 >
Base::ID get_message_id () OVERRIDE
 
Action allocate_and_clone () OVERRIDE
 Requests allocating a new buffer for sending off a clone.
 
Action clone ()
 Takes the allocated new buffer, copies the message into it and sends off to the clone target.
 
void send_transfer () OVERRIDE
 Takes the existing buffer and sends off to the target flow.
 
- Protected Member Functions inherited from TypedStateFlow< MessageType, Base >
void release () OVERRIDE
 Unrefs the current buffer.
 
void return_buffer ()
 For state flows that are operated using invoke_subflow_and_wait this is a way to hand back the buffer to the caller.
 
MessageType * message ()
 
MessageType * transfer_message ()
 Releases ownership of the current message.
 

Detailed Description

template<class D>
class GenericHubFlow< D >

Templated implementation of the HubFlow.

Definition at line 149 of file Hub.hxx.

Member Typedef Documentation

◆ buffer_type

template<class D >
typedef Buffer<value_type> GenericHubFlow< D >::buffer_type

Type of a biffer being forwarded.

Definition at line 155 of file Hub.hxx.

◆ port_type

template<class D >
typedef FlowInterface<buffer_type> GenericHubFlow< D >::port_type

Base type of an individual port.

Definition at line 157 of file Hub.hxx.

◆ value_type

template<class D >
typedef D GenericHubFlow< D >::value_type

Payload of the buffer.

Definition at line 153 of file Hub.hxx.

Constructor & Destructor Documentation

◆ GenericHubFlow()

template<class D >
GenericHubFlow< D >::GenericHubFlow ( Service s)
inline

Constructor.

Parameters
sdefines which executor to run this on.

Definition at line 160 of file Hub.hxx.

Member Function Documentation

◆ register_port()

template<class D >
void GenericHubFlow< D >::register_port ( port_type port)
inline

Adds a new port.

After add return, all messages puslished to the hub will be sent to 'port'.

Parameters
portis the object to add.

Definition at line 167 of file Hub.hxx.

◆ unregister_port()

template<class D >
void GenericHubFlow< D >::unregister_port ( port_type port)
inline

Removes a previously added port.

Parameters
portis the port to remove.

Definition at line 174 of file Hub.hxx.


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