Panda3D
Loading...
Searching...
No Matches
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
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 */
33class EXPCL_PANDA_GOBJ QueryContext : public TypedReferenceCount {
34public:
35 INLINE QueryContext();
36 virtual ~QueryContext();
37
38 virtual bool is_answer_ready() const=0;
39 virtual void waiting_for_answer();
40
41public:
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
55private:
56 static TypeHandle _type_handle;
57};
58
59#include "queryContext.I"
60
61#endif
A table of objects that are saved within the graphics context for reference by handle later.
virtual bool is_answer_ready() const =0
Returns true if the query's answer is ready, false otherwise.
virtual void waiting_for_answer()
Requests the graphics engine to expedite the pending answer–the application is now waiting until the ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
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(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.