Panda3D
Loading...
Searching...
No Matches
callbackObject.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 callbackObject.h
10 * @author drose
11 * @date 2009-03-13
12 */
13
14#ifndef CALLBACKOBJECT_H
15#define CALLBACKOBJECT_H
16
17#include "pandabase.h"
18#include "typedReferenceCount.h"
19
20class CallbackData;
21
22/**
23 * This is a generic object that can be assigned to a callback at various
24 * points in the rendering process. This is actually a base class for a
25 * handful of specialized callback object types. You can also subclass it
26 * yourself to make your own callback handler.
27 */
28class EXPCL_PANDA_PUTIL CallbackObject : public TypedReferenceCount {
29protected:
30 INLINE CallbackObject();
31public:
32 ALLOC_DELETED_CHAIN(CallbackObject);
33
34PUBLISHED:
35 virtual void output(std::ostream &out) const;
36
37 EXTENSION(static PT(CallbackObject) make(PyObject *function));
38
39public:
40 virtual void do_callback(CallbackData *cbdata);
41
42public:
43 static TypeHandle get_class_type() {
44 return _type_handle;
45 }
46 static void init_type() {
47 TypedReferenceCount::init_type();
48 register_type(_type_handle, "CallbackObject",
49 TypedReferenceCount::get_class_type());
50 }
51 virtual TypeHandle get_type() const {
52 return get_class_type();
53 }
54 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
55
56private:
57 static TypeHandle _type_handle;
58};
59
60inline std::ostream &operator << (std::ostream &out, const CallbackObject &cbo) {
61 cbo.output(out);
62 return out;
63}
64
65#include "callbackObject.I"
66
67#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a generic data block that is passed along to a CallbackObject when a callback is made.
This is a generic object that can be assigned to a callback at various points in the rendering proces...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
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.