Panda3D
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:
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 std::string &name) const
 Returns the task in the collection with the indicated name, if any, or NULL if no task has that name. More...
 
size_t get_num_tasks () const
 
AsyncTaskget_task (size_t index) const
 
bool has_task (AsyncTask *task) const
 Returns true if the indicated AsyncTask appears in this collection, false otherwise. More...
 
AsyncTaskoperator [] (size_t index) const
 Returns the nth AsyncTask in the collection. More...
 
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)
 
void output (std::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 (size_t 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...
 
size_t size () const
 Returns the number of tasks in the collection. More...
 
void write (std::ostream &out, int indent_level=0) const
 Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream. More...
 

Public Attributes

 get_num_tasks
 Returns the number of AsyncTasks in the collection. More...
 
 get_task
 Returns the nth AsyncTask in the collection. 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 27 of file asyncTaskCollection.h.

Member Function Documentation

◆ add_task()

void AsyncTaskCollection::add_task ( AsyncTask task)

Adds a new AsyncTask to the collection.

Definition at line 45 of file asyncTaskCollection.cxx.

Referenced by 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 99 of file asyncTaskCollection.cxx.

References get_num_tasks.

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

◆ clear()

void AsyncTaskCollection::clear ( )

Removes all AsyncTasks from the collection.

Definition at line 168 of file asyncTaskCollection.cxx.

◆ 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 177 of file asyncTaskCollection.cxx.

References get_num_tasks.

◆ has_task()

bool AsyncTaskCollection::has_task ( AsyncTask task) const

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

Definition at line 155 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 230 of file asyncTaskCollection.cxx.

◆ operator+()

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

Returns a AsyncTaskCollection representing the concatenation of the two lists.

Definition at line 34 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 25 of file asyncTaskCollection.I.

References add_tasks_from().

◆ 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 249 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 130 of file asyncTaskCollection.cxx.

References get_num_tasks.

◆ 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 65 of file asyncTaskCollection.cxx.

◆ remove_task() [2/2]

void AsyncTaskCollection::remove_task ( size_t  index)

Removes the nth AsyncTask from the collection.

Definition at line 210 of file asyncTaskCollection.cxx.

◆ 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 112 of file asyncTaskCollection.cxx.

References get_num_tasks.

◆ 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 240 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 262 of file asyncTaskCollection.cxx.

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(), output(), AsyncTaskManager::remove(), remove_duplicate_tasks(), and remove_tasks_from().

◆ get_task

AsyncTask * AsyncTaskCollection::get_task

Returns the nth AsyncTask in the collection.

Definition at line 46 of file asyncTaskCollection.h.


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