Panda3D
findApproxLevelEntry.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file findApproxLevelEntry.I
10  * @author drose
11  * @date 2002-03-13
12  */
13 
14 /**
15  *
16  */
17 INLINE FindApproxLevelEntry::
18 FindApproxLevelEntry(const WorkingNodePath &node_path, FindApproxPath &approx_path) :
19  _node_path(node_path),
20  _approx_path(approx_path)
21 {
22  _i = 0;
23  _next = nullptr;
24  nassertv(_node_path.is_valid());
25 }
26 
27 /**
28  * This constructor is used to construct the next entry based on a child node
29  * of the previous entry's node.
30  */
31 INLINE FindApproxLevelEntry::
32 FindApproxLevelEntry(const FindApproxLevelEntry &parent,
33  PandaNode *child_node, int i,
34  FindApproxLevelEntry *next) :
35  _node_path(parent._node_path, child_node),
36  _i(i),
37  _approx_path(parent._approx_path),
38  _next(next)
39 {
40  nassertv(validate_ptr(this) && validate_ptr(&parent));
41  nassertv(_node_path.is_valid());
42 }
43 
44 /**
45  *
46  */
47 INLINE FindApproxLevelEntry::
48 FindApproxLevelEntry(const FindApproxLevelEntry &copy) :
49  _node_path(copy._node_path),
50  _i(copy._i),
51  _approx_path(copy._approx_path)
52 {
53  _next = nullptr;
54  nassertv(_node_path.is_valid());
55 }
56 
57 /**
58  *
59  */
60 INLINE void FindApproxLevelEntry::
61 operator = (const FindApproxLevelEntry &copy) {
62  _node_path = copy._node_path;
63  _i = copy._i;
64  nassertv(&_approx_path == &copy._approx_path);
65  nassertv(_node_path.is_valid());
66 }
67 
68 
69 /**
70  * Returns true if the next node matched by this entry must be a stashed node,
71  * false otherwise.
72  */
73 INLINE bool FindApproxLevelEntry::
74 next_is_stashed(int increment) const {
75  return _approx_path.matches_stashed(_i + increment);
76 }
77 
78 /**
79  * Returns true if this entry represents a solution to the search; i.e. all
80  * the components of the path have been successfully matched.
81  */
82 INLINE bool FindApproxLevelEntry::
83 is_solution(int increment) const {
84  return (_i + increment >= _approx_path.get_num_components());
85 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
bool is_solution(int increment) const
Returns true if this entry represents a solution to the search; i.e.
This class is local to this package only; it doesn't get exported.
bool matches_stashed(int index) const
Returns true if the nth component of the path matches a stashed node only, false otherwise.
This class is local to this package only; it doesn't get exported.
bool next_is_stashed(int increment) const
Returns true if the next node matched by this entry must be a stashed node, false otherwise.
This is a class designed to support low-overhead traversals of the complete scene graph,...
int get_num_components() const
Returns the number of components in the path.
is_valid
Returns true if the WorkingNodePath object appears to be a valid NodePath reference,...