mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
39 lines
595 B
C++
39 lines
595 B
C++
#pragma once
|
|
|
|
namespace PortabilityLayer
|
|
{
|
|
class RefCountedBase
|
|
{
|
|
public:
|
|
RefCountedBase();
|
|
virtual ~RefCountedBase();
|
|
virtual void Release() = 0;
|
|
|
|
void IncRef();
|
|
void DecRef();
|
|
|
|
private:
|
|
unsigned int m_refCount;
|
|
};
|
|
}
|
|
|
|
inline PortabilityLayer::RefCountedBase::RefCountedBase()
|
|
: m_refCount(0)
|
|
{
|
|
}
|
|
|
|
inline PortabilityLayer::RefCountedBase::~RefCountedBase()
|
|
{
|
|
}
|
|
|
|
inline void PortabilityLayer::RefCountedBase::IncRef()
|
|
{
|
|
m_refCount++;
|
|
}
|
|
|
|
inline void PortabilityLayer::RefCountedBase::DecRef()
|
|
{
|
|
if (--m_refCount == 0)
|
|
this->Release();
|
|
}
|