|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Example demonstrating TimeoutQueue usage for timed event scheduling. More...
#include <iostream>#include <iomanip>#include <sstream>#include <atomic>#include <chrono>#include <thread>#include <timeoutQueue.H>Go to the source code of this file.
Classes | |
| class | SimpleEvent |
| class | NumberedEvent |
| class | CancellableEvent |
| class | ReschedulableEvent |
| class | PeriodicEvent |
| class | CallbackEvent |
Functions | |
| static Time | time_from_now_ms (int ms) |
| static string | format_time (const Time &t) |
| static string | now_str () |
| void | demo_simple_event (TimeoutQueue &queue) |
| void | demo_priority_ordering (TimeoutQueue &queue) |
| void | demo_cancellation (TimeoutQueue &queue) |
| void | demo_rescheduling (TimeoutQueue &queue) |
| void | demo_periodic_event (TimeoutQueue &queue) |
| void | demo_callback_event (TimeoutQueue &queue) |
| void | print_status (const TimeoutQueue::Event *e, const string &name) |
| void | demo_event_status (TimeoutQueue &queue) |
| void | demo_cancel_delete (TimeoutQueue &queue) |
| int | main () |
Example demonstrating TimeoutQueue usage for timed event scheduling.
TimeoutQueue - Priority-based timed event scheduler
This example demonstrates:
Definition in file timeoutQueue_example.C.
| void demo_callback_event | ( | TimeoutQueue & | queue | ) |
Definition at line 317 of file timeoutQueue_example.C.
References Aleph::maps(), now_str(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
| void demo_cancel_delete | ( | TimeoutQueue & | queue | ) |
Definition at line 381 of file timeoutQueue_example.C.
References TimeoutQueue::cancel_delete_event(), Aleph::maps(), now_str(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
| void demo_cancellation | ( | TimeoutQueue & | queue | ) |
Definition at line 180 of file timeoutQueue_example.C.
References TimeoutQueue::cancel_event(), TimeoutQueue::Event::Canceled, Aleph::maps(), now_str(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
| void demo_event_status | ( | TimeoutQueue & | queue | ) |
Definition at line 357 of file timeoutQueue_example.C.
References Aleph::maps(), now_str(), print_status(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
| void demo_periodic_event | ( | TimeoutQueue & | queue | ) |
Definition at line 282 of file timeoutQueue_example.C.
References Aleph::maps(), now_str(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
| void demo_priority_ordering | ( | TimeoutQueue & | queue | ) |
Definition at line 129 of file timeoutQueue_example.C.
References Aleph::maps(), now_str(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
| void demo_rescheduling | ( | TimeoutQueue & | queue | ) |
Definition at line 232 of file timeoutQueue_example.C.
References Aleph::maps(), now_str(), TimeoutQueue::reschedule_event(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
| void demo_simple_event | ( | TimeoutQueue & | queue | ) |
Definition at line 96 of file timeoutQueue_example.C.
References Aleph::maps(), now_str(), TimeoutQueue::schedule_event(), and time_from_now_ms().
Referenced by main().
|
static |
Definition at line 53 of file timeoutQueue_example.C.
References Aleph::maps().
| int main | ( | ) |
Definition at line 401 of file timeoutQueue_example.C.
References demo_callback_event(), demo_cancel_delete(), demo_cancellation(), demo_event_status(), demo_periodic_event(), demo_priority_ordering(), demo_rescheduling(), demo_simple_event(), Aleph::maps(), now_str(), and TimeoutQueue::shutdown().
|
static |
Definition at line 61 of file timeoutQueue_example.C.
References Aleph::maps().
Referenced by demo_callback_event(), demo_cancel_delete(), demo_cancellation(), demo_event_status(), demo_periodic_event(), demo_priority_ordering(), demo_rescheduling(), demo_simple_event(), SimpleEvent::EventFct(), NumberedEvent::EventFct(), CancellableEvent::EventFct(), ReschedulableEvent::EventFct(), PeriodicEvent::EventFct(), and main().
| void print_status | ( | const TimeoutQueue::Event * | e, |
| const string & | name | ||
| ) |
Definition at line 348 of file timeoutQueue_example.C.
References TimeoutQueue::Event::get_execution_status(), and Aleph::maps().
Referenced by demo_event_status().
|
static |
Definition at line 47 of file timeoutQueue_example.C.
References Aleph::maps(), read_current_time(), and time_plus_msec().
Referenced by demo_callback_event(), demo_cancel_delete(), demo_cancellation(), demo_event_status(), demo_periodic_event(), demo_priority_ordering(), demo_rescheduling(), demo_simple_event(), and PeriodicEvent::EventFct().