Panda3D
findApproxLevelEntry.h
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.h
10  * @author drose
11  * @date 2002-03-13
12  */
13 
14 #ifndef FINDAPPROXLEVELENTRY_H
15 #define FINDAPPROXLEVELENTRY_H
16 
17 #include "pandabase.h"
18 
19 #include "findApproxPath.h"
20 #include "workingNodePath.h"
21 
22 class NodePathCollection;
23 
24 /**
25  * This class is local to this package only; it doesn't get exported. It
26  * represents a single node under consideration for matching at a single point
27  * in the breadth-first search.
28  */
30 public:
31  INLINE FindApproxLevelEntry(const WorkingNodePath &node_path,
32  FindApproxPath &approx_path);
33  INLINE FindApproxLevelEntry(const FindApproxLevelEntry &parent,
34  PandaNode *child_node, int i,
35  FindApproxLevelEntry *next);
36  INLINE FindApproxLevelEntry(const FindApproxLevelEntry &copy);
37  INLINE void operator = (const FindApproxLevelEntry &copy);
38  ALLOC_DELETED_CHAIN(FindApproxLevelEntry);
39 
40  INLINE bool next_is_stashed(int increment) const;
41 
42  bool consider_node(NodePathCollection &result,
43  FindApproxLevelEntry *&next_level,
44  int max_matches, int increment) const;
45  void consider_next_step(PandaNode *child_node,
46  FindApproxLevelEntry *&next_level,
47  int increment) const;
48  INLINE bool is_solution(int increment) const;
49 
50  void output(std::ostream &out) const;
51  void write_level(std::ostream &out, int indent_level) const;
52 
53  // _node_path represents the most recent node that we have previously
54  // accepted as being a partial solution.
55  WorkingNodePath _node_path;
56 
57  // _i represents the next component in the approx_path that must be matched
58  // against all of the children of _node_path, above. If _i refers to the
59  // end of the approx_path, then _node_path is a solution.
60  int _i;
61  FindApproxPath &_approx_path;
62  FindApproxLevelEntry *_next;
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  register_type(_type_handle, "FindApproxLevelEntry");
70  }
71 
72 private:
73  static TypeHandle _type_handle;
74 };
75 
76 INLINE std::ostream &
77 operator << (std::ostream &out, const FindApproxLevelEntry &entry) {
78  entry.output(out);
79  return out;
80 }
81 
82 #include "findApproxLevelEntry.I"
83 
84 #endif
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.
bool is_solution(int increment) const
Returns true if this entry represents a solution to the search; i.e.
void write_level(std::ostream &out, int indent_level) const
Writes the entire level (a linked list of entries beginning at this entry).
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.
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...
void output(std::ostream &out) const
Formats the entry for meaningful output.
This class is local to this package only; it doesn't get exported.
This is a set of zero or more NodePaths.
A basic node of the scene graph or data graph.
Definition: pandaNode.h:65
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
This is a class designed to support low-overhead traversals of the complete scene graph,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.