Panda3D
Loading...
Searching...
No Matches
callbackData.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 callbackData.h
10 * @author drose
11 * @date 2009-03-13
12 */
13
14#ifndef CALLBACKDATA_H
15#define CALLBACKDATA_H
16
17#include "pandabase.h"
18#include "typedObject.h"
19
20/**
21 * This is a generic data block that is passed along to a CallbackObject when
22 * a callback is made. It contains data specific to the particular callback
23 * type in question.
24 *
25 * This is actually an abstract base class and contains no data.
26 * Specializations of this class will contain the actual data relevant to each
27 * callback type.
28 */
29class EXPCL_PANDA_PUTIL CallbackData : public TypedObject {
30protected:
31 INLINE CallbackData();
32
33PUBLISHED:
34 virtual void output(std::ostream &out) const;
35
36 virtual void upcall();
37
38public:
39 static TypeHandle get_class_type() {
40 return _type_handle;
41 }
42 static void init_type() {
44 register_type(_type_handle, "CallbackData",
45 TypedObject::get_class_type());
46 }
47 virtual TypeHandle get_type() const {
48 return get_class_type();
49 }
50 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
51
52private:
53 static TypeHandle _type_handle;
54};
55
56inline std::ostream &operator << (std::ostream &out, const CallbackData &cbd) {
57 cbd.output(out);
58 return out;
59}
60
61#include "callbackData.I"
62
63#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.
virtual void upcall()
You should make this call during the callback if you want to continue the normal function that would ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
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.