Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::WriteFlowBase Class Referenceabstract

Implementation of the hardware-independent parts of the write flows. More...

#include <IfImpl.hxx>

Inheritance diagram for openlcb::WriteFlowBase:
StateFlow< Buffer< GenMessage >, QList< 4 > > TypedStateFlow< MessageType, Base > FlowInterface< MessageType > openlcb::CanMessageWriteFlow openlcb::AddressedCanMessageWriteFlow openlcb::GlobalCanMessageWriteFlow openlcb::CanDatagramWriteFlow

Public Member Functions

 WriteFlowBase (If *async_if)
 
- Public Member Functions inherited from StateFlow< Buffer< GenMessage >, QList< 4 > >
 StateFlow (Service *service)
 Constructor.
 
- 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.
 
virtual Action entry () override=0
 Entry into the StateFlow activity.
 
- 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.
 

Protected Member Functions

virtual Action send_to_hardware ()=0
 This function will be called (on the main executor) to initiate sending this message to the hardware.
 
virtual Action send_to_local_node ()
 This state is called when an addressed message's destination is a node that is local to this interface.
 
virtual Action send_finished ()
 Virtual method called after the send is completed, i.e., all the frames are generated and sent to the hardware.
 
Ifasync_if ()
 
GenMessagenmsg ()
 Implementations shall call this function when they are done with sending the packet.
 
Action addressed_entry ()
 Addressed write flows should call this state BEFORE sending to the hardware.
 
Action global_entry ()
 Global write flows should return to this state AFTER sending the message to the hardware.
 
- 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.
 

Additional Inherited Members

- 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.
 
- 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

Implementation of the hardware-independent parts of the write flows.

Definition at line 45 of file IfImpl.hxx.

Constructor & Destructor Documentation

◆ WriteFlowBase()

openlcb::WriteFlowBase::WriteFlowBase ( If async_if)
inline

Definition at line 48 of file IfImpl.hxx.

Member Function Documentation

◆ addressed_entry()

StateFlowBase::Action openlcb::WriteFlowBase::addressed_entry ( )
protected

Addressed write flows should call this state BEFORE sending to the hardware.

They may get back control at the send_to_hardware state if needed. NOTE: datagram write flow cannot use this because it won't get back.

Definition at line 41 of file IfImpl.cxx.

◆ async_if()

If * openlcb::WriteFlowBase::async_if ( )
inlineprotected
Returns
the interface that this flow is assigned to.

Definition at line 77 of file IfImpl.hxx.

◆ global_entry()

StateFlowBase::Action openlcb::WriteFlowBase::global_entry ( )
protected

Global write flows should return to this state AFTER sending the message to the hardware.

They should ensure the message is still intact. They will not get back control.

Definition at line 67 of file IfImpl.cxx.

◆ nmsg()

GenMessage * openlcb::WriteFlowBase::nmsg ( )
inlineprotected

Implementations shall call this function when they are done with sending the packet.

Returns the NMRAnet message we are trying to send.

Definition at line 88 of file IfImpl.hxx.

◆ send_finished()

virtual Action openlcb::WriteFlowBase::send_finished ( )
inlineprotectedvirtual

Virtual method called after the send is completed, i.e., all the frames are generated and sent to the hardware.

Various flows might need to take additional steps afterwards.

Reimplemented in openlcb::GlobalCanMessageWriteFlow.

Definition at line 71 of file IfImpl.hxx.

◆ send_to_hardware()

virtual Action openlcb::WriteFlowBase::send_to_hardware ( )
protectedpure virtual

This function will be called (on the main executor) to initiate sending this message to the hardware.

The flow will then execute the returned action.

NOTE: it is possible that this functon will never be called for a given flow.

Implemented in openlcb::CanMessageWriteFlow, and openlcb::AddressedCanMessageWriteFlow.

◆ send_to_local_node()

StateFlowBase::Action openlcb::WriteFlowBase::send_to_local_node ( )
protectedvirtual

This state is called when an addressed message's destination is a node that is local to this interface.

The dstNode will already be filled. The implementation should perform the send and then transition to the send_finished state.

Definition at line 54 of file IfImpl.cxx.


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