![]() |
QP
0.7-SNAPSHOT
Control software for the ??SRT telescope
|
Maintain a queue of Activity instances. More...
#include <activities.h>
Public Member Functions | |
ActivityQueue () | |
Maintain a queue of upcoming activities. More... | |
Activity * | current () const |
Return the current activity. More... | |
Activity * | next () |
Return the next activity. More... | |
void | append (Activity *) |
Appends the given activity to the end of the queue. More... | |
void | replace (Activity *) |
Replace any activities in the queue. More... | |
void | cancel (void) |
Cancel all the activities in the queue. More... | |
Maintain a queue of Activity instances.
ActivityQueue::ActivityQueue | ( | ) |
Maintain a queue of upcoming activities.
Activities should be created using new XXXActivity()
, and either appended to the list here, or replace the contents of the queue. Activities are not started by being created or added to this queue. Once activities have been added to this queue, the queue takes ownership of them, so they should not be otherwise deleted.
void ActivityQueue::append | ( | Activity * | a | ) |
Appends the given activity to the end of the queue.
Like the replace method, this takes ownership of the object.
void ActivityQueue::cancel | ( | void | ) |
Cancel all the activities in the queue.
Each Activity has its Activity::cancel method called, and is then removed from the queue and deallocated. The queue ends up empty.
Activity * ActivityQueue::current | ( | ) | const |
Return the current activity.
This does not change the queue.
Activity * ActivityQueue::next | ( | ) |
Return the next activity.
The 'current activity' – the head of the queue – is dequeued, cancelled (possibly redundantly) and deallocated. Has no effect, returning only NULL, if the queue is empty.
void ActivityQueue::replace | ( | Activity * | a | ) |