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.

52 lines
812 B

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. SMARTPTR.H
  5. History:
  6. --*/
  7. #ifndef ESPUTIL_SMARTPTR_H
  8. #define ESPUTIL_SMARTPTR_H
  9. template<class T>
  10. class SmartPtr
  11. {
  12. public:
  13. NOTHROW SmartPtr();
  14. NOTHROW SmartPtr(T *);
  15. NOTHROW T & operator*(void) const;
  16. NOTHROW T * operator->(void) const;
  17. NOTHROW T* Extract(void);
  18. NOTHROW T* GetPointer(void);
  19. NOTHROW const T * GetPointer(void) const;
  20. NOTHROW BOOL IsNull(void) const;
  21. void operator=(T *);
  22. operator T* &(void);
  23. NOTHROW ~SmartPtr();
  24. private:
  25. T *m_pObject;
  26. SmartPtr(const SmartPtr<T> &);
  27. void operator=(const SmartPtr<T> &);
  28. //
  29. // This hackery prevents Smart Pointer from being on the heap
  30. //
  31. void operator delete(void *);
  32. };
  33. #include "smartptr.inl"
  34. #endif