Panda3D
typedReferenceCount.h
1 // Filename: typedReferenceCount.h
2 // Created by: drose (08Feb99)
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 TYPEDREFERENCECOUNT_H
16 #define TYPEDREFERENCECOUNT_H
17 
18 #include "pandabase.h"
19 
20 #include "typedObject.h"
21 #include "referenceCount.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : TypedReferenceCount
25 // Description : A base class for things which need to inherit from
26 // both TypedObject and from ReferenceCount. It's
27 // convenient to define this intermediate base class
28 // instead of multiply inheriting from the two classes
29 // each time they are needed, so that we can sensibly
30 // pass around pointers to things which are both
31 // TypedObjects and ReferenceCounters.
32 //
33 // See also TypedObject for detailed instructions.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDAEXPRESS TypedReferenceCount : public TypedObject, public ReferenceCount {
36 public:
37  INLINE TypedReferenceCount();
38  INLINE TypedReferenceCount(const TypedReferenceCount &copy);
39  INLINE void operator = (const TypedReferenceCount &copy);
40 
41 public:
42  virtual TypeHandle get_type() const {
43  return get_class_type();
44  }
45  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
46 
47 PUBLISHED:
48  static TypeHandle get_class_type() {
49  return _type_handle;
50  }
51 
52 public:
53  static void init_type() {
55  ReferenceCount::init_type();
56  register_type(_type_handle, "TypedReferenceCount",
57  TypedObject::get_class_type(),
58  ReferenceCount::get_class_type());
59  }
60 
61 private:
62  static TypeHandle _type_handle;
63 };
64 
65 #include "typedReferenceCount.I"
66 
67 #endif
68 
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:52
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:98
A base class for all things that want to be reference-counted.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85