Panda3D
|
A special kind of task that serves as a list of tasks internally. More...
#include "asyncTaskSequence.h"
Public Types | |
enum | DoneStatus { DS_done, DS_cont, DS_again, DS_pickup, DS_exit, DS_pause, DS_interrupt } |
enum | State { S_inactive, S_active, S_servicing, S_servicing_removed, S_sleeping, S_active_nested } |
Public Member Functions | |
AsyncTaskSequence (const string &name) | |
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. | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
void | clear () |
Removes all AsyncTasks from the collection. | |
void | clear_delay () |
Removes any delay specified for the task. | |
void | clear_name () |
Resets the task's name to empty. | |
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. | |
virtual TypeHandle | force_init_type () |
double | get_average_dt () const |
Returns the average amount of time elapsed during each of the task's previous run cycles, in seconds. | |
int | get_best_parent_from_Set (const std::set< int > &) const |
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). | |
double | get_delay () const |
Returns the delay value that has been set via set_delay, if any. | |
const string & | get_done_event () const |
Returns the event name that will be triggered when the task finishes. | |
double | get_dt () const |
Returns the amount of time elapsed during the task's previous run cycle, in seconds. | |
int | get_elapsed_frames () const |
Returns the number of frames that have elapsed since the task was started, according to the task manager's clock. | |
double | get_elapsed_time () const |
Returns the amount of time that has elapsed since the task was started, according to the task manager's clock. | |
AsyncTaskManager * | get_manager () const |
Returns the AsyncTaskManager that this task is active on. | |
double | get_max_dt () const |
Returns the maximum amount of time elapsed during any one of the task's previous run cycles, in seconds. | |
const string & | get_name () const |
string | get_name_prefix () const |
Returns the initial part of the name, up to but not including any trailing digits following a hyphen or underscore. | |
int | get_num_tasks () const |
Returns the number of AsyncTasks in the collection. | |
int | get_priority () const |
Returns the task's current priority value. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | get_repeat_count () const |
Returns the repeat count of the sequence. | |
int | get_sort () const |
Returns the task's current sort value. | |
int | get_start_frame () const |
Returns the frame number at which the task was started, according to the task manager's clock. | |
double | get_start_time () const |
Returns the time at which the task was started, according to the task manager's clock. | |
State | get_state () const |
Returns the current state of the task. | |
AsyncTask * | get_task (int index) const |
Returns the nth AsyncTask in the collection. | |
const string & | get_task_chain () const |
Returns the AsyncTaskChain on which this task will be running. | |
AtomicAdjust::Integer | get_task_id () const |
Returns a number guaranteed to be unique for each different AsyncTask object in the universe. | |
virtual TypeHandle | get_type () const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
double | get_wake_time () const |
If this task has been added to an AsyncTaskManager with a delay in effect, this returns the time at which the task is expected to awaken. | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
bool | has_delay () const |
Returns true if a delay has been set for this task via set_delay(), or false otherwise. | |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
bool | has_task (AsyncTask *task) const |
Returns true if the indicated AsyncTask appears in this collection, false otherwise. | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. | |
bool | is_alive () const |
Returns true if the task is currently active or sleeping on some task chain, meaning that it will be executed in its turn, or false if it is not active. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
MAKE_SEQ (get_tasks, get_num_tasks, get_task) | |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *, void *) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
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. | |
AsyncTask * | operator[] (int index) const |
Returns the nth AsyncTask in the collection. | |
virtual void | output (ostream &out) const |
Outputs the Namable. | |
void | output (ostream &out) const |
Writes a brief one-line description of the AsyncTaskCollection to the indicated output stream. | |
void | recalc_wake_time () |
If the task is currently sleeping on a task chain, this resets its wake time to the current time + get_delay(). | |
void | ref () const |
Explicitly increments the reference count. | |
void | remove () |
Removes the task from its active manager, if any, and makes the state S_inactive (or possible S_servicing_removed). | |
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 (int 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. | |
void | set_delay (double delay) |
Specifies the amount of time, in seconds, by which this task will be delayed after it has been added to the AsyncTaskManager. | |
void | set_done_event (const string &done_event) |
Sets the event name that will be triggered when the task finishes. | |
void | set_name (const string &name) |
void | set_priority (int priority) |
Specifies a priority value for this task. | |
void | set_repeat_count (int repeat_count) |
Sets the repeat count of the sequence. | |
void | set_sort (int sort) |
Specifies a sort value for this task. | |
void | set_task_chain (const string &chain_name) |
Specifies the AsyncTaskChain on which this task will be running. | |
int | size () const |
Returns the number of tasks in the collection. | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
virtual bool | unref () const |
Explicitly decrements the reference count. | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. | |
void | write (ostream &out, int indent_level=0) const |
Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Member Functions | |
void | clear_task (Thread *current_thread) |
Indicates that this task is no longer running on the indicated thread. | |
virtual DoneStatus | do_task () |
Override this function to do something useful for the task. | |
bool | do_test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | do_test_ref_count_nonzero () const |
Returns true if the reference count is nonzero, false otherwise. | |
virtual bool | is_runnable () |
Override this function to return true if the task can be successfully executed, false if it cannot. | |
void | jump_to_task_chain (AsyncTaskManager *manager) |
Switches the AsyncTask to its new task chain, named by _chain_name. | |
void | record_task (Thread *current_thread) |
Indicates that this task is now the current task running on the indicated thread, presumably the current thread. | |
DoneStatus | unlock_and_do_task () |
Called by the AsyncTaskManager to actually run the task. | |
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. | |
Protected Attributes | |
AsyncTaskChain * | _chain |
string | _chain_name |
double | _delay |
string | _done_event |
double | _dt |
bool | _has_delay |
AsyncTaskManager * | _manager |
double | _max_dt |
int | _num_frames |
int | _priority |
Thread * | _servicing_thread |
int | _sort |
int | _start_frame |
double | _start_time |
State | _state |
AtomicAdjust::Integer | _task_id |
PStatCollector | _task_pcollector |
double | _total_dt |
double | _wake_time |
Static Protected Attributes | |
static AtomicAdjust::Integer | _next_task_id |
static PStatCollector | _show_code_pcollector |
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.
void AsyncTaskCollection::add_task | ( | AsyncTask * | task | ) | [inherited] |
Adds a new AsyncTask to the collection.
Definition at line 54 of file asyncTaskCollection.cxx.
Referenced by AsyncTaskCollection::add_tasks_from(), AsyncTaskChain::do_get_active_tasks(), AsyncTaskChain::do_get_sleeping_tasks(), AsyncTaskManager::find_tasks(), AsyncTaskManager::find_tasks_matching(), and AsyncTaskManager::remove().
void AsyncTaskCollection::add_tasks_from | ( | const AsyncTaskCollection & | other | ) | [inherited] |
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 AsyncTaskCollection::add_task(), AsyncTaskCollection::get_num_tasks(), and AsyncTaskCollection::get_task().
Referenced by AsyncTaskManager::get_active_tasks(), AsyncTaskManager::get_sleeping_tasks(), AsyncTaskChain::get_tasks(), AsyncTaskManager::get_tasks(), and AsyncTaskCollection::operator+=().
TypedObject * TypedObject::as_typed_object | ( | ) | [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 99 of file typedObject.I.
const TypedObject * TypedObject::as_typed_object | ( | ) | const [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 110 of file typedObject.I.
void AsyncTaskCollection::clear | ( | ) | [inherited] |
Removes all AsyncTasks from the collection.
Definition at line 193 of file asyncTaskCollection.cxx.
void AsyncTask::clear_delay | ( | ) | [inline, inherited] |
Removes any delay specified for the task.
The next time the task is added to the queue, it will run immediately. This does not affect the task's wake time if it has already been added to the queue.
Definition at line 100 of file asyncTask.I.
void AsyncTask::clear_name | ( | ) | [inline, inherited] |
Resets the task's name to empty.
Reimplemented from Namable.
Definition at line 163 of file asyncTask.I.
void AsyncTaskBase::clear_task | ( | Thread * | current_thread | ) | [protected, inherited] |
Indicates that this task is no longer running on the indicated thread.
Definition at line 73 of file asyncTaskBase.cxx.
Referenced by AsyncTask::unlock_and_do_task().
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().
bool ReferenceCount::do_test_ref_count_integrity | ( | ) | const [protected, inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
Definition at line 29 of file referenceCount.cxx.
Referenced by ReferenceCount::do_test_ref_count_nonzero(), and ReferenceCount::test_ref_count_integrity().
bool ReferenceCount::do_test_ref_count_nonzero | ( | ) | const [protected, inherited] |
Returns true if the reference count is nonzero, false otherwise.
Definition at line 56 of file referenceCount.cxx.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by ReferenceCount::test_ref_count_nonzero().
AsyncTask * AsyncTaskCollection::find_task | ( | const string & | name | ) | const [inherited] |
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 AsyncTaskCollection::get_num_tasks(), and AsyncTaskCollection::get_task().
double AsyncTask::get_average_dt | ( | ) | const [inline, inherited] |
Returns the average amount of time elapsed during each of the task's previous run cycles, in seconds.
Definition at line 302 of file asyncTask.I.
Referenced by AsyncTaskChain::filter_timeslice_priority(), and AsyncTaskChain::write_task_line().
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.
double AsyncTask::get_delay | ( | ) | const [inline, inherited] |
Returns the delay value that has been set via set_delay, if any.
Definition at line 123 of file asyncTask.I.
Referenced by AsyncTaskChain::do_add().
const string & AsyncTask::get_done_event | ( | ) | const [inline, inherited] |
Returns the event name that will be triggered when the task finishes.
See set_done_event().
Definition at line 235 of file asyncTask.I.
double AsyncTask::get_dt | ( | ) | const [inline, inherited] |
Returns the amount of time elapsed during the task's previous run cycle, in seconds.
Definition at line 280 of file asyncTask.I.
int AsyncTask::get_elapsed_frames | ( | ) | const [inherited] |
Returns the number of frames that have elapsed since the task was started, according to the task manager's clock.
It is only valid to call this if the task's status is not S_inactive.
Definition at line 177 of file asyncTask.cxx.
double AsyncTask::get_elapsed_time | ( | ) | const [inherited] |
Returns the amount of time that has elapsed since the task was started, according to the task manager's clock.
It is only valid to call this if the task's status is not S_inactive.
Definition at line 160 of file asyncTask.cxx.
AsyncTaskManager * AsyncTask::get_manager | ( | ) | const [inline, inherited] |
Returns the AsyncTaskManager that this task is active on.
This will be NULL if the state is S_inactive.
Definition at line 61 of file asyncTask.I.
double AsyncTask::get_max_dt | ( | ) | const [inline, inherited] |
Returns the maximum amount of time elapsed during any one of the task's previous run cycles, in seconds.
Definition at line 291 of file asyncTask.I.
string AsyncTask::get_name_prefix | ( | ) | const [inherited] |
Returns the initial part of the name, up to but not including any trailing digits following a hyphen or underscore.
Definition at line 249 of file asyncTask.cxx.
int AsyncTaskCollection::get_num_tasks | ( | ) | const [inherited] |
Returns the number of AsyncTasks in the collection.
Definition at line 222 of file asyncTaskCollection.cxx.
Referenced by AsyncTaskCollection::add_tasks_from(), GraphicsStateGuardian::async_reload_texture(), do_task(), AsyncTaskCollection::find_task(), AsyncTaskCollection::has_task(), is_runnable(), AsyncTaskCollection::output(), AsyncTaskManager::remove(), AsyncTaskCollection::remove_duplicate_tasks(), AsyncTaskCollection::remove_tasks_from(), and AsyncTaskCollection::write().
int AsyncTask::get_priority | ( | ) | const [inline, inherited] |
Returns the task's current priority value.
See set_priority().
Definition at line 209 of file asyncTask.I.
Referenced by GraphicsStateGuardian::async_reload_texture().
int ReferenceCount::get_ref_count | ( | ) | const [inline, inherited] |
Returns the current reference count.
Definition at line 155 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by TransformState::clear_cache(), RenderState::clear_cache(), RenderState::finalize(), RenderEffects::finalize(), RenderEffect::finalize(), RenderAttrib::finalize(), InternalName::finalize(), TransformState::get_num_unused_states(), RenderState::get_num_unused_states(), TransformState::list_cycles(), RenderState::list_cycles(), GeomVertexFormat::remove_column(), TransformState::unref(), RenderState::unref(), RenderState::~RenderState(), and TransformState::~TransformState().
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.
int AsyncTask::get_sort | ( | ) | const [inline, inherited] |
Returns the task's current sort value.
See set_sort().
Definition at line 198 of file asyncTask.I.
Referenced by AsyncTaskChain::do_add().
int AsyncTask::get_start_frame | ( | ) | const [inline, inherited] |
Returns the frame number at which the task was started, according to the task manager's clock.
It is only valid to call this if the task's status is not S_inactive.
Definition at line 152 of file asyncTask.I.
double AsyncTask::get_start_time | ( | ) | const [inline, inherited] |
Returns the time at which the task was started, according to the task manager's clock.
It is only valid to call this if the task's status is not S_inactive.
Definition at line 137 of file asyncTask.I.
AsyncTask::State AsyncTask::get_state | ( | ) | const [inline, inherited] |
Returns the current state of the task.
Definition at line 22 of file asyncTask.I.
AsyncTask * AsyncTaskCollection::get_task | ( | int | index | ) | const [inherited] |
Returns the nth AsyncTask in the collection.
Definition at line 232 of file asyncTaskCollection.cxx.
Referenced by AsyncTaskCollection::add_tasks_from(), GraphicsStateGuardian::async_reload_texture(), do_task(), AsyncTaskCollection::find_task(), AsyncTaskCollection::has_task(), AsyncTaskManager::remove(), AsyncTaskCollection::remove_duplicate_tasks(), AsyncTaskCollection::remove_tasks_from(), and AsyncTaskCollection::write().
const string & AsyncTask::get_task_chain | ( | ) | const [inline, inherited] |
Returns the AsyncTaskChain on which this task will be running.
Each task chain runs tasks independently of the others.
Definition at line 186 of file asyncTask.I.
AtomicAdjust::Integer AsyncTask::get_task_id | ( | ) | const [inline, inherited] |
Returns a number guaranteed to be unique for each different AsyncTask object in the universe.
Definition at line 174 of file asyncTask.I.
int TypedObject::get_type_index | ( | ) | const [inline, inherited] |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
This is equivalent to get_type().get_index().
Definition at line 52 of file typedObject.I.
References TypeHandle::get_index().
double AsyncTask::get_wake_time | ( | ) | const [inherited] |
If this task has been added to an AsyncTaskManager with a delay in effect, this returns the time at which the task is expected to awaken.
It has no meaning if the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added.
If the task's status is not S_sleeping, this returns 0.0.
Definition at line 107 of file asyncTask.cxx.
WeakReferenceList * ReferenceCount::get_weak_list | ( | ) | const [inline, inherited] |
Returns the WeakReferenceList associated with this ReferenceCount object.
If there has never been a WeakReferenceList associated with this object, creates one now.
Definition at line 307 of file referenceCount.I.
Referenced by ReferenceCount::weak_ref().
bool AsyncTask::has_delay | ( | ) | const [inline, inherited] |
Returns true if a delay has been set for this task via set_delay(), or false otherwise.
Definition at line 112 of file asyncTask.I.
Referenced by AsyncTaskChain::do_add().
bool Namable::has_name | ( | ) | const [inline, inherited] |
Returns true if the Namable has a nonempty name set, false if the name is empty.
Definition at line 75 of file namable.I.
Referenced by XFileNode::add_child(), EggComponentData::add_name(), Texture::do_read_dds_file(), Texture::do_read_one(), Character::fillin(), EggGroupUniquifier::get_category(), EggXfmSAnim::optimize(), NodePathComponent::output(), AsyncTask::output(), EggNamedObject::output(), EggSAnimData::write(), EggPrimitive::write_body(), ParametricCurveCollection::write_egg(), ParametricCurve::write_egg(), EggNamedObject::write_header(), XFileDataNodeTemplate::write_text(), and XFileDataDef::write_text().
bool AsyncTaskCollection::has_task | ( | AsyncTask * | task | ) | const [inherited] |
Returns true if the indicated AsyncTask appears in this collection, false otherwise.
Definition at line 178 of file asyncTaskCollection.cxx.
References AsyncTaskCollection::get_num_tasks(), and AsyncTaskCollection::get_task().
Referenced by AsyncTaskCollection::remove_tasks_from().
bool ReferenceCount::has_weak_list | ( | ) | const [inline, inherited] |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
In general, this will be true if there was ever a WeakPointerTo created for this object (even if there is not any for it now).
Definition at line 294 of file referenceCount.I.
Referenced by ReferenceCount::weak_unref().
bool AsyncTask::is_alive | ( | ) | const [inline, inherited] |
Returns true if the task is currently active or sleeping on some task chain, meaning that it will be executed in its turn, or false if it is not active.
If the task has recently been removed while it is in the middle of execution, this will return false, because the task will not run again once it finishes.
Definition at line 37 of file asyncTask.I.
bool TypedObject::is_exact_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is the indicated type exactly.
Definition at line 74 of file typedObject.I.
References TypeHandle::get_name().
Referenced by GraphicsStateGuardian::async_reload_texture(), PortalNode::combine_with(), PandaNode::combine_with(), GeomNode::combine_with(), CollisionNode::combine_with(), Character::combine_with(), PGItem::cull_callback(), FactoryParams::get_param_of_type(), CollisionHandlerPusher::handle_entries(), SceneGraphReducer::r_flatten(), ConnectionWriter::send(), FltToEggLevelState::set_transform(), and VirtualFileSystem::unmount().
bool TypedObject::is_of_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is or derives from the indicated type.
Definition at line 63 of file typedObject.I.
References TypeHandle::is_derived_from().
Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().
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 AsyncTask::jump_to_task_chain | ( | AsyncTaskManager * | manager | ) | [protected, inherited] |
Switches the AsyncTask to its new task chain, named by _chain_name.
Called internally only.
Definition at line 423 of file asyncTask.cxx.
References AsyncTaskChain::do_add(), AsyncTaskManager::do_find_task_chain(), and AsyncTaskManager::do_make_task_chain().
Referenced by AsyncTask::set_task_chain().
void ReferenceCount::local_object | ( | ) | [inline, inherited] |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
This allows the object to be passed to functions that will increment and decrement the object's reference count temporarily, and it will prevent the object from being deleted (inappropriately), when the reference count returns to zero. It actually achieves this by setting a large positive value in the reference count field.
Definition at line 276 of file referenceCount.I.
Referenced by PGTop::cull_callback(), BoundingSphere::extend_by_hexahedron(), AsyncTaskManager::find_task(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().
AsyncTaskCollection AsyncTaskCollection::operator+ | ( | const AsyncTaskCollection & | other | ) | const [inline, inherited] |
Returns a AsyncTaskCollection representing the concatenation of the two lists.
Definition at line 42 of file asyncTaskCollection.I.
void AsyncTaskCollection::operator+= | ( | const AsyncTaskCollection & | other | ) | [inline, inherited] |
Appends the other list onto the end of this one.
Definition at line 31 of file asyncTaskCollection.I.
References AsyncTaskCollection::add_tasks_from().
AsyncTask * AsyncTaskCollection::operator[] | ( | int | index | ) | const [inherited] |
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.
void AsyncTask::output | ( | ostream & | out | ) | const [virtual, inherited] |
Outputs the Namable.
This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.
Reimplemented from Namable.
Definition at line 409 of file asyncTask.cxx.
References Namable::has_name().
void AsyncTaskCollection::output | ( | ostream & | out | ) | const [inherited] |
Writes a brief one-line description of the AsyncTaskCollection to the indicated output stream.
Definition at line 292 of file asyncTaskCollection.cxx.
References AsyncTaskCollection::get_num_tasks().
void AsyncTask::recalc_wake_time | ( | ) | [inherited] |
If the task is currently sleeping on a task chain, this resets its wake time to the current time + get_delay().
It is as if the task had suddenly returned DS_again. The task will sleep for its current delay seconds before running again. This method may therefore be used to make the task wake up sooner or later than it would have otherwise.
If the task is not already sleeping, this method has no effect.
Definition at line 135 of file asyncTask.cxx.
void AsyncTaskBase::record_task | ( | Thread * | current_thread | ) | [protected, inherited] |
Indicates that this task is now the current task running on the indicated thread, presumably the current thread.
Definition at line 47 of file asyncTaskBase.cxx.
Referenced by AsyncTask::unlock_and_do_task().
void ReferenceCount::ref | ( | ) | const [inline, inherited] |
Explicitly increments the reference count.
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
Definition at line 179 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_ref(), TypedWritable::decode_raw_from_bam_stream(), NodeCachedReferenceCount::node_ref(), NodeReferenceCount::node_ref(), BamCacheRecord::set_data(), CullableObject::set_draw_callback(), and ModelRoot::set_reference().
void AsyncTask::remove | ( | ) | [inherited] |
Removes the task from its active manager, if any, and makes the state S_inactive (or possible S_servicing_removed).
This is a no-op if the state is already S_inactive.
Definition at line 87 of file asyncTask.cxx.
References AsyncTaskManager::remove().
void AsyncTaskCollection::remove_duplicate_tasks | ( | ) | [inherited] |
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 AsyncTaskCollection::get_num_tasks(), and AsyncTaskCollection::get_task().
bool AsyncTaskCollection::remove_task | ( | AsyncTask * | task | ) | [inherited] |
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.
void AsyncTaskCollection::remove_task | ( | int | index | ) | [inherited] |
Removes the nth AsyncTask from the collection.
Definition at line 244 of file asyncTaskCollection.cxx.
void AsyncTaskCollection::remove_tasks_from | ( | const AsyncTaskCollection & | other | ) | [inherited] |
Removes from this collection all of the AsyncTasks listed in the other collection.
Definition at line 130 of file asyncTaskCollection.cxx.
References AsyncTaskCollection::get_num_tasks(), AsyncTaskCollection::get_task(), and AsyncTaskCollection::has_task().
void AsyncTask::set_delay | ( | double | delay | ) | [inline, inherited] |
Specifies the amount of time, in seconds, by which this task will be delayed after it has been added to the AsyncTaskManager.
At least the specified amount of time (and possibly more) will elapse before the task begins.
You may specify a delay of 0.0 to guarantee that the task will run in the next epoch following the one in which it is added.
Setting this value after the task has already been added will not affect the task's wake time; it will only affect the task if it is re-added to the queue in the future, for instance if the task returns DS_again. However, see recalc_wake_time() if you wish to apply the delay effect immediately.
Definition at line 86 of file asyncTask.I.
void AsyncTask::set_done_event | ( | const string & | done_event | ) | [inline, inherited] |
Sets the event name that will be triggered when the task finishes.
This should only be called before the task has been started, or after it has finished and before it is about to be restarted (i.e. when get_state() returns S_inactive).
Definition at line 223 of file asyncTask.I.
void AsyncTask::set_priority | ( | int | priority | ) | [inherited] |
Specifies a priority value for this task.
In general, tasks with a higher priority value are executed before tasks with a lower priority value (but only for tasks with the same sort value).
Unlike the sort value, tasks with different priorities may execute at the same time, if the AsyncTaskManager has more than one thread servicing tasks.
Also see AsyncTaskChain::set_timeslice_priority(), which changes the meaning of this value. In the default mode, when the timeslice_priority flag is false, all tasks always run once per epoch, regardless of their priority values (that is, the priority controls the order of the task execution only, not the number of times it runs). On the other hand, if you set the timeslice_priority flag to true, then changing a task's priority has an effect on the number of times it runs.
Definition at line 376 of file asyncTask.cxx.
References AsyncTaskChain::do_add(), AsyncTaskManager::do_find_task_chain(), and AsyncTaskChain::do_remove().
Referenced by GraphicsStateGuardian::async_reload_texture().
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 AsyncTask::set_sort | ( | int | sort | ) | [inherited] |
Specifies a sort value for this task.
Within a given AsyncTaskManager, all of the tasks with a given sort value are guaranteed to be completed before any tasks with a higher sort value are begun.
To put it another way, two tasks might execute in parallel with each other only if they both have the same sort value. Tasks with a lower sort value are executed first.
This is different from the priority, which makes no such exclusion guarantees.
Definition at line 324 of file asyncTask.cxx.
References AsyncTaskChain::do_add(), AsyncTaskManager::do_find_task_chain(), and AsyncTaskChain::do_remove().
void AsyncTask::set_task_chain | ( | const string & | chain_name | ) | [inherited] |
Specifies the AsyncTaskChain on which this task will be running.
Each task chain runs tasks independently of the others.
Definition at line 277 of file asyncTask.cxx.
References AsyncTaskChain::do_remove(), and AsyncTask::jump_to_task_chain().
Referenced by Loader::load_async().
int AsyncTaskCollection::size | ( | ) | const [inherited] |
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.
bool ReferenceCount::test_ref_count_integrity | ( | ) | const [inline, inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
Definition at line 236 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by EggGroupNode::add_child(), InternalName::find_ancestor(), InternalName::get_ancestor(), ReferenceCount::get_ref_count(), InternalName::get_top(), ReferenceCount::ref(), EggVertex::test_gref_integrity(), EggVertex::test_pref_integrity(), EggNode::test_under_integrity(), EggPrimitive::test_vref_integrity(), EggGroup::test_vref_integrity(), MouseWatcher::throw_event_pattern(), ReferenceCount::unref(), and EggNode::update_under().
bool ReferenceCount::test_ref_count_nonzero | ( | ) | const [inline, inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
Definition at line 252 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_nonzero().
Referenced by CopyOnWritePointer::test_ref_count_nonzero().
AsyncTask::DoneStatus AsyncTask::unlock_and_do_task | ( | ) | [protected, inherited] |
Called by the AsyncTaskManager to actually run the task.
Assumes the lock is held. See do_task().
Definition at line 442 of file asyncTask.cxx.
References MutexDirect::acquire(), AsyncTaskBase::clear_task(), AsyncTask::do_task(), AsyncTaskManager::get_clock(), Thread::get_current_thread(), AsyncTaskBase::record_task(), and MutexDirect::release().
bool ReferenceCount::unref | ( | ) | const [inline, virtual, inherited] |
Explicitly decrements the reference count.
Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is true if the new reference count is nonzero, false if it is zero.
Reimplemented in GeomVertexArrayFormat, GeomVertexFormat, InternalName, RenderAttrib, RenderEffects, RenderState, and TransformState.
Definition at line 214 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_unref(), TypedWritable::decode_raw_from_bam_stream(), RenderEffect::finalize(), NodeCachedReferenceCount::node_unref(), NodeReferenceCount::node_unref(), TransformState::unref(), RenderState::unref(), RenderEffects::unref(), RenderAttrib::unref(), InternalName::unref(), GeomVertexFormat::unref(), and GeomVertexArrayFormat::unref().
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.
void ReferenceCount::weak_ref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Adds the indicated PointerToVoid as a weak reference to this object.
Definition at line 321 of file referenceCount.I.
References WeakReferenceList::add_reference(), and ReferenceCount::get_weak_list().
void ReferenceCount::weak_unref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Removes the indicated PointerToVoid as a weak reference to this object.
It must have previously been added via a call to weak_ref().
Definition at line 334 of file referenceCount.I.
References WeakReferenceList::clear_reference(), and ReferenceCount::has_weak_list().
void AsyncTaskCollection::write | ( | ostream & | out, |
int | indent_level = 0 |
||
) | const [inherited] |
Writes a complete multi-line description of the AsyncTaskCollection to the indicated output stream.
Definition at line 307 of file asyncTaskCollection.cxx.
References AsyncTaskCollection::get_num_tasks(), and AsyncTaskCollection::get_task().