Panda3D
callbackData.h
1 // Filename: callbackData.h
2 // Created by: drose (13Mar09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CALLBACKDATA_H
16 #define CALLBACKDATA_H
17 
18 #include "pandabase.h"
19 #include "typedObject.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : CallbackData
23 // Description : This is a generic data block that is passed along to
24 // a CallbackObject when a callback is made. It
25 // contains data specific to the particular callback
26 // type in question.
27 //
28 // This is actually an abstract base class and contains
29 // no data. Specializations of this class will contain
30 // the actual data relevant to each callback type.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDA_PUTIL CallbackData : public TypedObject {
33 protected:
34  INLINE CallbackData();
35 
36 PUBLISHED:
37  virtual void output(ostream &out) const;
38 
39  virtual void upcall();
40 
41 public:
42  static TypeHandle get_class_type() {
43  return _type_handle;
44  }
45  static void init_type() {
47  register_type(_type_handle, "CallbackData",
48  TypedObject::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 
55 private:
56  static TypeHandle _type_handle;
57 };
58 
59 inline ostream &operator << (ostream &out, const CallbackData &cbd) {
60  cbd.output(out);
61  return out;
62 }
63 
64 #include "callbackData.I"
65 
66 #endif
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:52
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:98
This is a generic data block that is passed along to a CallbackObject when a callback is made...
Definition: callbackData.h:32
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85