Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

NodePathComponent Class Reference

This is one component of a NodePath. More...

#include <nodePathComponent.h>

Inheritance diagram for NodePathComponent:

ReferenceCount List of all members.

Public Member Functions

 ~NodePathComponent ()
PandaNodeget_node () const
 Returns the node referenced by this component.

int get_key () const
 Returns an index number that is guaranteed to be unique for this particular NodePathComponent, and not to be reused for the lifetime of the application (barring integer overflow).

bool is_top_node () const
 Returns true if this component represents the top node in the path.

bool is_collapsed () const
 Returns true if this component has been collapsed with another component.

NodePathComponent * get_next () const
 Returns the next component in the path.

int get_length () const
 Returns the length of the path to this node.

NodePathComponent * get_collapsed () const
 If is_collapsed() returns true, this is the component that this one has been collapsed with, and should be replaced with.

bool fix_length ()
 Checks that the length indicated by the component is one more than the length of its predecessor.

NodePathComponent * uncollapse ()
 Returns this component pointer if the component is not collapsed; or if it has been collapsed, returns the pointer it has been collapsed into.

void output (ostream &out) const
 The recursive implementation of NodePath::output(), this writes the names of each node component in order from beginning to end, by first walking to the end of the linked list and then outputting from there.

int get_ref_count () const
 Returns the current reference count.

int ref () const
 Explicitly increments the reference count.

int unref () const
 Explicitly decrements the reference count.

void test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.


Static Public Member Functions

TypeHandle get_class_type ()
void init_type ()

Private Types

typedef CycleDataReader< CDataCDReader
typedef CycleDataWriter< CDataCDWriter

Private Member Functions

 NodePathComponent (PandaNode *node, NodePathComponent *next=NULL)
 Constructs a new NodePathComponent from the indicated node.

 NodePathComponent (const NodePathComponent &copy)
 NodePathComponents should not be copied.

void operator= (const NodePathComponent &copy)
 NodePathComponents should not be copied.

void set_next (NodePathComponent *next)
 Sets the next pointer in the path.

void set_top_node ()
 Severs any connection to the next pointer in the path and makes this component a top node.

void collapse_with (NodePathComponent *next)
 Indicates that this component pointer is no longer valid, and that the indicated component should be used instead.


Private Attributes

PointerTo< PandaNode_node
int _key
PipelineCycler< CData_cycler

Static Private Attributes

int _next_key = 1
TypeHandle _type_handle

Friends

class PandaNode

Detailed Description

This is one component of a NodePath.

These are stored on each PandaNode, as many as one for each of the possible instances of the node (but they only exist when they are requested, to minimize memory waste). A NodePath represents a singly-linked list of these from an arbitrary component in the graph to the root.

This whole NodePath system is used to disambiguate instances in the scene graph, and the NodePathComponents are stored in the nodes themselves to allow the nodes to keep these up to date as the scene graph is manipulated.

Definition at line 65 of file nodePathComponent.h.


Member Typedef Documentation

typedef CycleDataReader<CData> NodePathComponent::CDReader [private]
 

Definition at line 112 of file nodePathComponent.h.

typedef CycleDataWriter<CData> NodePathComponent::CDWriter [private]
 

Definition at line 113 of file nodePathComponent.h.


Constructor & Destructor Documentation

NodePathComponent::NodePathComponent PandaNode node,
NodePathComponent *  next = NULL
[inline, private]
 

Constructs a new NodePathComponent from the indicated node.

Don't try to call this directly; ask the PandaNode to do it for you.

Definition at line 62 of file nodePathComponent.I.

NodePathComponent::NodePathComponent const NodePathComponent &  copy  )  [inline, private]
 

NodePathComponents should not be copied.

Definition at line 86 of file nodePathComponent.I.

References _node, INLINE, nassertv, and NULL.

NodePathComponent::~NodePathComponent  )  [inline]
 

Definition at line 112 of file nodePathComponent.I.

References _cycler, and INLINE.


Member Function Documentation

void NodePathComponent::collapse_with NodePathComponent *  next  )  [private]
 

Indicates that this component pointer is no longer valid, and that the indicated component should be used instead.

This is done whenever two NodePathComponents have been collapsed together due to an instance being removed higher up in the graph.

Definition at line 301 of file nodePathComponent.cxx.

bool NodePathComponent::fix_length  ) 
 

Checks that the length indicated by the component is one more than the length of its predecessor.

If this is broken, fixes it and returns true indicating the component has been changed; otherwise, returns false.

Definition at line 155 of file nodePathComponent.cxx.

References get_collapsed(), and is_collapsed().

TypeHandle NodePathComponent::get_class_type void   )  [inline, static]
 

Reimplemented from ReferenceCount.

Definition at line 118 of file nodePathComponent.h.

Referenced by NodePathComponent::CData::CData().

NodePathComponent * NodePathComponent::get_collapsed  )  const [inline]
 

If is_collapsed() returns true, this is the component that this one has been collapsed with, and should be replaced with.

Definition at line 167 of file nodePathComponent.I.

Referenced by fix_length(), is_top_node(), NodePathComponent::CData::make_copy(), and output().

int NodePathComponent::get_key  )  const
 

Returns an index number that is guaranteed to be unique for this particular NodePathComponent, and not to be reused for the lifetime of the application (barring integer overflow).

Definition at line 58 of file nodePathComponent.cxx.

Referenced by NodePathComponent::CData::make_copy().

int NodePathComponent::get_length void   )  const
 

Returns the length of the path to this node.

Definition at line 101 of file nodePathComponent.cxx.

References NULL.

Referenced by NodePath::do_billboard_axis(), get_next(), and is_top_node().

NodePathComponent * NodePathComponent::get_next  )  const
 

Returns the next component in the path.

Definition at line 118 of file nodePathComponent.cxx.

References _cycler, get_length(), and is_top_node().

Referenced by NodePath::clear_two_sided(), NodePath::do_billboard_axis(), NodePath::do_billboard_point_eye(), and NodePath::do_billboard_point_world().

PandaNode * NodePathComponent::get_node  )  const [inline]
 

Returns the node referenced by this component.

Definition at line 126 of file nodePathComponent.I.

References _cycler, INLINE, is_collapsed(), nassertr, and NULL.

Referenced by NodePath::clear_two_sided(), NodePath::do_billboard_point_eye(), NodePath::do_billboard_point_world(), and PandaNode::is_geom_node().

int ReferenceCount::get_ref_count  )  const [inline, inherited]
 

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture().

void NodePathComponent::init_type void   )  [inline, static]
 

Reimplemented from ReferenceCount.

Definition at line 121 of file nodePathComponent.h.

bool NodePathComponent::is_collapsed  )  const [inline]
 

Returns true if this component has been collapsed with another component.

In this case, the component itself is invalid, and the collapsed component should be used instead.

Definition at line 149 of file nodePathComponent.I.

Referenced by fix_length(), get_node(), NodePathComponent::CData::make_copy(), and output().

bool NodePathComponent::is_top_node  )  const
 

Returns true if this component represents the top node in the path.

Definition at line 84 of file nodePathComponent.cxx.

References get_collapsed(), and get_length().

Referenced by get_next(), and PandaNode::is_geom_node().

void NodePathComponent::operator= const NodePathComponent &  copy  )  [inline, private]
 

NodePathComponents should not be copied.

Definition at line 99 of file nodePathComponent.I.

References _node, INLINE, nassertr, and NULL.

void NodePathComponent::output ostream &  out  )  const
 

The recursive implementation of NodePath::output(), this writes the names of each node component in order from beginning to end, by first walking to the end of the linked list and then outputting from there.

Definition at line 217 of file nodePathComponent.cxx.

References _cycler, get_collapsed(), is_collapsed(), NULL, and set_top_node().

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

The return value is the new reference count.

Definition at line 225 of file referenceCount.I.

Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering().

void NodePathComponent::set_next NodePathComponent *  next  )  [private]
 

Sets the next pointer in the path.

Definition at line 254 of file nodePathComponent.cxx.

References _key.

Referenced by PandaNode::is_geom_node().

void NodePathComponent::set_top_node  )  [private]
 

Severs any connection to the next pointer in the path and makes this component a top node.

Definition at line 275 of file nodePathComponent.cxx.

Referenced by output().

void ReferenceCount::test_ref_count_integrity  )  const [inline, inherited]
 

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

Definition at line 328 of file referenceCount.I.

References INLINE.

Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount().

NodePathComponent * NodePathComponent::uncollapse  ) 
 

Returns this component pointer if the component is not collapsed; or if it has been collapsed, returns the pointer it has been collapsed into.

Collapsing can happen at any time to any component in the path and we have to deal with it. It happens when a node is removed further up the path that results in two instances becoming the same thing.

Definition at line 192 of file nodePathComponent.cxx.

References Namable::get_name().

int ReferenceCount::unref  )  const [inline, 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; plus, we don't have a virtual destructor anyway.) 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 the new reference count.

Definition at line 293 of file referenceCount.I.

References INLINE.

Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds().


Friends And Related Function Documentation

friend class PandaNode [friend]
 

Definition at line 129 of file nodePathComponent.h.


Member Data Documentation

PipelineCycler<CData> NodePathComponent::_cycler [private]
 

Definition at line 111 of file nodePathComponent.h.

Referenced by get_next(), get_node(), output(), and ~NodePathComponent().

int NodePathComponent::_key [private]
 

Definition at line 98 of file nodePathComponent.h.

Referenced by NodePathComponent::CData::CData(), and set_next().

int NodePathComponent::_next_key = 1 [static, private]
 

Definition at line 27 of file nodePathComponent.cxx.

PointerTo< PandaNode > NodePathComponent::_node [private]
 

Definition at line 97 of file nodePathComponent.h.

Referenced by NodePathComponent::CData::CData(), NodePathComponent(), and operator=().

TypeHandle NodePathComponent::_type_handle [static, private]
 

Reimplemented from ReferenceCount.

Definition at line 28 of file nodePathComponent.cxx.


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:52:37 2003 for Panda by doxygen1.3