Source code of Windows XP (NT5)
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.

48 lines
1.4 KiB

  1. // slbRCObj.h -- Reference counted abstract base class
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #if !defined(SLB_RCOBJ_H)
  8. #define SLB_RCOBJ_H
  9. #include "windows.h" // for LONG
  10. namespace slbRefCnt {
  11. // RCObject -- Abstract base class for reference-counted object.
  12. //
  13. // All objects that need to be reference counted through RCPtr should be
  14. // derived from this class (see slbRCPtr.h for more info on RCPtr).
  15. //
  16. // CONSTRAINTS: Objects derived from RCObject must be allocated from
  17. // the heap and not the stack.
  18. //
  19. class RCObject {
  20. public:
  21. // Operations
  22. void AddReference();
  23. void RemoveReference();
  24. protected:
  25. // Contructors/Destructors
  26. RCObject();
  27. RCObject(RCObject const &rhs);
  28. virtual ~RCObject() = 0;
  29. // Operators
  30. RCObject &operator=(RCObject const &rhs);
  31. private:
  32. // Variables
  33. LONG m_cRefCount;
  34. };
  35. } // namespace
  36. #endif // SLB_RCOBJ_H