00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef NODEPATHCOMPONENT_H
00016 #define NODEPATHCOMPONENT_H
00017
00018 #include "pandabase.h"
00019
00020 #include "pandaNode.h"
00021 #include "pointerTo.h"
00022 #include "referenceCount.h"
00023 #include "cycleData.h"
00024 #include "cycleDataReader.h"
00025 #include "cycleDataWriter.h"
00026 #include "cycleDataLockedStageReader.h"
00027 #include "cycleDataStageReader.h"
00028 #include "cycleDataStageWriter.h"
00029 #include "lightMutex.h"
00030 #include "deletedChain.h"
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 class EXPCL_PANDA_PGRAPH NodePathComponent : public ReferenceCount {
00049 private:
00050 NodePathComponent(PandaNode *node, NodePathComponent *next,
00051 int pipeline_stage, Thread *current_thread);
00052 INLINE NodePathComponent(const NodePathComponent ©);
00053 INLINE void operator = (const NodePathComponent ©);
00054
00055 public:
00056 INLINE ~NodePathComponent();
00057 ALLOC_DELETED_CHAIN(NodePathComponent);
00058
00059 INLINE PandaNode *get_node() const;
00060 INLINE bool has_key() const;
00061 int get_key() const;
00062 bool is_top_node(int pipeline_stage, Thread *current_thread) const;
00063
00064 NodePathComponent *get_next(int pipeline_stage, Thread *current_thread) const;
00065 int get_length(int pipeline_stage, Thread *current_thread) const;
00066
00067 bool fix_length(int pipeline_stage, Thread *current_thread);
00068
00069 void output(ostream &out) const;
00070
00071 private:
00072 void set_next(NodePathComponent *next, int pipeline_stage, Thread *current_thread);
00073 void set_top_node(int pipeline_stage, Thread *current_thread);
00074
00075
00076
00077
00078
00079 PT(PandaNode) _node;
00080 int _key;
00081
00082
00083 class EXPCL_PANDA_PGRAPH CData : public CycleData {
00084 public:
00085 INLINE CData();
00086 CData(const CData ©);
00087 ALLOC_DELETED_CHAIN(CData);
00088 virtual CycleData *make_copy() const;
00089 virtual TypeHandle get_parent_type() const {
00090 return NodePathComponent::get_class_type();
00091 }
00092
00093 PT(NodePathComponent) _next;
00094 int _length;
00095
00096 public:
00097 static TypeHandle get_class_type() {
00098 return _type_handle;
00099 }
00100 static void init_type() {
00101 register_type(_type_handle, "NodePathComponent::CData");
00102 }
00103
00104 private:
00105 static TypeHandle _type_handle;
00106 };
00107
00108 PipelineCycler<CData> _cycler;
00109 typedef CycleDataReader<CData> CDReader;
00110 typedef CycleDataWriter<CData> CDWriter;
00111 typedef CycleDataLockedStageReader<CData> CDLockedStageReader;
00112 typedef CycleDataStageReader<CData> CDStageReader;
00113 typedef CycleDataStageWriter<CData> CDStageWriter;
00114
00115 static int _next_key;
00116 static LightMutex _key_lock;
00117
00118 public:
00119 static TypeHandle get_class_type() {
00120 return _type_handle;
00121 }
00122 static void init_type() {
00123 ReferenceCount::init_type();
00124 register_type(_type_handle, "NodePathComponent",
00125 ReferenceCount::get_class_type());
00126 CData::init_type();
00127 }
00128
00129 private:
00130 static TypeHandle _type_handle;
00131 friend class PandaNode;
00132 };
00133
00134 INLINE ostream &operator << (ostream &out, const NodePathComponent &comp);
00135
00136 #include "nodePathComponent.I"
00137
00138 #endif