typedReferenceCount.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Filename: typedReferenceCount.h
  2. // Created by: drose (08Feb99)
  3. //
  4. #ifndef TYPEDREFERENCECOUNT_H
  5. #define TYPEDREFERENCECOUNT_H
  6. #include <pandabase.h>
  7. #include "typedObject.h"
  8. #include "referenceCount.h"
  9. ////////////////////////////////////////////////////////////////////
  10. // Class : TypedReferenceCount
  11. // Description : A base class for things which need to inherit from
  12. // both TypedObject and from ReferenceCount. It's
  13. // convenient to define this intermediate base class
  14. // instead of multiply inheriting from the two classes
  15. // each time they are needed, so that we can sensibly
  16. // pass around pointers to things which are both
  17. // TypedObjects and ReferenceCounters.
  18. ////////////////////////////////////////////////////////////////////
  19. class EXPCL_PANDAEXPRESS TypedReferenceCount : public TypedObject, public ReferenceCount {
  20. public:
  21. INLINE TypedReferenceCount();
  22. INLINE TypedReferenceCount(const TypedReferenceCount &copy);
  23. INLINE void operator = (const TypedReferenceCount &copy);
  24. public:
  25. virtual TypeHandle get_type() const {
  26. return get_class_type();
  27. }
  28. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  29. PUBLISHED:
  30. static TypeHandle get_class_type() {
  31. return _type_handle;
  32. }
  33. public:
  34. static void init_type() {
  35. TypedObject::init_type();
  36. ReferenceCount::init_type();
  37. register_type(_type_handle, "TypedReferenceCount",
  38. TypedObject::get_class_type(),
  39. ReferenceCount::get_class_type());
  40. }
  41. private:
  42. static TypeHandle _type_handle;
  43. };
  44. #include "typedReferenceCount.I"
  45. #endif