Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.7 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: CountedObjects.h
  3. //
  4. // Copyright (c) 1999-2000, Microsoft Corporation
  5. //
  6. // Base class that implements object reference counting
  7. //
  8. // History: 1999-08-17 vtan created
  9. // 2000-02-01 vtan moved from Neptune to Whistler
  10. // --------------------------------------------------------------------------
  11. #ifndef _CountedObject_
  12. #define _CountedObject_
  13. #include "DynamicObject.h"
  14. // --------------------------------------------------------------------------
  15. // CCountedObject
  16. //
  17. // Purpose: This class is a base class that implements object reference
  18. // counting. The default constructor is protected to disable
  19. // instantiating this object unless subclassed. The reference
  20. // count is private because subclasses really shouldn't need to
  21. // know about the reference counting.
  22. //
  23. // History: 1999-08-17 vtan created
  24. // 2000-02-01 vtan moved from Neptune to Whistler
  25. // --------------------------------------------------------------------------
  26. class CCountedObject : public CDynamicObject
  27. {
  28. protected:
  29. CCountedObject (void);
  30. virtual ~CCountedObject (void);
  31. public:
  32. void AddRef (void);
  33. void Release (void);
  34. LONG GetCount (void) const;
  35. private:
  36. LONG _lReferenceCount;
  37. bool _fReleased;
  38. };
  39. #endif /* _CountedObject_ */