Panda3D
Loading...
Searching...
No Matches
cPointerCallbackObject.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 cPointerCallbackObject.h
10 * @author drose
11 * @date 2009-03-13
12 */
13
14#ifndef CPOINTERCALLBACKOBJECT_H
15#define CPOINTERCALLBACKOBJECT_H
16
17#include "pandabase.h"
18#include "callbackObject.h"
19
20/**
21 * This is a specialization on CallbackObject to allow association with a
22 * C-style function pointer and a void * parameter.
23 */
24class EXPCL_PANDA_PUTIL CPointerCallbackObject : public CallbackObject {
25public:
26 typedef void CallbackFunction(CallbackData *cbdata, void *data);
27 INLINE CPointerCallbackObject(CallbackFunction *func, void *data);
28 ALLOC_DELETED_CHAIN(CPointerCallbackObject);
29
30public:
31 virtual void do_callback(CallbackData *cbdata);
32
33private:
34 CallbackFunction *_func;
35 void *_data;
36
37public:
38 static TypeHandle get_class_type() {
39 return _type_handle;
40 }
41 static void init_type() {
42 CallbackObject::init_type();
43 register_type(_type_handle, "CPointerCallbackObject",
44 CallbackObject::get_class_type());
45 }
46 virtual TypeHandle get_type() const {
47 return get_class_type();
48 }
49 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
50
51private:
52 static TypeHandle _type_handle;
53};
54
56
57#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a specialization on CallbackObject to allow association with a C-style function pointer and a...
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...
virtual void do_callback(CallbackData *cbdata)
This method called when the callback is triggered; it *replaces* the original function.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
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(),...