QP  0.7-SNAPSHOT
Control software for the ??SRT telescope
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
ActivityQueue Class Reference

Maintain a queue of Activity instances. More...

#include <activities.h>

Public Member Functions

 ActivityQueue ()
 Maintain a queue of upcoming activities. More...
 
Activitycurrent () const
 Return the current activity. More...
 
Activitynext ()
 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...
 

Detailed Description

Maintain a queue of Activity instances.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Returns
a pointer to the activity, or NULL if the queue is empty
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.

Returns
a pointer to the activity now at the head of the queue; or NULL if the queue is now empty
void ActivityQueue::replace ( Activity a)

Replace any activities in the queue.

Equivalent to cancel followed by append.


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