|
|
|
A base class for all things that want to be reference-counted.
More...
#include "referenceCount.h"
List of all members.
Detailed Description
A base class for all things that want to be reference-counted.
ReferenceCount works in conjunction with PointerTo to automatically delete objects when the last pointer to them goes away.
Definition at line 41 of file referenceCount.h.
Constructor & Destructor Documentation
| ReferenceCount::ReferenceCount |
( |
| ) |
[inline, protected] |
The ReferenceCount constructor is protected because you almost never want to create just a ReferenceCount object by itself, and it's probably a mistake if you try.
ReferenceCount doesn't store any useful information in its own right; its only purpose is to add reference-counting to some other class via inheritance.
Definition at line 35 of file referenceCount.I.
| ReferenceCount::ReferenceCount |
( |
const ReferenceCount & |
| ) |
[inline, protected] |
The copies of reference-counted objects do not themselves inherit the reference count!
This copy constructor is protected because you almost never want to create just a ReferenceCount object by itself, and it's probably a mistake if you try.
Definition at line 54 of file referenceCount.I.
Member Function Documentation
| bool ReferenceCount::do_test_ref_count_integrity |
( |
| ) |
const [protected] |
| bool ReferenceCount::do_test_ref_count_nonzero |
( |
| ) |
const [protected] |
| int ReferenceCount::get_ref_count |
( |
| ) |
const [inline] |
Returns the current reference count.
Definition at line 155 of file referenceCount.I.
References 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().
| bool ReferenceCount::has_weak_list |
( |
| ) |
const [inline] |
| void ReferenceCount::local_object |
( |
| ) |
[inline] |
| void ReferenceCount::operator= |
( |
const ReferenceCount & |
| ) |
[inline, protected] |
The copies of reference-counted objects do not themselves inherit the reference count!
This copy assignment operator is protected because you almost never want to copy just a ReferenceCount object by itself, and it's probably a mistake if you try. Instead, this should only be called from a derived class that implements this operator and then calls up the inheritance chain.
Definition at line 76 of file referenceCount.I.
| void ReferenceCount::ref |
( |
| ) |
const [inline] |
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 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().
| bool ReferenceCount::test_ref_count_integrity |
( |
| ) |
const [inline] |
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 do_test_ref_count_integrity().
Referenced by EggGroupNode::add_child(), InternalName::find_ancestor(), InternalName::get_ancestor(), get_ref_count(), InternalName::get_top(), 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(), unref(), and EggNode::update_under().
| bool ReferenceCount::test_ref_count_nonzero |
( |
| ) |
const [inline] |
| bool ReferenceCount::unref |
( |
| ) |
const [inline, virtual] |
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 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().
The documentation for this class was generated from the following files:
| | |