Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# ReferenceCount Class Reference

A base class for all things that want to be reference-counted. More...

Inheritance diagram for ReferenceCount:

List of all members.

## Public Member Functions
int | getRefCount ()
| Returns the current reference count.
| ref ()
| Explicitly increments the reference count.
bool | testRefCountIntegrity ()
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | testRefCountNonzero ()
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
bool | unref ()
| Explicitly decrements the reference count.
## Static Public Member Functions
static TypeHandle | getClassType ()

## 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.

## Member Function Documentation

static TypeHandle getClassType | ( |  | ) | `[static]`

Reimplemented in NodeReferenceCount, TypedReferenceCount, FileReference, VirtualFile, VirtualFileComposite, VirtualFileMount, VirtualFileMountMultifile, VirtualFileMountRamdisk, VirtualFileMountSystem, VirtualFileSimple, TemporaryFile, HTTPChannel, VirtualFileHTTP, VirtualFileMountHTTP, VrpnClient, ClientBase, PGItem, PandaNode, PGButton, PGTop, PGEntry, PGMouseWatcherParameter, TypedWritableReferenceCount, PGMouseWatcherBackground, MouseWatcherRegion, PGVirtualFrame, PGSliderBar, PGScrollFrame, PGWaitBar, FilterProperties, AudioSound, AudioManager, BamCacheRecord, CallbackObject, CachedTypedWritableReferenceCount, ClockObject, CopyOnWriteObject, NodeCachedReferenceCount, PythonCallbackObject, ButtonThrower, DataNode, MouseInterfaceNode, DriveInterface, MouseSubregion, MouseWatcherGroup, MouseWatcher, Trackball, Transform2SG, TextFont, DynamicTextPage, Texture, DynamicTextFont, GeomTextGlyph, Geom, StaticTextFont, TextNode, ParametricCurve, CubicCurveseg, PiecewiseCurve, HermiteCurve, NurbsCurve, RopeNode, SheetNode, BoundingVolume, GeometricBoundingVolume, FiniteBoundingVolume, BoundingBox, BoundingHexahedron, BoundingLine, BoundingPlane, BoundingSphere, IntersectionBoundingVolume, OmniBoundingVolume, UnionBoundingVolume, DisplayRegionBase, GraphicsOutputBase, GraphicsStateGuardianBase, InternalName, GeomVertexArrayFormat, GeomVertexFormat, GeomVertexArrayData, GeomVertexArrayDataHandle, VertexTransform, TransformTable, TransformBlendTable, VertexSlider, SliderTable, GeomVertexData, AnimateVerticesRequest, AsyncTask, GeomPrimitive, TextureStage, GeomLines, GeomLinestrips, GeomPoints, GeomTriangles, GeomTrifans, GeomTristrips, Shader, Lens, Material, MatrixLens, OrthographicLens, PerspectiveLens, TextureReloadRequest, UserVertexSlider, UserVertexTransform, VideoTexture, AsyncTaskBase, AsyncTaskChain, AsyncTaskManager, AsyncTaskPause, AsyncTaskSequence, EventStoreValueBase, EventStoreTypedRefCount, Event, PointerEventList, PythonTask, Thread, ExternalThread, MainThread, PythonThread, GraphicsDevice, GraphicsPipe, WindowHandle.OSHandle, WindowHandle, OSHandle, DisplayRegion, StereoDisplayRegion, GraphicsStateGuardian, GraphicsOutput, GraphicsWindow, CallbackGraphicsWindow, GraphicsBuffer, NativeWindowHandle, ParasiteBuffer, AnalogNode, ButtonNode, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, CollisionSolid, CollisionBox, CollisionHandler, CollisionNode, CollisionEntry, CollisionPlane, CollisionFloorMesh, CollisionPolygon, CollisionHandlerEvent, CollisionHandlerPhysical, CollisionHandlerFloor, CollisionHandlerPusher, CollisionHandlerFluidPusher, CollisionHandlerGravity, CollisionHandlerHighestEvent, CollisionHandlerQueue, CollisionSphere, CollisionInvSphere, CollisionRay, CollisionLine, CollisionParabola, CollisionSegment, CollisionTube, CollisionVisualizer, CharacterJoint, MovingPartMatrix, CharacterSlider, MovingPartScalar, CharacterVertexSlider, JointVertexTransform, Character, PartBundleNode, CharacterJointBundle, PartBundle, CharacterJointEffect, RenderEffect, AnimGroup, AnimBundle, AnimBundleNode, PartGroup, AnimControl, AnimChannelBase, AnimChannelMatrix, AnimChannelScalar, AnimChannelMatrixDynamic, AnimChannelMatrixXfmTable, AnimChannelScalarDynamic, AnimChannelScalarTable, AnimPreloadTable, BindAnimRequest, ModelLoadRequest, MovingPartBase, MovingPartACMatrixSwitchType, MovingPartACScalarSwitchType, FrameRateMeter, MovieTexture, NodeVertexTransform, SceneGraphAnalyzerMeter, RigidBodyCombiner, PipeOcclusionCullTraverser, CullTraverser, MovieAudio, MovieAudioCursor, FfmpegAudio, FfmpegAudioCursor, MovieVideo, MovieVideoCursor.Buffer, MovieVideoCursor, Buffer, FfmpegVideo, FfmpegVideoCursor, InkblotVideo, InkblotVideoCursor, MicrophoneAudio, UserDataAudio, UserDataAudioCursor, TransformState, RenderAttrib, RenderModeAttrib, TexMatrixAttrib, RenderState, AlphaTestAttrib, AntialiasAttrib, RenderEffects, TransparencyAttrib, AudioVolumeAttrib, AuxBitplaneAttrib, AuxSceneData, BillboardEffect, LensNode, Camera, PlaneNode, ClipPlaneAttrib, ColorAttrib, ColorBlendAttrib, ColorScaleAttrib, ColorWriteAttrib, CompassEffect, CullBinAttrib, CullFaceAttrib, GeomNode, SceneSetup, CullResult, DecalEffect, DepthOffsetAttrib, DepthTestAttrib, DepthWriteAttrib, EventStorePandaNode, Fog, FogAttrib, Light, LightAttrib, LightRampAttrib, PandaLoader, MaterialAttrib, ModelFlattenRequest, ModelNode, ModelRoot, TextureAttrib, TexGenAttrib, OccluderNode, OccluderEffect, PolylightNode, PolylightEffect, ShaderInput, ShaderAttrib, ShowBoundsEffect, TexProjectorEffect, ScissorEffect, PortalNode, RescaleNormalAttrib, ScissorAttrib, ShadeModelAttrib, StencilAttrib, LightNode, AmbientLight, CallbackNode, LightLensNode, DirectionalLight, LODNode, FadeLODNode, PointLight, SelectiveChildNode, SequenceNode, Spotlight, SwitchNode, UvScrollNode, RecorderBase, MouseRecorder, RecorderController, and SocketStreamRecorder.

int getRefCount | ( |  | ) |

Returns the current reference count.

ref | ( |  | ) |

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.

bool testRefCountIntegrity | ( |  | ) |

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.

bool testRefCountNonzero | ( |  | ) |

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

bool unref | ( |  | ) |

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, and GeomVertexFormat.

All Classes Namespaces Functions Variables Enumerations Enumerator Properties