Panda3D
nodePathComponent.I
1 // Filename: nodePathComponent.I
2 // Created by: drose (25Feb02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: NodePathComponent::CData::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE NodePathComponent::CData::
22 CData() {
23  _length = 1;
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: NodePathComponent::CData::Copy Constructor
28 // Access: Public
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 INLINE NodePathComponent::CData::
32 CData(const NodePathComponent::CData &copy) :
33  _next(copy._next),
34  _length(copy._length)
35 {
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: NodePathComponent::Copy Constructor
40 // Access: Private
41 // Description: NodePathComponents should not be copied.
42 ////////////////////////////////////////////////////////////////////
43 INLINE NodePathComponent::
44 NodePathComponent(const NodePathComponent &copy) {
45  nassertv(false);
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: NodePathComponent::Copy Assignment Operator
50 // Access: Private
51 // Description: NodePathComponents should not be copied.
52 ////////////////////////////////////////////////////////////////////
53 INLINE void NodePathComponent::
54 operator = (const NodePathComponent &copy) {
55  nassertv(false);
56 }
57 
58 
59 ////////////////////////////////////////////////////////////////////
60 // Function: NodePathComponent::Destructor
61 // Access: Public
62 // Description:
63 ////////////////////////////////////////////////////////////////////
64 INLINE NodePathComponent::
65 ~NodePathComponent() {
66  nassertv(_node != (PandaNode *)NULL);
67  _node->delete_component(this);
68 }
69 
70 ////////////////////////////////////////////////////////////////////
71 // Function: NodePathComponent::get_node
72 // Access: Public
73 // Description: Returns the node referenced by this component.
74 ////////////////////////////////////////////////////////////////////
76 get_node() const {
77  nassertr(_node != (PandaNode *)NULL, _node);
78  return _node;
79 }
80 
81 ////////////////////////////////////////////////////////////////////
82 // Function: NodePathComponent::has_key
83 // Access: Public
84 // Description: Returns true if the key for this component has
85 // already been generated, false otherwise. Even if
86 // this returns false, calling get_key() will still
87 // return a valid key; that will simply cause the key to
88 // be generated on-the-fly.
89 ////////////////////////////////////////////////////////////////////
90 INLINE bool NodePathComponent::
91 has_key() const {
92  return (_key != 0);
93 }
94 
95 INLINE ostream &operator << (ostream &out, const NodePathComponent &comp) {
96  comp.output(out);
97  return out;
98 }
99 
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
PandaNode * get_node() const
Returns the node referenced by this component.
void output(ostream &out) const
The recursive implementation of NodePath::output(), this writes the names of each node component in o...
bool has_key() const
Returns true if the key for this component has already been generated, false otherwise.
This is one component of a NodePath.