IO::SharedPointer class

Implements a basic ref-counted pointer.

This class is meant to be used like a COM object. When this object's reference count goes to zero, the memory it holds is deleted and then this object calls 'delete this'. This class is similar to but doesn't work exactly the same as Boost's shared_ptr template. A typical usage pattern is like so: SharedPointer* pSP = new SharedPointer(1000); pSP->AddRef(); pSP->Release();

Base classes

class IVirtual
A default interface that provides a virtual destructor, it should only be used internally.
class EAIOZoneObject
A class derived from EAIOZoneObject is able to be allocated from different heaps without the owner of the object needing to know or care which heap the object came from or even what kind of allocator the object is using.

Public types

using Allocator = ICoreAllocator

Constructors, destructors, conversion operators

SharedPointer(void* pData, bool bFreeData, Allocator* pAllocator)
SharedPointer(size_type nSize, const char* pName)
SharedPointer(size_type nSize, Allocator* pAllocator, const char* pName)
~SharedPointer() virtual

Public functions

auto GetPointer() -> void*
auto AddRef() -> int
auto Release() -> int
auto GetAllocator() const -> Allocator*

Protected variables

int mnRefCount
Allocator* mpAllocator
uint8_t* mpData
bool mbFreeData