Panda3D
typedReferenceCount.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 typedReferenceCount.h
10  * @author drose
11  * @date 1999-02-08
12  */
13 
14 #ifndef TYPEDREFERENCECOUNT_H
15 #define TYPEDREFERENCECOUNT_H
16 
17 #include "pandabase.h"
18 
19 #include "typedObject.h"
20 #include "referenceCount.h"
21 
22 /**
23  * A base class for things which need to inherit from both TypedObject and
24  * from ReferenceCount. It's convenient to define this intermediate base
25  * class instead of multiply inheriting from the two classes each time they
26  * are needed, so that we can sensibly pass around pointers to things which
27  * are both TypedObjects and ReferenceCounters.
28  *
29  * See also TypedObject for detailed instructions.
30  */
31 class EXPCL_PANDA_EXPRESS TypedReferenceCount : public TypedObject, public ReferenceCount {
32 public:
33  INLINE TypedReferenceCount();
34  INLINE TypedReferenceCount(const TypedReferenceCount &copy);
35  INLINE void operator = (const TypedReferenceCount &copy);
36 
37 public:
38  virtual TypeHandle get_type() const {
39  return get_class_type();
40  }
41  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
42 
43 PUBLISHED:
44  static TypeHandle get_class_type() {
45  return _type_handle;
46  }
47 
48 public:
49  static void init_type() {
51  ReferenceCount::init_type();
52  register_type(_type_handle, "TypedReferenceCount",
53  TypedObject::get_class_type(),
54  ReferenceCount::get_class_type());
55  }
56 
57 private:
58  static TypeHandle _type_handle;
59 };
60 
61 #include "typedReferenceCount.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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:88
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.