Panda3D
 All Classes Functions Variables Enumerations
workingNodePath.I
00001 // Filename: workingNodePath.I
00002 // Created by:  drose (16Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: WorkingNodePath::Constructor
00018 //       Access: Public
00019 //  Description: Creates a WorkingNodePath that is the same as the
00020 //               indicated NodePath.  This is generally used to begin
00021 //               the traversal of a scene graph with the root
00022 //               NodePath.
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE WorkingNodePath::
00025 WorkingNodePath(const NodePath &start) {
00026   nassertv(!start.is_empty());
00027   _next = (WorkingNodePath *)NULL;
00028   _start = start._head;
00029   _node = start.node();
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: WorkingNodePath::Copy Constructor
00034 //       Access: Public
00035 //  Description: 
00036 ////////////////////////////////////////////////////////////////////
00037 INLINE WorkingNodePath::
00038 WorkingNodePath(const WorkingNodePath &copy) :
00039   _next(copy._next),
00040   _start(copy._start),
00041   _node(copy._node)
00042 {
00043   nassertv(_next != (WorkingNodePath *)NULL ||
00044            _start != (NodePathComponent *)NULL);
00045 }
00046 
00047 ////////////////////////////////////////////////////////////////////
00048 //     Function: WorkingNodePath::Constructor
00049 //       Access: Public
00050 //  Description: Creates a WorkingNodePath that is the same as the
00051 //               indicated WorkingNodePath, plus one node.  This is
00052 //               generally used to continue the traversal to the next
00053 //               node.
00054 ////////////////////////////////////////////////////////////////////
00055 INLINE WorkingNodePath::
00056 WorkingNodePath(const WorkingNodePath &parent, PandaNode *child) {
00057   _next = &parent;
00058   _start = (NodePathComponent *)NULL;
00059   _node = child;
00060   nassertv(_node != _next->_node);
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: WorkingNodePath::Destructor
00065 //       Access: Public
00066 //  Description: 
00067 ////////////////////////////////////////////////////////////////////
00068 INLINE WorkingNodePath::
00069 ~WorkingNodePath() {
00070 }
00071 
00072 ////////////////////////////////////////////////////////////////////
00073 //     Function: WorkingNodePath::Copy Assignment Operator
00074 //       Access: Public
00075 //  Description: 
00076 ////////////////////////////////////////////////////////////////////
00077 INLINE void WorkingNodePath::
00078 operator = (const WorkingNodePath &copy) {
00079   _next = copy._next;
00080   _start = copy._start;
00081   _node = copy._node;
00082 
00083   nassertv(_next != (WorkingNodePath *)NULL ||
00084            _start != (NodePathComponent *)NULL);
00085 }
00086 
00087 ////////////////////////////////////////////////////////////////////
00088 //     Function: WorkingNodePath::get_node_path
00089 //       Access: Public
00090 //  Description: Constructs and returns an actual NodePath that
00091 //               represents the same path we have just traversed.
00092 ////////////////////////////////////////////////////////////////////
00093 INLINE NodePath WorkingNodePath::
00094 get_node_path() const {
00095   NodePath result;
00096   result._head = r_get_node_path();
00097   nassertr(result._head != (NodePathComponent *)NULL, NodePath::fail());
00098   return result;
00099 }
00100 
00101 ////////////////////////////////////////////////////////////////////
00102 //     Function: WorkingNodePath::node
00103 //       Access: Public
00104 //  Description: Returns the node traversed to so far.
00105 ////////////////////////////////////////////////////////////////////
00106 INLINE PandaNode *WorkingNodePath::
00107 node() const {
00108   return _node;
00109 }
00110 
00111 INLINE ostream &
00112 operator << (ostream &out, const WorkingNodePath &node_path) {
00113   node_path.output(out);
00114   return out;
00115 }
 All Classes Functions Variables Enumerations