Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | 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:

## 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.
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 &copy)
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.

## 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 27 of file asyncTaskCollection.h.

## Constructor & Destructor Documentation

## ◆ AsyncTaskCollection() [1/2]

AsyncTaskCollection::AsyncTaskCollection | ( |  | ) |

Definition at line 20 of file asyncTaskCollection.cxx.

## ◆ AsyncTaskCollection() [2/2]

AsyncTaskCollection::AsyncTaskCollection | ( | const AsyncTaskCollection & | copy | ) |

Definition at line 27 of file asyncTaskCollection.cxx.

## ◆ ~AsyncTaskCollection()

AsyncTaskCollection::~AsyncTaskCollection | ( |  | ) |
| inline

Definition at line 17 of file asyncTaskCollection.I.

## Member Function Documentation

## ◆ add_task()

void AsyncTaskCollection::add_task | ( | AsyncTask * | task | ) |

Adds a new AsyncTask to the collection.

Definition at line 44 of file asyncTaskCollection.cxx.

References PointerToArray< PointerTo< AsyncTask > >::empty_array(), and PointerToArray< Element >::v().

Referenced by add_tasks_from(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().

## ◆ add_tasks_from()

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

## ◆ clear()

void AsyncTaskCollection::clear | ( |  | ) |

Removes all AsyncTasks from the collection.

Definition at line 167 of file asyncTaskCollection.cxx.

References PointerToArray< Element >::clear().

## ◆ find_task()

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.

## ◆ has_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().

## ◆ operator+()

AsyncTaskCollection AsyncTaskCollection::operator+ | ( | const AsyncTaskCollection & | other | ) | const
| inline

Returns a AsyncTaskCollection representing the concatenation of the two lists.

Definition at line 33 of file asyncTaskCollection.I.

## ◆ operator+=()

void AsyncTaskCollection::operator+= | ( | const AsyncTaskCollection & | other | ) |
| inline

Appends the other list onto the end of this one.

Definition at line 24 of file asyncTaskCollection.I.

References add_tasks_from().

## ◆ operator=()

void AsyncTaskCollection::operator= | ( | const AsyncTaskCollection & | copy | ) |

Definition at line 36 of file asyncTaskCollection.cxx.

## ◆ operator[]()

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.

## ◆ output()

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.

## ◆ remove_duplicate_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.

## ◆ remove_task() [1/2]

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.

References PointerToArray< PointerTo< AsyncTask > >::empty_array(), and PointerToArray< Element >::v().

## ◆ remove_task() [2/2]

void AsyncTaskCollection::remove_task | ( | size_t | index | ) |

Removes the nth AsyncTask from the collection.

Definition at line 209 of file asyncTaskCollection.cxx.

References PointerToArray< PointerTo< AsyncTask > >::empty_array(), and PointerToArray< Element >::v().

## ◆ remove_tasks_from()

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

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.

## ◆ write()

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

## Member Data Documentation

## ◆ get_num_tasks

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

## ◆ get_task

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

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

- panda/src/event/asyncTaskCollection.h
- panda/src/event/asyncTaskCollection.cxx
- panda/src/event/asyncTaskCollection.I