19 int NodePathComponent::_next_key = 1;
20 LightMutex NodePathComponent::_key_lock(
"NodePathComponent::_key_lock");
22 TypeHandle NodePathComponent::CData::_type_handle;
30 return new CData(*
this);
39 int pipeline_stage,
Thread *current_thread) :
43 #ifdef DO_MEMORY_USAGE 47 for (
int pipeline_stage_i = pipeline_stage;
48 pipeline_stage_i >= 0;
50 CDStageWriter cdata(_cycler, pipeline_stage_i, current_thread);
53 if (next !=
nullptr) {
54 cdata->_length = next->
get_length(pipeline_stage_i, current_thread) + 1;
83 return (cdata->_next ==
nullptr);
92 return cdata->_length;
104 int length_should_be = 1;
105 if (cdata->_next !=
nullptr) {
106 length_should_be = cdata->_next->get_length(pipeline_stage, current_thread) + 1;
109 if (cdata->_length == length_should_be) {
114 cdataw->_length = length_should_be;
125 Thread *current_thread = Thread::get_current_thread();
130 if (next !=
nullptr) {
148 out << node->get_name();
150 out <<
"-" << node->get_type();
158 void NodePathComponent::
160 nassertv(next !=
nullptr);
161 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
169 void NodePathComponent::
170 set_top_node(
int pipeline_stage,
Thread *current_thread) {
171 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
172 cdata->_next =
nullptr;
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...
A basic node of the scene graph or data graph.
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).
This class is similar to CycleDataWriter, except it allows writing to a particular stage of the pipel...
A single page of data maintained by a PipelineCycler.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PandaNode * get_node() const
Returns the node referenced by this component.
get_pipeline_stage
Returns the Pipeline stage number associated with this thread.
bool is_top_node(int pipeline_stage, Thread *current_thread) const
Returns true if this component represents the top node in the path.
Similar to MutexHolder, but for a light mutex.
void output(std::ostream &out) const
The recursive implementation of NodePath::output(), this writes the names of each node component in o...
NodePathComponent * get_next(int pipeline_stage, Thread *current_thread) const
Returns the next component in the path.
int find_parent(PandaNode *node, Thread *current_thread=Thread::get_current_thread()) const
Returns the index of the indicated parent node, if it is a parent, or -1 if it is not...
This class is similar to CycleDataLockedReader, except it allows reading from a particular stage of t...
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
A thread; that is, a lightweight process.
int get_length(int pipeline_stage, Thread *current_thread) const
Returns the length of the path to this node.
bool has_name() const
Returns true if the Namable has a nonempty name set, false if the name is empty.
TypeHandle is the identifier used to differentiate C++ class types.
int find_stashed(PandaNode *node, Thread *current_thread=Thread::get_current_thread()) const
Returns the index of the indicated stashed node, if it is a stashed child, or -1 if it is not...
This is a standard, non-reentrant mutex, similar to the Mutex class.
This is one component of a NodePath.