Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions

AsyncTaskSequence Class Reference

A special kind of task that serves as a list of tasks internally. More...

#include "asyncTaskSequence.h"

Inheritance diagram for AsyncTaskSequence:
AsyncTask AsyncTaskCollection AsyncTaskBase TypedReferenceCount Namable TypedObject ReferenceCount MemoryBase MemoryBase MemoryBase

List of all members.

Public Member Functions

 AsyncTaskSequence (const string &name)
virtual TypeHandle force_init_type ()
int get_current_task_index () const
 Returns the index of the task within the sequence that is currently being executed (or that will be executed at the next epoch).
int get_repeat_count () const
 Returns the repeat count of the sequence.
virtual TypeHandle get_type () const
void set_repeat_count (int repeat_count)
 Sets the repeat count of the sequence.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Member Functions

virtual DoneStatus do_task ()
 Override this function to do something useful for the task.
virtual bool is_runnable ()
 Override this function to return true if the task can be successfully executed, false if it cannot.
virtual void upon_birth (AsyncTaskManager *manager)
 Override this function to do something useful when the task has been added to the active queue.
virtual void upon_death (AsyncTaskManager *manager, bool clean_exit)
 Override this function to do something useful when the task has been removed from the active queue.

Detailed Description

A special kind of task that serves as a list of tasks internally.

Each task on the list is executed in sequence, one per epoch.

This is similar to a Sequence interval, though it has some slightly different abilities. For instance, although you can't start at any arbitrary point in the sequence, you can construct a task sequence whose duration changes during playback.

Definition at line 37 of file asyncTaskSequence.h.


Member Function Documentation

AsyncTask::DoneStatus AsyncTaskSequence::do_task ( ) [protected, virtual]

Override this function to do something useful for the task.

This function is called with the lock *not* held.

Reimplemented from AsyncTask.

Definition at line 66 of file asyncTaskSequence.cxx.

References AsyncTaskCollection::get_num_tasks(), and AsyncTaskCollection::get_task().

int AsyncTaskSequence::get_current_task_index ( ) const [inline]

Returns the index of the task within the sequence that is currently being executed (or that will be executed at the next epoch).

Definition at line 49 of file asyncTaskSequence.I.

int AsyncTaskSequence::get_repeat_count ( ) const [inline]

Returns the repeat count of the sequence.

See set_repeat_count().

Definition at line 37 of file asyncTaskSequence.I.

bool AsyncTaskSequence::is_runnable ( ) [protected, virtual]

Override this function to return true if the task can be successfully executed, false if it cannot.

Mainly intended as a sanity check when attempting to add the task to a task manager.

This function is called with the lock held.

Reimplemented from AsyncTask.

Definition at line 53 of file asyncTaskSequence.cxx.

References AsyncTaskCollection::get_num_tasks().

void AsyncTaskSequence::set_repeat_count ( int  repeat_count) [inline]

Sets the repeat count of the sequence.

If the count is 0 or 1, the sequence will run exactly once. If it is greater than 0, it will run that number of times. If it is negative, it will run forever until it is explicitly removed.

Definition at line 26 of file asyncTaskSequence.I.

void AsyncTaskSequence::upon_birth ( AsyncTaskManager manager) [protected, virtual]

Override this function to do something useful when the task has been added to the active queue.

This function is called with the lock held. You may temporarily release if it necessary, but be sure to return with it held.

Reimplemented from AsyncTask.

Definition at line 139 of file asyncTaskSequence.cxx.

void AsyncTaskSequence::upon_death ( AsyncTaskManager manager,
bool  clean_exit 
) [protected, virtual]

Override this function to do something useful when the task has been removed from the active queue.

The parameter clean_exit is true if the task has been removed because it exited normally (returning DS_done), or false if it was removed for some other reason (e.g. AsyncTaskManager::remove()). By the time this method is called, _manager has been cleared, so the parameter manager indicates the original AsyncTaskManager that owned this task.

The normal behavior is to throw the done_event only if clean_exit is true.

This function is called with the lock held. You may temporarily release if it necessary, but be sure to return with it held.

Reimplemented from AsyncTask.

Definition at line 166 of file asyncTaskSequence.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations