Panda3D
 All Classes Functions Variables Enumerations
queryContext.h
1 // Filename: queryContext.h
2 // Created by: drose (27Mar06)
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 QUERYCONTEXT_H
16 #define QUERYCONTEXT_H
17 
18 #include "pandabase.h"
19 #include "typedReferenceCount.h"
20 
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : QueryContext
25 // Description : This is a base class for queries that might require a
26 // round-trip to the graphics engine. The idea is that
27 // when you ask the GSG to make a particular query, it
28 // returns a QueryContext, which does not necessarily
29 // have the answer right away (but it will eventually).
30 //
31 // Unlike SavedContext, QueryContext is
32 // reference-counted. It removes itself from the GSG
33 // when the last reference goes away. You're
34 // responsible for keeping the pointer to the
35 // QueryContext as long as you are interested in the
36 // answer.
37 ////////////////////////////////////////////////////////////////////
38 class EXPCL_PANDA_GOBJ QueryContext : public TypedReferenceCount {
39 public:
40  INLINE QueryContext();
41  virtual ~QueryContext();
42 
43  virtual bool is_answer_ready() const=0;
44  virtual void waiting_for_answer();
45 
46 public:
47  static TypeHandle get_class_type() {
48  return _type_handle;
49  }
50  static void init_type() {
51  TypedReferenceCount::init_type();
52  register_type(_type_handle, "QueryContext",
53  TypedReferenceCount::get_class_type());
54  }
55  virtual TypeHandle get_type() const {
56  return get_class_type();
57  }
58  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
59 
60 private:
61  static TypeHandle _type_handle;
62 };
63 
64 #include "queryContext.I"
65 
66 #endif
67 
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
A table of objects that are saved within the graphics context for reference by handle later...
This is a base class for queries that might require a round-trip to the graphics engine.
Definition: queryContext.h:38
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85