Panda3D

queryContext.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 queryContext.h
10 * @author drose
11 * @date 2006-03-27
12 */
13
14 #ifndef QUERYCONTEXT_H
15 #define QUERYCONTEXT_H
16
17 #include "pandabase.h"
18 #include "typedReferenceCount.h"
19
20 class PreparedGraphicsObjects;
21
22 /**
23 * This is a base class for queries that might require a round-trip to the
24 * graphics engine. The idea is that when you ask the GSG to make a
25 * particular query, it returns a QueryContext, which does not necessarily
26 * have the answer right away (but it will eventually).
27 *
28 * Unlike SavedContext, QueryContext is reference-counted. It removes itself
29 * from the GSG when the last reference goes away. You're responsible for
30 * keeping the pointer to the QueryContext as long as you are interested in
31 * the answer.
32 */
33 class EXPCL_PANDA_GOBJ QueryContext : public TypedReferenceCount {
34 public:
35 INLINE QueryContext();
36 virtual ~QueryContext();
37
38 virtual bool is_answer_ready() const=0;
39 virtual void waiting_for_answer();
40
41 public:
42 static TypeHandle get_class_type() {
43 return _type_handle;
44 }
45 static void init_type() {
46 TypedReferenceCount::init_type();
47 register_type(_type_handle, "QueryContext",
48 TypedReferenceCount::get_class_type());
49 }
50 virtual TypeHandle get_type() const {
51 return get_class_type();
52 }
53 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
54
55 private:
56 static TypeHandle _type_handle;
57 };
58
59 #include "queryContext.I"
60
61 #endif
PreparedGraphicsObjects
A table of objects that are saved within the graphics context for reference by handle later.
Definition: preparedGraphicsObjects.h:58
QueryContext
This is a base class for queries that might require a round-trip to the graphics engine.
Definition: queryContext.h:33
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
TypedReferenceCount
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
Definition: typedReferenceCount.h:31
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
queryContext.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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
typedReferenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.