Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
FlowInterface< MessageType > Class Template Referenceabstract

Abstract class for message recipients. More...

#include <StateFlow.hxx>

Inheritance diagram for FlowInterface< MessageType >:
TypedStateFlow< Buffer< RequestType >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< MessageType, DispatchFlowBase< BASE_NUM_PRIO > > TypedStateFlow< Buffer< Data >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< D >, DispatchFlowBase< BASE_NUM_PRIO > > TypedStateFlow< Buffer< Chunk >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< ProgrammingTrackRequest >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< MessageType, UntypedStateFlow< QueueType > > TypedStateFlow< Buffer< dcc::Packet >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< AliasInfo >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< BootloaderRequest >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< BroadcastTimeServerDateRolloverFinishInput >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< BroadcastTimeServerSetInput >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< BroadcastTimeServerSyncInput >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< BroadcastTimeServerTimeInput >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< BulkAliasRequest >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< CanMessageData >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< DccAccyProducerInput >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< EventHandlerCall >, UntypedStateFlow< QList< 5 > > > TypedStateFlow< Buffer< CanHubData >, UntypedStateFlow< QList< 5 > > > TypedStateFlow< Buffer< MemoryConfigClientRequest >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< NodeCanonicalizeRequest >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< SNIPClientRequest >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< StreamReceiveRequest >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< ByteBuffer, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< TractionThrottleInput >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< GenMessage >, UntypedStateFlow< QList< 4 > > > TypedStateFlow< Buffer< ThrottleCommand >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< CanMessageData >, DispatchFlowBase< BASE_NUM_PRIO > > TypedStateFlow< Buffer< HubData >, DispatchFlowBase< BASE_NUM_PRIO > > TypedStateFlow< Buffer< typename HFlow::value_type >, UntypedStateFlow< QList< 1 > > > TypedStateFlow< Buffer< GenMessage >, DispatchFlowBase< BASE_NUM_PRIO > > TypedStateFlow< Buffer< CanHubData >, DispatchFlowBase< BASE_NUM_PRIO > > TypedStateFlow< Buffer< ThrottleCommand >, DispatchFlowBase< BASE_NUM_PRIO > > FlowInterface< MessageType >::GenericHandler TypedStateFlow< MessageType, Base > dcc::LogonFeedbackParser dcc::RailcomPrintfFlow dcc::RailcomToGpioFlow openlcb::TractionCvSpace traction_modem::CvSpace

Classes

class  GenericHandler
 

Public Types

typedef MessageType message_type
 Stores the message template type for external reference.
 

Public Member Functions

virtual Poolpool ()
 
virtual void send (MessageType *message, unsigned priority=UINT_MAX)=0
 Entry point to the flow.
 
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.
 

Static Public Member Functions

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 >

Abstract class for message recipients.

A common base class for various handlers. Most of them are implemented as StateFlow classes. However, if the receiving flow does not need asynchronous handling, it is possible to directly implement a descendant of a specific FlowInterface by overriding the send() method.

Definition at line 1116 of file StateFlow.hxx.

Member Typedef Documentation

◆ message_type

template<class MessageType >
typedef MessageType FlowInterface< MessageType >::message_type

Stores the message template type for external reference.

Definition at line 1120 of file StateFlow.hxx.

Constructor & Destructor Documentation

◆ ~FlowInterface()

template<class MessageType >
virtual FlowInterface< MessageType >::~FlowInterface ( )
inlinevirtual

Definition at line 1122 of file StateFlow.hxx.

Member Function Documentation

◆ alloc()

template<class MessageType >
MessageType * FlowInterface< MessageType >::alloc ( )
inline

Synchronously allocates a message buffer from the pool of this flow.

Returns
the newly allocates message.

Definition at line 1151 of file StateFlow.hxx.

◆ alloc_async()

template<class MessageType >
void FlowInterface< MessageType >::alloc_async ( Executable target)
inline

Asynchronously allocates a message buffer from the pool of this flow.

Parameters
targetWill call target->AllocationCallback with the pointer. The callee shall come back and use cast_alloc to turn the pointer into a usable object.

Definition at line 1162 of file StateFlow.hxx.

◆ cast_alloc()

template<class MessageType >
static MessageType * FlowInterface< MessageType >::cast_alloc ( QMember entry)
inlinestatic

Down casts and initializes an asynchronous allocation result to the appropriate flow's buffer type.

Parameters
entryis the value that got returned by allocation_callback of this pool.
Returns
a default-constructed (zeroed) message for this flow.

Definition at line 1175 of file StateFlow.hxx.

◆ pool()

template<class MessageType >
virtual Pool * FlowInterface< MessageType >::pool ( )
inlinevirtual
Returns
the buffer pool to use for sending messages to this flow. This is to be used as a hint, the caller is allowed to send buffers from different source.
Todo:
(stbaker) change this to Pool* once it supports async alloc.

Reimplemented in dcc::FakeTrackIf, dcc::LocalTrackIf, CanFrameWriteFlow, CanFrameReadFlow, and GCAdapter::BinaryToGCMember.

Definition at line 1128 of file StateFlow.hxx.

◆ send()

◆ type_helper()

template<class MessageType >
virtual MessageType * FlowInterface< MessageType >::type_helper ( )
inlinevirtual

This function is never user in the code, but GDB can use it to infer the correct message types.

It has to be virtual so that it is not optimized away.

Definition at line 1144 of file StateFlow.hxx.


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