windows-nt/Source/XPSP1/NT/admin/wmi/wbem/winmgmt/repdrvr/smrtptr.h
2020-09-26 16:20:57 +08:00

70 lines
858 B
C++

/*++
Copyright (C) 1999-2001 Microsoft Corporation
Module Name:
Abstract:
History:
--*/
#ifndef _SMRTPTR_H_
#define _SMRTPTR_H_
template<class T>
class CDeleteMe
{
protected:
T* m_p;
public:
CDeleteMe(T* p = NULL) : m_p(p){}
~CDeleteMe() {delete m_p;}
// overwrites the previous pointer, does NOT delete it
void operator= (T* p) {m_p = p;}
};
class CReleaseMe
{
public:
CReleaseMe ( IUnknown *pIn);
~CReleaseMe ();
private:
IUnknown *m_pIn;
};
class CFreeMe
{
public:
CFreeMe ( BSTR pIn);
~CFreeMe ();
private:
BSTR m_pIn;
};
class CClearMe
{
public:
CClearMe ( VARIANT *pIn);
~CClearMe ();
private:
VARIANT *m_pIn;
};
class CRepdrvrCritSec
{
public:
CRepdrvrCritSec (CRITICAL_SECTION *pCS);
~CRepdrvrCritSec ();
private:
CRITICAL_SECTION *p_cs;
};
#endif // _SMRTPTR_H_