Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::AMEGlobalQueryHandler Class Reference

This class listens for Alias Mapping Enquiry frames with no destination node ID (aka global alias enquiries) and sends back as many frames as wel have local aliases mapped. More...

Inheritance diagram for openlcb::AMEGlobalQueryHandler:
StateFlowBase FlowInterface< Buffer< CanMessageData > > Executable Notifiable QMember Destructable

Public Types

using MessageType = Buffer< CanMessageData >
 

Public Member Functions

 AMEGlobalQueryHandler (IfCan *service)
 
- Public Member Functions inherited from StateFlowBase
void run () override
 Callback from the executor.
 
void notify () override
 Wakeup call arrived.
 
Serviceservice ()
 Return a pointer to the service I am bound to.
 
- Public Member Functions inherited from Executable
void test_deletion ()
 
- Public Member Functions inherited from QMember
void init ()
 Initiailize a QMember, in place of a public placement construction.
 

Private Types

enum  { CAN_FILTER , CAN_MASK }
 
- Private Types inherited from FlowInterface< Buffer< CanMessageData > >
typedef Buffer< CanMessageDatamessage_type
 Stores the message template type for external reference.
 

Private Member Functions

IfCanif_can ()
 
void send (MessageType *msg, unsigned priority=UINT_MAX) override
 Sends a message to the state flow for processing.
 
Action rerun ()
 
Action find_next ()
 
Action fill_response ()
 
- Private Member Functions inherited from FlowInterface< Buffer< CanMessageData > >
virtual Poolpool ()
 
virtual Buffer< CanMessageData > * type_helper ()
 This function is never user in the code, but GDB can use it to infer the correct message types.
 
Buffer< CanMessageData > * 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

bool needRerun_ = false
 This boolean will be set to true when a full re-run of all sent frames is necessary.
 
unsigned nextIndex_
 Which alias entry index we take next.
 
BarrierNotifiable n_
 Helper object to wait for frame to be sent.
 

Additional Inherited Members

- Static Public Member Functions inherited from StateFlowBase
template<class T , typename... Args>
static void invoke_subflow_and_ignore_result (FlowInterface< Buffer< T > > *target_flow, Args &&... args)
 Calls a helper flow to perform some actions.
 
- Protected Types inherited from StateFlowBase
typedef Action(StateFlowBase::* Callback) ()
 State Flow callback prototype.
 
- Protected Member Functions inherited from StateFlowBase
 StateFlowBase (Service *service)
 Constructor.
 
 ~StateFlowBase ()
 Destructor.
 
void reset_flow (Callback c)
 Resets the flow to the specified state.
 
bool is_state (Callback c)
 
bool is_terminated ()
 
void start_flow (Callback c)
 Resets the flow to the specified state and starts it.
 
Action again ()
 Call the current state again via call_immediately.
 
Action exit ()
 Terminate current StateFlow activity.
 
Action delete_this ()
 Terminates the flow and deletes *this.
 
Action set_terminated ()
 Sets the flow to terminated state.
 
Action call_immediately (Callback c)
 Imediately call the next state upon return.
 
Action wait ()
 Wait for an asynchronous call.
 
Action wait_and_call (Callback c)
 Wait for resource to become available before proceeding to next state.
 
template<class T >
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.
 
template<class T >
Buffer< T > * full_allocation_result (FlowInterface< Buffer< T > > *target_flow)
 Takes the result of the asynchronous allocation without resetting the object.
 
template<class T >
T * full_allocation_result (TypedQAsync< T > *queue)
 Takes the result of the asynchronous allocation without resetting the object.
 
template<class T >
void cast_allocation_result (T **member)
 Takes the result of the asynchronous allocation without resetting the object.
 
template<class T >
Buffer< T > * get_allocation_result (FlowInterface< Buffer< T > > *target_flow)
 Takes the result of the asynchronous allocation.
 
Action yield_and_call (Callback c)
 Place the current flow to the back of the executor, and transition to a new state after we get the CPU again.
 
Action yield ()
 Place the current flow to the back of the executor, and re-try the current state after we get the CPU again.
 
Action sleep_and_call (::Timer *timer, long long timeout_nsec, Callback c)
 Suspends execution of this control flow for a specified time.
 
template<class T , typename... Args>
Action invoke_subflow_and_wait (FlowInterface< Buffer< T > > *target_flow, Callback c, Args &&... args)
 Calls a helper flow to perform some actions.
 
Action read_repeated (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO)
 Blocks until size bytes are read and then invokes the next state.
 
Action read_single (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO)
 Attempts to read at most size_t bytes, and blocks the caller until at least one byte is read.
 
Action read_nonblocking (StateFlowSelectHelper *helper, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO)
 Attempts to read at most size bytes, and then invokes the next state, even if only zero bytes are available right now.
 
Action read_repeated_with_timeout (StateFlowTimedSelectHelper *helper, long long timeout_nsec, int fd, void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO)
 Blocks until size bytes are read, or a timeout expires.
 
Action internal_try_read ()
 Implementation state that gets repeatedly called upon every wakeup and tries to make progress on reading.
 
Action write_repeated (StateFlowSelectHelper *helper, int fd, const void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO)
 Writes some data into a file descriptor, repeating the operation as necessary until all bytes are written.
 
Action internal_try_write ()
 Implementation state that gets repeatedly called upon every wakeup and tries to make progress on writing.
 
- Protected Member Functions inherited from QMember
 QMember ()
 Constructor.
 
 ~QMember ()
 Destructor.
 
- Protected Attributes inherited from QMember
QMembernext
 pointer to the next member in the queue
 
- Static Private Member Functions inherited from FlowInterface< Buffer< CanMessageData > >
static Buffer< CanMessageData > * cast_alloc (QMember *entry)
 Down casts and initializes an asynchronous allocation result to the appropriate flow's buffer type.
 

Detailed Description

This class listens for Alias Mapping Enquiry frames with no destination node ID (aka global alias enquiries) and sends back as many frames as wel have local aliases mapped.

Definition at line 360 of file IfCan.cxx.

Member Typedef Documentation

◆ MessageType

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Definition at line 380 of file IfCan.cxx.

Constructor & Destructor Documentation

◆ AMEGlobalQueryHandler()

openlcb::AMEGlobalQueryHandler::AMEGlobalQueryHandler ( IfCan service)
inline

Definition at line 364 of file IfCan.cxx.

◆ ~AMEGlobalQueryHandler()

openlcb::AMEGlobalQueryHandler::~AMEGlobalQueryHandler ( )
inline

Definition at line 371 of file IfCan.cxx.

Member Function Documentation

◆ fill_response()

Action openlcb::AMEGlobalQueryHandler::fill_response ( )
inlineprivate

Definition at line 450 of file IfCan.cxx.

◆ find_next()

Action openlcb::AMEGlobalQueryHandler::find_next ( )
inlineprivate

Definition at line 427 of file IfCan.cxx.

◆ if_can()

IfCan * openlcb::AMEGlobalQueryHandler::if_can ( )
inlineprivate

Definition at line 389 of file IfCan.cxx.

◆ rerun()

Action openlcb::AMEGlobalQueryHandler::rerun ( )
inlineprivate

Definition at line 420 of file IfCan.cxx.

◆ send()

void openlcb::AMEGlobalQueryHandler::send ( MessageType msg,
unsigned  priority = UINT_MAX 
)
inlineoverrideprivatevirtual

Sends a message to the state flow for processing.

This function never blocks.

Must be called from the main executor of the interface.

Parameters
msgMessage to enqueue
prioritythe priority at which to enqueue this message.

Implements FlowInterface< Buffer< CanMessageData > >.

Definition at line 402 of file IfCan.cxx.

Member Data Documentation

◆ n_

BarrierNotifiable openlcb::AMEGlobalQueryHandler::n_
private

Helper object to wait for frame to be sent.

Definition at line 481 of file IfCan.cxx.

◆ needRerun_

bool openlcb::AMEGlobalQueryHandler::needRerun_ = false
private

This boolean will be set to true when a full re-run of all sent frames is necessary.

Definition at line 477 of file IfCan.cxx.

◆ nextIndex_

unsigned openlcb::AMEGlobalQueryHandler::nextIndex_
private

Which alias entry index we take next.

Definition at line 479 of file IfCan.cxx.


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