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

Specialization of BroadcastTimeAlarm meant to expire at each date rollover. More...

#include <BroadcastTimeAlarm.hxx>

Inheritance diagram for openlcb::BroadcastTimeAlarmDate:
openlcb::BroadcastTimeAlarm StateFlowBase Atomic Executable Notifiable QMember Destructable

Public Member Functions

 BroadcastTimeAlarmDate (Node *node, BroadcastTime *clock, std::function< void(BarrierNotifiable *)> callback)
 Constructor.
 
 ~BroadcastTimeAlarmDate ()
 Destructor.
 
- Public Member Functions inherited from openlcb::BroadcastTimeAlarm
 BroadcastTimeAlarm (Node *node, BroadcastTime *clock, std::function< void(BarrierNotifiable *)> callback)
 Constructor.
 
 ~BroadcastTimeAlarm ()
 Destructor.
 
void set_period (time_t period)
 Start the alarm to expire at the given period from now.
 
void set (time_t time)
 Start the alarm to expire at the given fast time.
 
void clear ()
 Inactivate the alarm.
 
- 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 Member Functions

Action entry () override
 Entry point of the state machine.
 
void reset_expired_time ()
 Reset the expired time based on what time it is now.
 
void expired_callback (BarrierNotifiable *done)
 callback for when the alarm expires
 
void update_notify () override
 Called when the clock time has changed.
 
 DISALLOW_COPY_AND_ASSIGN (BroadcastTimeAlarmDate)
 

Private Attributes

std::function< void(BarrierNotifiable *)> callbackUser_
 callback for when alarm expires
 

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 Member Functions inherited from Atomic
void lock ()
 
void unlock ()
 
- Protected Attributes inherited from openlcb::BroadcastTimeAlarm
BroadcastTimeclock_
 clock that our alarm is based off of
 
- Protected Attributes inherited from QMember
QMembernext
 pointer to the next member in the queue
 

Detailed Description

Specialization of BroadcastTimeAlarm meant to expire at each date rollover.

Definition at line 315 of file BroadcastTimeAlarm.hxx.

Constructor & Destructor Documentation

◆ BroadcastTimeAlarmDate()

openlcb::BroadcastTimeAlarmDate::BroadcastTimeAlarmDate ( Node node,
BroadcastTime clock,
std::function< void(BarrierNotifiable *)>  callback 
)
inline

Constructor.

Parameters
nodethe virtual node that our StateFlowBase service will be derived from
clockclock that our alarm is based off of
callbackcallback for when alarm expires

Definition at line 323 of file BroadcastTimeAlarm.hxx.

◆ ~BroadcastTimeAlarmDate()

openlcb::BroadcastTimeAlarmDate::~BroadcastTimeAlarmDate ( )
inline

Destructor.

Definition at line 333 of file BroadcastTimeAlarm.hxx.

Member Function Documentation

◆ entry()

Action openlcb::BroadcastTimeAlarmDate::entry ( )
inlineoverrideprivatevirtual

Entry point of the state machine.

Returns
BroadcastTimeAlarm::entry();

Reimplemented from openlcb::BroadcastTimeAlarm.

Definition at line 340 of file BroadcastTimeAlarm.hxx.

◆ expired_callback()

void openlcb::BroadcastTimeAlarmDate::expired_callback ( BarrierNotifiable done)
inlineprivate

callback for when the alarm expires

Parameters
doneused to notify we are finished

Definition at line 369 of file BroadcastTimeAlarm.hxx.

◆ reset_expired_time()

void openlcb::BroadcastTimeAlarmDate::reset_expired_time ( )
inlineprivate

Reset the expired time based on what time it is now.

Definition at line 348 of file BroadcastTimeAlarm.hxx.

◆ update_notify()

void openlcb::BroadcastTimeAlarmDate::update_notify ( )
inlineoverrideprivatevirtual

Called when the clock time has changed.

Reimplemented from openlcb::BroadcastTimeAlarm.

Definition at line 376 of file BroadcastTimeAlarm.hxx.

Member Data Documentation

◆ callbackUser_

std::function<void(BarrierNotifiable *)> openlcb::BroadcastTimeAlarmDate::callbackUser_
private

callback for when alarm expires

Definition at line 383 of file BroadcastTimeAlarm.hxx.


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