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. | |
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. | |
AsyncTask * | find_task (const std::string &name) const |
Returns the task in the collection with the indicated name, if any, or NULL if no task has that name. | |
size_t | get_num_tasks () const |
AsyncTask * | get_task (size_t index) const |
bool | has_task (AsyncTask *task) const |
Returns true if the indicated AsyncTask appears in this collection, false otherwise. | |
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 ©) |
AsyncTask * | operator[] (size_t index) const |
Returns the nth AsyncTask in the collection. | |
void | output (std::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 (size_t 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. | |
size_t | size () const |
Returns the number of tasks in the collection. | |
void | write (std::ostream &out, int indent_level=0) const |
Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream. | |
Public Attributes | |
get_num_tasks | |
Returns the number of AsyncTasks in the collection. | |
get_task | |
Returns the nth AsyncTask in the collection. | |
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 27 of file asyncTaskCollection.h.
AsyncTaskCollection::AsyncTaskCollection | ( | ) |
Definition at line 20 of file asyncTaskCollection.cxx.
AsyncTaskCollection::AsyncTaskCollection | ( | const AsyncTaskCollection & | copy | ) |
Definition at line 27 of file asyncTaskCollection.cxx.
|
inline |
Definition at line 17 of file asyncTaskCollection.I.
void AsyncTaskCollection::add_task | ( | AsyncTask * | task | ) |
Adds a new AsyncTask to the collection.
Definition at line 44 of file asyncTaskCollection.cxx.
Referenced by add_tasks_from(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().
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 98 of file asyncTaskCollection.cxx.
References add_task(), get_num_tasks, and get_task.
Referenced by AsyncTaskChain::get_tasks(), and operator+=().
void AsyncTaskCollection::clear | ( | ) |
Removes all AsyncTasks from the collection.
Definition at line 167 of file asyncTaskCollection.cxx.
AsyncTask * AsyncTaskCollection::find_task | ( | const std::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 176 of file asyncTaskCollection.cxx.
References get_num_tasks, and get_task.
bool AsyncTaskCollection::has_task | ( | AsyncTask * | task | ) | const |
Returns true if the indicated AsyncTask appears in this collection, false otherwise.
Definition at line 154 of file asyncTaskCollection.cxx.
References get_num_tasks, and get_task.
Referenced by remove_tasks_from().
|
inline |
Returns a AsyncTaskCollection representing the concatenation of the two lists.
Definition at line 33 of file asyncTaskCollection.I.
|
inline |
Appends the other list onto the end of this one.
Definition at line 24 of file asyncTaskCollection.I.
References add_tasks_from().
void AsyncTaskCollection::operator= | ( | const AsyncTaskCollection & | copy | ) |
Definition at line 36 of file asyncTaskCollection.cxx.
AsyncTask * AsyncTaskCollection::operator[] | ( | size_t | 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 229 of file asyncTaskCollection.cxx.
void AsyncTaskCollection::output | ( | std::ostream & | out | ) | const |
Writes a brief one-line description of the AsyncTaskCollection to the indicated output stream.
Definition at line 248 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 129 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 64 of file asyncTaskCollection.cxx.
void AsyncTaskCollection::remove_task | ( | size_t | index | ) |
Removes the nth AsyncTask from the collection.
Definition at line 209 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 111 of file asyncTaskCollection.cxx.
References get_num_tasks, get_task, and has_task().
size_t AsyncTaskCollection::size | ( | ) | const |
Returns the number of tasks in the collection.
This is the same thing as get_num_tasks().
Definition at line 239 of file asyncTaskCollection.cxx.
void AsyncTaskCollection::write | ( | std::ostream & | out, |
int | indent_level = 0 ) const |
Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream.
Definition at line 261 of file asyncTaskCollection.cxx.
References get_num_tasks, get_task, and indent().
size_t AsyncTaskCollection::get_num_tasks |
Returns the number of AsyncTasks in the collection.
Definition at line 46 of file asyncTaskCollection.h.
Referenced by add_tasks_from(), find_task(), has_task(), output(), AsyncTaskManager::remove(), remove_duplicate_tasks(), remove_tasks_from(), and write().
AsyncTask * AsyncTaskCollection::get_task |
Returns the nth AsyncTask in the collection.
Definition at line 46 of file asyncTaskCollection.h.
Referenced by add_tasks_from(), find_task(), has_task(), AsyncTaskManager::remove(), remove_duplicate_tasks(), remove_tasks_from(), and write().