Panda3D
 All Classes Functions Variables Enumerations
Public Member Functions | List of all members
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

Public Member Functions

 AsyncTaskCollection (const AsyncTaskCollection &copy)
 
void add_task (AsyncTask *task)
 Adds a new AsyncTask to the collection. More...
 
void add_tasks_from (const AsyncTaskCollection &other)
 Adds all the AsyncTasks indicated in the other collection to this task. More...
 
void clear ()
 Removes all AsyncTasks from the collection. More...
 
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. More...
 
int get_num_tasks () const
 Returns the number of AsyncTasks in the collection. More...
 
AsyncTaskget_task (int index) const
 Returns the nth AsyncTask in the collection. More...
 
bool has_task (AsyncTask *task) const
 Returns true if the indicated AsyncTask appears in this collection, false otherwise. More...
 
 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. More...
 
void operator+= (const AsyncTaskCollection &other)
 Appends the other list onto the end of this one. More...
 
void operator= (const AsyncTaskCollection &copy)
 
AsyncTaskoperator[] (int index) const
 Returns the nth AsyncTask in the collection. More...
 
void output (ostream &out) const
 Writes a brief one-line description of the AsyncTaskCollection to the indicated output stream. More...
 
void remove_duplicate_tasks ()
 Removes any duplicate entries of the same AsyncTasks on this collection. More...
 
bool remove_task (AsyncTask *task)
 Removes the indicated AsyncTask from the collection. More...
 
void remove_task (int index)
 Removes the nth AsyncTask from the collection. More...
 
void remove_tasks_from (const AsyncTaskCollection &other)
 Removes from this collection all of the AsyncTasks listed in the other collection. More...
 
int size () const
 Returns the number of tasks in the collection. More...
 
void write (ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream. More...
 

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

void AsyncTaskCollection::add_task ( AsyncTask task)
void AsyncTaskCollection::add_tasks_from ( const AsyncTaskCollection other)

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+=().

void AsyncTaskCollection::clear ( )

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().

int AsyncTaskCollection::get_num_tasks ( ) const

Returns the number of AsyncTasks in the collection.

Definition at line 222 of file asyncTaskCollection.cxx.

Referenced by add_tasks_from(), find_task(), has_task(), output(), AsyncTaskManager::remove(), remove_duplicate_tasks(), remove_tasks_from(), and write().

AsyncTask * AsyncTaskCollection::get_task ( int  index) const

Returns the nth AsyncTask in the collection.

Definition at line 232 of file asyncTaskCollection.cxx.

Referenced by add_tasks_from(), find_task(), has_task(), AsyncTaskManager::remove(), remove_duplicate_tasks(), remove_tasks_from(), and write().

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().

void AsyncTaskCollection::remove_duplicate_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().

bool AsyncTaskCollection::remove_task ( AsyncTask 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.

void AsyncTaskCollection::remove_tasks_from ( const AsyncTaskCollection other)

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().

int AsyncTaskCollection::size ( ) const

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: