Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
dcc::LogonHandler< Module >::LogonSelect Class Reference

Flow that sends out addressed packets that are part of the logon sequences. More...

Inheritance diagram for dcc::LogonHandler< Module >::LogonSelect:
StateFlowBase Timer Executable Executable Notifiable QMember Notifiable QMember Destructable Destructable

Public Member Functions

 LogonSelect (LogonHandler *parent)
 
void wakeup ()
 Notifies the flow that there is work to do.
 
void tick ()
 Called by a timer every 50 msec.
 
- 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.
 
- Public Member Functions inherited from Timer
 Timer (ActiveTimers *timers)
 Constructor.
 
 ~Timer ()
 Destructor.
 
void run () override
 Callback from the executor when this timer is scheduled.
 
long long schedule_time ()
 
void start (long long period=-1)
 Starts a timer.
 
void start_absolute (long long expiry_time_nsec)
 Starts the timer with an absolute deadline.
 
void restart ()
 Restart a timer with the existing period but from the current time.
 
void trigger ()
 This will wakeup the timer prematurely, immediately.
 
void ensure_triggered ()
 Triggers the timer if it is not expired yet.
 
void cancel ()
 Dangerous, do not call.
 
bool is_triggered ()
 
void set_triggered ()
 Sets the timer as if it was woken up by a trigger(), even if it was never started.
 

Private Member Functions

long long timeout () override
 Timer callback.
 
Module * m ()
 
TrackIftrack ()
 
Action search ()
 Entry to the flow.
 
Action send_get_shortinfo ()
 Called with a buffer allocated.
 
Action send_assign ()
 Called with a buffer allocated.
 

Private Attributes

LogonHandlerparent_
 Owning logon handler.
 
unsigned cycleNextId_
 Identifier of the storage that provides the next locomotive to look at.
 
BarrierNotifiable bn_
 Helper for self notification.
 

Additional Inherited Members

- Public Types inherited from Timer
enum  { NONE = 0 , RESTART = 1 , DELETE = -1 }
 Special return values from the timeout function. More...
 
- 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 Member Functions inherited from Timer
void update_period (long long period)
 Updates the period, to be used after the next expiration of the timer in order to restart it.
 
- Protected Attributes inherited from QMember
QMembernext
 pointer to the next member in the queue
 

Detailed Description

template<class Module>
class dcc::LogonHandler< Module >::LogonSelect

Flow that sends out addressed packets that are part of the logon sequences.

Definition at line 440 of file Logon.hxx.

Constructor & Destructor Documentation

◆ LogonSelect()

template<class Module >
dcc::LogonHandler< Module >::LogonSelect::LogonSelect ( LogonHandler parent)
inline

Definition at line 443 of file Logon.hxx.

Member Function Documentation

◆ m()

template<class Module >
Module * dcc::LogonHandler< Module >::LogonSelect::m ( )
inlineprivate
Returns
the pointer to the storage module.

Definition at line 518 of file Logon.hxx.

◆ search()

template<class Module >
Action dcc::LogonHandler< Module >::LogonSelect::search ( )
inlineprivate

Entry to the flow.

Looks through the states to see what we needs to be done.

Definition at line 531 of file Logon.hxx.

◆ send_assign()

template<class Module >
Action dcc::LogonHandler< Module >::LogonSelect::send_assign ( )
inlineprivate

Called with a buffer allocated.

Sends an assign command to the current decoder.

Definition at line 584 of file Logon.hxx.

◆ send_get_shortinfo()

template<class Module >
Action dcc::LogonHandler< Module >::LogonSelect::send_get_shortinfo ( )
inlineprivate

Called with a buffer allocated.

Sends a get shortinfo command to the current decoder.

Definition at line 566 of file Logon.hxx.

◆ tick()

template<class Module >
void dcc::LogonHandler< Module >::LogonSelect::tick ( )
inline

Called by a timer every 50 msec.

Todo:
locomotives that are in error state should be

Definition at line 462 of file Logon.hxx.

◆ timeout()

template<class Module >
long long dcc::LogonHandler< Module >::LogonSelect::timeout ( )
inlineoverrideprivatevirtual

Timer callback.

Implements Timer.

Definition at line 507 of file Logon.hxx.

◆ track()

template<class Module >
TrackIf * dcc::LogonHandler< Module >::LogonSelect::track ( )
inlineprivate
Returns
the pointer to the track interface.

Definition at line 524 of file Logon.hxx.

◆ wakeup()

template<class Module >
void dcc::LogonHandler< Module >::LogonSelect::wakeup ( )
inline

Notifies the flow that there is work to do.

Definition at line 452 of file Logon.hxx.

Member Data Documentation

◆ bn_

template<class Module >
BarrierNotifiable dcc::LogonHandler< Module >::LogonSelect::bn_
private

Helper for self notification.

Definition at line 609 of file Logon.hxx.

◆ cycleNextId_

template<class Module >
unsigned dcc::LogonHandler< Module >::LogonSelect::cycleNextId_
private

Identifier of the storage that provides the next locomotive to look at.

Definition at line 606 of file Logon.hxx.

◆ parent_

template<class Module >
LogonHandler* dcc::LogonHandler< Module >::LogonSelect::parent_
private

Owning logon handler.

Definition at line 602 of file Logon.hxx.


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