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.

69 lines
858 B

  1. /*++
  2. Copyright (C) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. #ifndef _SMRTPTR_H_
  8. #define _SMRTPTR_H_
  9. template<class T>
  10. class CDeleteMe
  11. {
  12. protected:
  13. T* m_p;
  14. public:
  15. CDeleteMe(T* p = NULL) : m_p(p){}
  16. ~CDeleteMe() {delete m_p;}
  17. // overwrites the previous pointer, does NOT delete it
  18. void operator= (T* p) {m_p = p;}
  19. };
  20. class CReleaseMe
  21. {
  22. public:
  23. CReleaseMe ( IUnknown *pIn);
  24. ~CReleaseMe ();
  25. private:
  26. IUnknown *m_pIn;
  27. };
  28. class CFreeMe
  29. {
  30. public:
  31. CFreeMe ( BSTR pIn);
  32. ~CFreeMe ();
  33. private:
  34. BSTR m_pIn;
  35. };
  36. class CClearMe
  37. {
  38. public:
  39. CClearMe ( VARIANT *pIn);
  40. ~CClearMe ();
  41. private:
  42. VARIANT *m_pIn;
  43. };
  44. class CRepdrvrCritSec
  45. {
  46. public:
  47. CRepdrvrCritSec (CRITICAL_SECTION *pCS);
  48. ~CRepdrvrCritSec ();
  49. private:
  50. CRITICAL_SECTION *p_cs;
  51. };
  52. #endif // _SMRTPTR_H_