Panda3D
 All Classes Functions Variables Enumerations
findApproxLevelEntry.I
00001 // Filename: findApproxLevelEntry.I
00002 // Created by:  drose (13Mar02)
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: FindApproxLevelEntry::Constructor
00018 //       Access: Public
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE FindApproxLevelEntry::
00022 FindApproxLevelEntry(const WorkingNodePath &node_path, FindApproxPath &approx_path) :
00023   _node_path(node_path),
00024   _approx_path(approx_path)
00025 {
00026   _i = 0;
00027   _next = NULL;
00028   nassertv(_node_path.is_valid());
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: FindApproxLevelEntry::Constructor
00033 //       Access: Public
00034 //  Description: This constructor is used to construct the next entry
00035 //               based on a child node of the previous entry's node.
00036 ////////////////////////////////////////////////////////////////////
00037 INLINE FindApproxLevelEntry::
00038 FindApproxLevelEntry(const FindApproxLevelEntry &parent,
00039                      PandaNode *child_node, int i,
00040                      FindApproxLevelEntry *next) :
00041   _node_path(parent._node_path, child_node),
00042   _i(i),
00043   _approx_path(parent._approx_path),
00044   _next(next)
00045 {
00046   nassertv(validate_ptr(this) && validate_ptr(&parent));
00047   nassertv(_node_path.is_valid());
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: FindApproxLevelEntry::Copy Constructor
00052 //       Access: Public
00053 //  Description:
00054 ////////////////////////////////////////////////////////////////////
00055 INLINE FindApproxLevelEntry::
00056 FindApproxLevelEntry(const FindApproxLevelEntry &copy) :
00057   _node_path(copy._node_path),
00058   _i(copy._i),
00059   _approx_path(copy._approx_path)
00060 {
00061   _next = NULL;
00062   nassertv(_node_path.is_valid());
00063 }
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: FindApproxLevelEntry::Copy Assignment Operator
00067 //       Access: Public
00068 //  Description:
00069 ////////////////////////////////////////////////////////////////////
00070 INLINE void FindApproxLevelEntry::
00071 operator = (const FindApproxLevelEntry &copy) {
00072   _node_path = copy._node_path;
00073   _i = copy._i;
00074   nassertv(&_approx_path == &copy._approx_path);
00075   nassertv(_node_path.is_valid());
00076 }
00077 
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: FindApproxLevelEntry::next_is_stashed
00081 //       Access: Public
00082 //  Description: Returns true if the next node matched by this entry
00083 //               must be a stashed node, false otherwise.
00084 ////////////////////////////////////////////////////////////////////
00085 INLINE bool FindApproxLevelEntry::
00086 next_is_stashed(int increment) const {
00087   return _approx_path.matches_stashed(_i + increment);
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: FindApproxLevelEntry::is_solution
00092 //       Access: Public
00093 //  Description: Returns true if this entry represents a solution to
00094 //               the search; i.e. all the components of the path have
00095 //               been successfully matched.
00096 ////////////////////////////////////////////////////////////////////
00097 INLINE bool FindApproxLevelEntry::
00098 is_solution(int increment) const {
00099   return (_i + increment >= _approx_path.get_num_components());
00100 }
 All Classes Functions Variables Enumerations