Panda3D
|
This class object manages a single asynchronous request to animate vertices on a GeomVertexData object. More...
#include "animateVerticesRequest.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 | |
AnimateVerticesRequest (GeomVertexData *geom_vertex_data) | |
Create a new AnimateVerticesRequest. | |
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_delay () |
Removes any delay specified for the task. | |
void | clear_name () |
Resets the task's name to empty. | |
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 |
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_priority () const |
Returns the task's current priority value. | |
int | get_ref_count () const |
Returns the current reference count. | |
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. | |
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_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. | |
bool | is_ready () const |
Returns true if this request has completed, false if it is still pending. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, void *) |
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 * | 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) |
void * | operator new[] (size_t size, void *ptr) |
virtual void | output (ostream &out) const |
Outputs the Namable. | |
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 | 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_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. | |
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. | |
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 AsyncTask::DoneStatus | do_task () |
Performs the task: that is, calls animate vertices on _geom_vertex_data. | |
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 |
This class object manages a single asynchronous request to animate vertices on a GeomVertexData object.
animate_vertices will be called with force=true (i.e. blocking) in a sub-thread (if threading is available). No result is stored or returned from this object. It is expected that the result will be cached and available for immediate use later during rendering. Thus it is important that the main thread block while these requests are being run (presumably on multiple CPUs/cores), to ensure that the data has been computed by the time it's needed.
Definition at line 39 of file animateVerticesRequest.h.
AnimateVerticesRequest::AnimateVerticesRequest | ( | GeomVertexData * | geom_vertex_data | ) | [inline] |
Create a new AnimateVerticesRequest.
Definition at line 22 of file animateVerticesRequest.I.
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 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 AnimateVerticesRequest::do_task | ( | ) | [protected, virtual] |
Performs the task: that is, calls animate vertices on _geom_vertex_data.
Reimplemented from AsyncTask.
Definition at line 27 of file animateVerticesRequest.cxx.
References Thread::get_current_thread().
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().
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().
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 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 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.
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 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 AnimateVerticesRequest::is_ready | ( | ) | const [inline] |
Returns true if this request has completed, false if it is still pending.
Definition at line 35 of file animateVerticesRequest.I.
bool AsyncTask::is_runnable | ( | ) | [protected, virtual, inherited] |
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 in AsyncTaskSequence, and GenericAsyncTask.
Definition at line 484 of file asyncTask.cxx.
Referenced by AsyncTaskManager::add().
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().
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 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 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 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().
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 AsyncTask::upon_birth | ( | AsyncTaskManager * | manager | ) | [protected, virtual, inherited] |
Override this function to do something useful when the task has been added to the active queue.
This function is called with the lock *not* held.
Reimplemented in AsyncTaskSequence, and GenericAsyncTask.
Definition at line 541 of file asyncTask.cxx.
Referenced by AsyncTaskManager::add().
void AsyncTask::upon_death | ( | AsyncTaskManager * | manager, |
bool | clean_exit | ||
) | [protected, virtual, inherited] |
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 *not* held.
Reimplemented in AsyncTaskSequence, and GenericAsyncTask.
Definition at line 568 of file asyncTask.cxx.
Referenced by AsyncTaskChain::cleanup_task().
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().