Panda3D
 All Classes Functions Variables Enumerations
findApproxLevelEntry.h
1 // Filename: findApproxLevelEntry.h
2 // Created by: drose (13Mar02)
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 #ifndef FINDAPPROXLEVELENTRY_H
16 #define FINDAPPROXLEVELENTRY_H
17 
18 #include "pandabase.h"
19 
20 #include "findApproxPath.h"
21 #include "workingNodePath.h"
22 
23 class NodePathCollection;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : FindApproxLevelEntry
27 // Description : This class is local to this package only; it doesn't
28 // get exported. It represents a single node under
29 // consideration for matching at a single point in the
30 // breadth-first search.
31 ////////////////////////////////////////////////////////////////////
33 public:
34  INLINE FindApproxLevelEntry(const WorkingNodePath &node_path,
35  FindApproxPath &approx_path);
36  INLINE FindApproxLevelEntry(const FindApproxLevelEntry &parent,
37  PandaNode *child_node, int i,
38  FindApproxLevelEntry *next);
39  INLINE FindApproxLevelEntry(const FindApproxLevelEntry &copy);
40  INLINE void operator = (const FindApproxLevelEntry &copy);
41  ALLOC_DELETED_CHAIN(FindApproxLevelEntry);
42 
43  INLINE bool next_is_stashed(int increment) const;
44 
45  bool consider_node(NodePathCollection &result,
46  FindApproxLevelEntry *&next_level,
47  int max_matches, int increment) const;
48  void consider_next_step(PandaNode *child_node,
49  FindApproxLevelEntry *&next_level,
50  int increment) const;
51  INLINE bool is_solution(int increment) const;
52 
53  void output(ostream &out) const;
54  void write_level(ostream &out, int indent_level) const;
55 
56  // _node_path represents the most recent node that we have
57  // previously accepted as being a partial solution.
58  WorkingNodePath _node_path;
59 
60  // _i represents the next component in the approx_path that must be
61  // matched against all of the children of _node_path, above. If _i
62  // refers to the end of the approx_path, then _node_path is a
63  // solution.
64  int _i;
65  FindApproxPath &_approx_path;
66  FindApproxLevelEntry *_next;
67 
68 public:
69  static TypeHandle get_class_type() {
70  return _type_handle;
71  }
72  static void init_type() {
73  register_type(_type_handle, "FindApproxLevelEntry");
74  }
75 
76 private:
77  static TypeHandle _type_handle;
78 };
79 
80 INLINE ostream &
81 operator << (ostream &out, const FindApproxLevelEntry &entry) {
82  entry.output(out);
83  return out;
84 }
85 
86 #include "findApproxLevelEntry.I"
87 
88 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
bool consider_node(NodePathCollection &result, FindApproxLevelEntry *&next_level, int max_matches, int increment) const
Considers the node represented by the entry for matching the find path.
This class is local to this package only; it doesn&#39;t get exported.
void consider_next_step(PandaNode *child_node, FindApproxLevelEntry *&next_level, int increment) const
Compares the indicated child node (which is assumed to be a child of _node_path) with the next compon...
This class is local to this package only; it doesn&#39;t get exported.
bool is_solution(int increment) const
Returns true if this entry represents a solution to the search; i.e.
This is a class designed to support low-overhead traversals of the complete scene graph...
void write_level(ostream &out, int indent_level) const
Writes the entire level (a linked list of entries beginning at this entry).
bool next_is_stashed(int increment) const
Returns true if the next node matched by this entry must be a stashed node, false otherwise...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
void output(ostream &out) const
Formats the entry for meaningful output.
This is a set of zero or more NodePaths.