Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
PeriodicEvent Class Reference
Inheritance diagram for PeriodicEvent:
[legend]
Collaboration diagram for PeriodicEvent:
[legend]

Public Member Functions

 PeriodicEvent (const Time &t, TimeoutQueue *q, const string &n, int interval, int max_exec)
 
void EventFct () override
 Event handler function to be overridden.
 
bool is_done () const
 
- Public Member Functions inherited from TimeoutQueue::Event
 ~Event () noexcept override
 
Execution_Status get_execution_status () const
 
Time getAbsoluteTime () const
 
void set_for_deletion ()
 
EventId get_id () const
 Get the unique event ID (auto-generated on construction)
 
const std::string & get_name () const
 Get the event name (for debugging)
 
void set_name (const std::string &name)
 Set the event name.
 
void set_completion_callback (CompletionCallback cb)
 Set the completion callback (called after EventFct completes or the event is canceled)
 

Private Attributes

TimeoutQueuequeue
 
string name
 
int interval_ms
 
int remaining_executions
 

Additional Inherited Members

- Public Types inherited from TimeoutQueue::Event
enum  Execution_Status {
  Out_Queue , In_Queue , Canceled , Executing ,
  Executed , To_Delete , Deleted
}
 Possible states of an event in its lifecycle. More...
 
using CompletionCallback = std::function< void(Event *, Execution_Status)>
 Optional callback invoked after an event completes, is canceled, or is deleted.
 
using EventId = uint64_t
 Type for unique event identifiers.
 
- Static Public Attributes inherited from TimeoutQueue::Event
static constexpr EventId InvalidId = 0
 Invalid/null event ID.
 
- Protected Member Functions inherited from TimeoutQueue::Event
 Event (const Time &t, std::string name="")
 
 Event (const long sec, const long nsec, std::string name="")
 

Detailed Description

Definition at line 256 of file timeoutQueue_example.C.

Constructor & Destructor Documentation

◆ PeriodicEvent()

PeriodicEvent::PeriodicEvent ( const Time t,
TimeoutQueue q,
const string &  n,
int  interval,
int  max_exec 
)
inline

Definition at line 264 of file timeoutQueue_example.C.

Member Function Documentation

◆ EventFct()

void PeriodicEvent::EventFct ( )
inlineoverridevirtual

Event handler function to be overridden.

This pure virtual function is called when the event's trigger time arrives. Override this in derived classes to implement custom event behavior. *

Implements TimeoutQueue::Event.

Definition at line 269 of file timeoutQueue_example.C.

References interval_ms, Aleph::maps(), name, now_str(), queue, remaining_executions, TimeoutQueue::reschedule_event(), and time_from_now_ms().

◆ is_done()

bool PeriodicEvent::is_done ( ) const
inline

Definition at line 279 of file timeoutQueue_example.C.

References remaining_executions.

Member Data Documentation

◆ interval_ms

int PeriodicEvent::interval_ms
private

Definition at line 260 of file timeoutQueue_example.C.

Referenced by EventFct().

◆ name

string PeriodicEvent::name
private

Definition at line 259 of file timeoutQueue_example.C.

Referenced by EventFct().

◆ queue

TimeoutQueue* PeriodicEvent::queue
private

Definition at line 258 of file timeoutQueue_example.C.

Referenced by EventFct().

◆ remaining_executions

int PeriodicEvent::remaining_executions
private

Definition at line 261 of file timeoutQueue_example.C.

Referenced by EventFct(), and is_done().


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