Panda3D
|
A list of tasks, for instance as returned by some of the AsyncTaskManager query functions. More...
#include "asyncTaskCollection.h"
Public Member Functions | |
AsyncTaskCollection (const AsyncTaskCollection ©) | |
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... | |
AsyncTask * | 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. More... | |
int | get_num_tasks () const |
Returns the number of AsyncTasks in the collection. More... | |
AsyncTask * | get_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 ©) |
AsyncTask * | operator[] (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... | |
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.
void AsyncTaskCollection::add_task | ( | AsyncTask * | task | ) |
Adds a new AsyncTask to the collection.
Definition at line 54 of file asyncTaskCollection.cxx.
References remove_task().
Referenced by AsyncTaskManager::find_tasks(), AsyncTaskManager::find_tasks_matching(), AsyncTaskChain::get_next_wake_time(), and AsyncTaskManager::remove().
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 get_num_tasks(), get_task(), and remove_tasks_from().
Referenced by AsyncTaskManager::get_active_tasks(), AsyncTaskManager::get_sleeping_tasks(), AsyncTaskManager::get_tasks(), AsyncTaskChain::get_tasks(), operator+=(), and remove_task().
void AsyncTaskCollection::clear | ( | ) |
Removes all AsyncTasks from the collection.
Definition at line 193 of file asyncTaskCollection.cxx.
References find_task().
Referenced by has_task().
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 AsyncTaskChain::get_num_tasks().
Referenced by clear().
int AsyncTaskCollection::get_num_tasks | ( | ) | const |
Returns the number of AsyncTasks in the collection.
Definition at line 222 of file asyncTaskCollection.cxx.
References get_task().
Referenced by add_tasks_from(), GraphicsStateGuardian::create_gamma_table(), find_task(), and AsyncTaskManager::remove().
AsyncTask * AsyncTaskCollection::get_task | ( | int | index | ) | const |
Returns the nth AsyncTask in the collection.
Definition at line 232 of file asyncTaskCollection.cxx.
References remove_task().
Referenced by add_tasks_from(), GraphicsStateGuardian::create_gamma_table(), get_num_tasks(), and AsyncTaskManager::remove().
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 clear(), and AsyncTaskChain::get_num_tasks().
Referenced by remove_duplicate_tasks(), and remove_tasks_from().
|
inline |
Returns a AsyncTaskCollection representing the concatenation of the two lists.
Definition at line 42 of file asyncTaskCollection.I.
Referenced by operator+=().
|
inline |
Appends the other list onto the end of this one.
Definition at line 31 of file asyncTaskCollection.I.
References add_tasks_from(), and operator+().
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.
References size().
Referenced by remove_task().
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 AsyncTaskChain::get_num_tasks(), and write().
Referenced by size().
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 AsyncTaskChain::get_num_tasks(), and has_task().
Referenced by remove_tasks_from().
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.
References add_tasks_from().
Referenced by add_task(), and get_task().
void AsyncTaskCollection::remove_task | ( | int | index | ) |
Removes the nth AsyncTask from the collection.
Definition at line 244 of file asyncTaskCollection.cxx.
References operator[]().
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 AsyncTaskChain::get_num_tasks(), has_task(), and remove_duplicate_tasks().
Referenced by add_tasks_from().
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.
References output().
Referenced by operator[]().
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 AsyncTaskChain::get_num_tasks().
Referenced by output().