Panda3D
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  */
29 class EXPCL_PANDA_PUTIL CallbackData : public TypedObject {
30 protected:
31  INLINE CallbackData();
32 
33 PUBLISHED:
34  virtual void output(std::ostream &out) const;
35 
36  virtual void upcall();
37 
38 public:
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 
52 private:
53  static TypeHandle _type_handle;
54 };
55 
56 inline 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
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:44
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:88
This is a generic data block that is passed along to a CallbackObject when a callback is made.
Definition: callbackData.h:29
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.