Panda3D
Public Member Functions
AsyncTaskCollection Class Reference

A list of tasks, for instance as returned by some of the AsyncTaskManager query functions. More...

#include "asyncTaskCollection.h"

Inheritance diagram for AsyncTaskCollection:
AsyncTaskSequence

List of all members.

Public Member Functions

 AsyncTaskCollection (const AsyncTaskCollection &copy)
void add_task (AsyncTask *task)
 Adds a new AsyncTask to the collection.
void add_tasks_from (const AsyncTaskCollection &other)
 Adds all the AsyncTasks indicated in the other collection to this task.
void clear ()
 Removes all AsyncTasks from the collection.
AsyncTaskfind_task (const string &name) const
 Returns the task in the collection with the indicated name, if any, or NULL if no task has that name.
int get_num_tasks () const
 Returns the number of AsyncTasks in the collection.
AsyncTaskget_task (int index) const
 Returns the nth AsyncTask in the collection.
bool has_task (AsyncTask *task) const
 Returns true if the indicated AsyncTask appears in this collection, false otherwise.
 MAKE_SEQ (get_tasks, get_num_tasks, get_task)
AsyncTaskCollection operator+ (const AsyncTaskCollection &other) const
 Returns a AsyncTaskCollection representing the concatenation of the two lists.
void operator+= (const AsyncTaskCollection &other)
 Appends the other list onto the end of this one.
void operator= (const AsyncTaskCollection &copy)
AsyncTaskoperator[] (int index) const
 Returns the nth AsyncTask in the collection.
void output (ostream &out) const
 Writes a brief one-line description of the AsyncTaskCollection to the indicated output stream.
void remove_duplicate_tasks ()
 Removes any duplicate entries of the same AsyncTasks on this collection.
bool remove_task (AsyncTask *task)
 Removes the indicated AsyncTask from the collection.
void remove_task (int index)
 Removes the nth AsyncTask from the collection.
void remove_tasks_from (const AsyncTaskCollection &other)
 Removes from this collection all of the AsyncTasks listed in the other collection.
int size () const
 Returns the number of tasks in the collection.
void write (ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream.

Detailed Description

A list of tasks, for instance as returned by some of the AsyncTaskManager query functions.

This also serves to define an AsyncTaskSequence.

TODO: None of this is thread-safe yet.

Definition at line 30 of file asyncTaskCollection.h.


Member Function Documentation

Adds all the AsyncTasks indicated in the other collection to this task.

The other tasks are simply appended to the end of the tasks in this list; duplicates are not automatically removed.

Definition at line 115 of file asyncTaskCollection.cxx.

References add_task(), get_num_tasks(), and get_task().

Referenced by AsyncTaskManager::get_active_tasks(), AsyncTaskManager::get_sleeping_tasks(), AsyncTaskManager::get_tasks(), AsyncTaskChain::get_tasks(), and operator+=().

Removes all AsyncTasks from the collection.

Definition at line 193 of file asyncTaskCollection.cxx.

AsyncTask * AsyncTaskCollection::find_task ( const string &  name) const

Returns the task in the collection with the indicated name, if any, or NULL if no task has that name.

Definition at line 205 of file asyncTaskCollection.cxx.

References get_num_tasks(), and get_task().

AsyncTask * AsyncTaskCollection::get_task ( int  index) const
bool AsyncTaskCollection::has_task ( AsyncTask task) const

Returns true if the indicated AsyncTask appears in this collection, false otherwise.

Definition at line 178 of file asyncTaskCollection.cxx.

References get_num_tasks(), and get_task().

Referenced by remove_tasks_from().

AsyncTaskCollection AsyncTaskCollection::operator+ ( const AsyncTaskCollection other) const [inline]

Returns a AsyncTaskCollection representing the concatenation of the two lists.

Definition at line 42 of file asyncTaskCollection.I.

void AsyncTaskCollection::operator+= ( const AsyncTaskCollection other) [inline]

Appends the other list onto the end of this one.

Definition at line 31 of file asyncTaskCollection.I.

References add_tasks_from().

AsyncTask * AsyncTaskCollection::operator[] ( int  index) const

Returns the nth AsyncTask in the collection.

This is the same as get_task(), but it may be a more convenient way to access it.

Definition at line 268 of file asyncTaskCollection.cxx.

void AsyncTaskCollection::output ( ostream &  out) const

Writes a brief one-line description of the AsyncTaskCollection to the indicated output stream.

Definition at line 292 of file asyncTaskCollection.cxx.

References get_num_tasks().

Removes any duplicate entries of the same AsyncTasks on this collection.

If a AsyncTask appears multiple times, the first appearance is retained; subsequent appearances are removed.

Definition at line 151 of file asyncTaskCollection.cxx.

References get_num_tasks(), and get_task().

Removes the indicated AsyncTask from the collection.

Returns true if the task was removed, false if it was not a member of the collection.

Definition at line 78 of file asyncTaskCollection.cxx.

void AsyncTaskCollection::remove_task ( int  index)

Removes the nth AsyncTask from the collection.

Definition at line 244 of file asyncTaskCollection.cxx.

Removes from this collection all of the AsyncTasks listed in the other collection.

Definition at line 130 of file asyncTaskCollection.cxx.

References get_num_tasks(), get_task(), and has_task().

Returns the number of tasks in the collection.

This is the same thing as get_num_tasks().

Definition at line 281 of file asyncTaskCollection.cxx.

void AsyncTaskCollection::write ( ostream &  out,
int  indent_level = 0 
) const

Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream.

Definition at line 307 of file asyncTaskCollection.cxx.

References get_num_tasks(), and get_task().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations