15 #include "nodePathComponent.h"
16 #include "lightMutexHolder.h"
20 int NodePathComponent::_next_key = 1;
21 LightMutex NodePathComponent::_key_lock(
"NodePathComponent::_key_lock");
23 TypeHandle NodePathComponent::CData::_type_handle;
33 return new CData(*
this);
45 int pipeline_stage,
Thread *current_thread) :
49 #ifdef DO_MEMORY_USAGE
50 MemoryUsage::update_type(
this, get_class_type());
53 for (
int pipeline_stage_i = pipeline_stage;
54 pipeline_stage_i >= 0;
56 CDStageWriter cdata(_cycler, pipeline_stage_i, current_thread);
60 cdata->_length = next->
get_length(pipeline_stage_i, current_thread) + 1;
106 CDStageReader cdata(_cycler, pipeline_stage, current_thread);
107 return cdata->_length;
117 CDStageReader cdata(_cycler, pipeline_stage, current_thread);
135 int length_should_be = 1;
137 length_should_be = cdata->_next->get_length(pipeline_stage, current_thread) + 1;
140 if (cdata->_length == length_should_be) {
145 cdataw->_length = length_should_be;
182 out << node->get_name();
184 out <<
"-" << node->get_type();
194 void NodePathComponent::
197 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
207 void NodePathComponent::
208 set_top_node(
int pipeline_stage,
Thread *current_thread) {
209 CDStageWriter cdata(_cycler, pipeline_stage, current_thread);
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.
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.
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
bool is_top_node(int pipeline_stage, Thread *current_thread) const
Returns true if this component represents the top node in the path.
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...
PandaNode * get_node() const
Returns the node referenced by this component.
Similar to MutexHolder, but for a light mutex.
This class is similar to CycleDataLockedReader, except it allows reading from a particular stage of t...
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
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...
A thread; that is, a lightweight process.
void output(ostream &out) const
The recursive implementation of NodePath::output(), this writes the names of each node component in o...
TypeHandle is the identifier used to differentiate C++ class types.
This is a standard, non-reentrant mutex, similar to the Mutex class.
NodePathComponent * get_next(int pipeline_stage, Thread *current_thread) const
Returns the next component in the path.
int get_pipeline_stage() const
Returns the Pipeline stage number associated with this thread.
This is one component of a NodePath.