Panda3D
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
NodePathComponent Class Referencefinal

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

#include "nodePathComponent.h"

Inheritance diagram for NodePathComponent:
ReferenceCount MemoryBase

Public Member Functions

 NodePathComponent (const NodePathComponent &copy)=delete
 
bool fix_length (int pipeline_stage, Thread *current_thread)
 Checks that the length indicated by the component is one more than the length of its predecessor. More...
 
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). More...
 
int get_length (int pipeline_stage, Thread *current_thread) const
 Returns the length of the path to this node. More...
 
NodePathComponentget_next (int pipeline_stage, Thread *current_thread) const
 Returns the next component in the path. More...
 
PandaNodeget_node () const
 Returns the node referenced by this component. More...
 
bool has_key () const
 Returns true if the key for this component has already been generated, false otherwise. More...
 
bool is_top_node (int pipeline_stage, Thread *current_thread) const
 Returns true if this component represents the top node in the path. More...
 
NodePathComponentoperator= (const NodePathComponent &copy)=delete
 
void output (std::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. More...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Friends

class NodePath
 
class PandaNode
 

Additional Inherited Members

- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

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 42 of file nodePathComponent.h.

Member Function Documentation

◆ fix_length()

bool NodePathComponent::fix_length ( int  pipeline_stage,
Thread current_thread 
)

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 101 of file nodePathComponent.cxx.

◆ get_key()

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 65 of file nodePathComponent.cxx.

◆ get_length()

int NodePathComponent::get_length ( int  pipeline_stage,
Thread current_thread 
) const

Returns the length of the path to this node.

Definition at line 90 of file nodePathComponent.cxx.

◆ get_next()

NodePathComponent * NodePathComponent::get_next ( int  pipeline_stage,
Thread current_thread 
) const
inline

Returns the next component in the path.

Definition at line 65 of file nodePathComponent.I.

Referenced by NodePath::get_hidden_ancestor(), NodePath::get_stashed_ancestor(), NodePath::get_top(), and output().

◆ get_node()

PandaNode * NodePathComponent::get_node ( ) const
inline

Returns the node referenced by this component.

Definition at line 45 of file nodePathComponent.I.

Referenced by NodePath::get_hidden_ancestor(), NodePath::get_stashed_ancestor(), and output().

◆ has_key()

bool NodePathComponent::has_key ( ) const
inline

Returns true if the key for this component has already been generated, false otherwise.

Even if this returns false, calling get_key() will still return a valid key; that will simply cause the key to be generated on-the- fly.

Definition at line 57 of file nodePathComponent.I.

◆ is_top_node()

bool NodePathComponent::is_top_node ( int  pipeline_stage,
Thread current_thread 
) const

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

Definition at line 81 of file nodePathComponent.cxx.

Referenced by NodePath::get_top().

◆ output()

void NodePathComponent::output ( std::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 124 of file nodePathComponent.cxx.

References PandaNode::find_parent(), PandaNode::find_stashed(), get_next(), get_node(), Thread::get_pipeline_stage, Namable::has_name(), and output().

Referenced by output().


The documentation for this class was generated from the following files: