Ion
|
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting. More...
#include "sharedptr.h"
Public Member Functions | |
SharedPtr () | |
The default constructor initializes the pointer to NULL. More... | |
SharedPtr (T *shared) | |
Constructor that takes a raw shared pointer. More... | |
template<typename U > | |
SharedPtr (const SharedPtr< U > &p) | |
Constructor that allows sharing of a pointer to a type that is compatible with T*. More... | |
SharedPtr (const SharedPtr< T > &p) | |
The copy constructor shares the instance from the other pointer. More... | |
~SharedPtr () | |
T * | Get () const |
Returns a raw pointer to the instance, which may be NULL. More... | |
void | Reset (T *new_shared) |
Changes the pointer to point to the given shared, which may be NULL. More... | |
void | Reset () |
Make the SharedPtr point to NULL. More... | |
SharedPtr< T > & | operator= (T *new_shared) |
Assignment to a raw pointer is the same as Reset(). More... | |
template<typename U > | |
SharedPtr< T > & | operator= (U *new_shared) |
Allow assignment to a compatible raw pointer. More... | |
SharedPtr< T > & | operator= (const SharedPtr< T > &p) |
Allow assignment to a SharedPtr of the same type. More... | |
template<typename U > | |
SharedPtr< T > & | operator= (const SharedPtr< U > &p) |
Allow assignment to a compatible SharedPtr. More... | |
T * | operator-> () const |
The -> operator forwards to the raw pointer. More... | |
T & | operator* () const |
The * operator returns the underlying instance. More... | |
bool | operator== (const SharedPtr< T > &p) const |
The equality operator returns true if the raw pointers are the same. More... | |
bool | operator!= (const SharedPtr< T > &p) const |
The inequality operator returns true if the raw pointers differ. More... | |
void | swap (SharedPtr< T > &p) |
STL-style function to swap the raw pointer with another SharedPtr without the need for copying. More... | |
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting.
The class passed as the template parameter must support the following interface:
void IncrementRefCount() const; void DecrementRefCount() const;
The DecrementRefCount() function should typically delete the instance when the count goes to zero.
If the type instantiating the SharedPtr is incomplete, only the following operations are supported:
Definition at line 60 of file sharedptr.h.
|
inline |
The default constructor initializes the pointer to NULL.
Definition at line 63 of file sharedptr.h.
|
inlineexplicit |
Constructor that takes a raw shared pointer.
Definition at line 66 of file sharedptr.h.
|
inline |
Constructor that allows sharing of a pointer to a type that is compatible with T*.
Definition at line 72 of file sharedptr.h.
|
inline |
The copy constructor shares the instance from the other pointer.
Definition at line 78 of file sharedptr.h.
|
inline |
Definition at line 82 of file sharedptr.h.
|
inline |
Returns a raw pointer to the instance, which may be NULL.
Definition at line 89 of file sharedptr.h.
Referenced by ion::gfx::AttributeArray::AddAttribute(), ion::gfx::Node::AddChild(), ion::text::FreeTypeFont::AddFallbackFont(), ion::text::FontManager::AddFont(), ion::text::FontManager::AddFontFromZipasset(), ion::remote::NodeGraphHandler::AddNode(), ion::gfx::Node::AddShape(), ion::gfx::Node::AddUniformBlock(), ion::base::StlAllocator< T >::allocate(), ion::base::Allocator::AllocateMemory(), ion::base::DataContainer::AllocatorDeleter(), ion::gfx::FramebufferObject::Attachment::Attachment(), ion::gfx::Renderer::BindFramebuffer(), ion::gfx::BufferObject::BufferSubData::BufferSubData(), ion::text::Builder::Build(), ion::image::NinePatch::BuildImage(), ion::gfxutils::BuildWireframeIndexBuffer(), ion::text::FontManager::CacheFontImage(), ion::gfx::BufferObject::CopySubData(), ion::base::DataContainer::CreateAndCopy(), ion::gfx::Renderer::CreateOrUpdateResources(), ion::gfx::Renderer::CreateOrUpdateShapeResources(), ion::base::Allocator::DeallocateMemory(), ion::base::internal_variant_utils::ManualConstructor< T15 >::Destroy(), ion::gfx::Renderer::DrawScene(), ion::base::DynamicPtrCast(), ion::gfx::BufferObject::GetData(), ion::text::Builder::GetFont(), ion::text::Builder::GetFontImageTexture(), ion::gfx::ShaderProgram::GetFragmentShader(), ion::gfxprofile::GpuProfiler::GetGraphicsManagerOrNull(), ion::gfx::TextureBase::Face::GetImage(), ion::gfx::TextureBase::GetImmutableImage(), ion::image::NinePatch::GetMinimumSize(), ion::base::AllocationManager::GetNonNullAllocator(), ion::image::NinePatch::GetPaddingBox(), ion::gfx::TextureBase::GetSampler(), ion::image::NinePatch::GetSizeToFitContent(), ion::gfx::ShaderProgram::GetVertexShader(), ion::gfx::ShaderInputRegistry::Include(), ion::base::internal_variant_utils::ManualConstructor< T15 >::Init(), ion::base::internal_variant_utils::ManualConstructor< T15 >::InitArray(), ion::gfx::Renderer::MapBufferObjectData(), ion::gfx::Renderer::MapBufferObjectDataRange(), ion::base::Notifier::Notify(), ion::gfx::FramebufferObject::Attachment::operator!=(), ion::base::SharedPtr< AllocationTracker >::operator=(), ion::base::WeakReferentPtr< FramebufferObject >::operator=(), ion::remote::HttpServer::RegisterHandler(), ion::remote::NodeGraphHandler::RemoveNode(), ion::gfx::Renderer::Renderer(), ion::gfx::AttributeArray::ReplaceAttribute(), ion::gfx::Node::ReplaceChild(), ion::gfx::Node::ReplaceShape(), ion::gfx::Node::ReplaceUniformBlock(), ion::gfx::Renderer::RequestForcedShapeUpdates(), ion::gfx::Renderer::RequestForcedUpdates(), ion::gfx::ResourceManager::RequestResourceInfo(), ion::gfx::Renderer::ResolveMultisampleFramebuffer(), ion::gfx::BufferObject::SetData(), ion::base::AllocationManager::SetDefaultAllocatorForLifetime(), ion::gfx::ShaderProgram::SetFragmentShader(), ion::text::OutlineBuilder::SetHalfSmoothWidth(), ion::gfx::TextureBase::Face::SetImage(), ion::gfx::TextureBase::SetImmutableImage(), ion::text::OutlineBuilder::SetOutlineColor(), ion::text::OutlineBuilder::SetOutlineWidth(), ion::text::BasicBuilder::SetSdfPadding(), ion::text::OutlineBuilder::SetSdfPadding(), ion::gfx::BufferObject::SetSubData(), ion::text::BasicBuilder::SetTextColor(), ion::text::OutlineBuilder::SetTextColor(), ion::gfx::ShaderProgram::SetVertexShader(), ion::gfx::ShaderProgram::ShaderProgram(), ion::remote::TracingHandler::TracingHandler(), ion::gfx::Renderer::UnmapBufferObjectData(), ion::text::BasicBuilder::UpdateUniforms(), ion::gfxutils::ResourceCallback< T >::WaitForCompletion(), ion::base::WeakReferentPtr< FramebufferObject >::WeakReferentPtr(), ion::base::Allocatable::~Allocatable(), ion::gfx::Image::~Image(), ion::gfxutils::ResourceCallback< T >::~ResourceCallback(), ion::gfx::Texture::~Texture(), and ion::remote::TracingHandler::~TracingHandler().
|
inline |
The inequality operator returns true if the raw pointers differ.
Definition at line 157 of file sharedptr.h.
|
inline |
The * operator returns the underlying instance.
Definition at line 146 of file sharedptr.h.
|
inline |
The -> operator forwards to the raw pointer.
Definition at line 140 of file sharedptr.h.
|
inline |
Assignment to a raw pointer is the same as Reset().
Definition at line 109 of file sharedptr.h.
|
inline |
Allow assignment to a compatible raw pointer.
Definition at line 115 of file sharedptr.h.
|
inline |
Allow assignment to a SharedPtr of the same type.
Don't delegate to Reset() here because Reset() requires a complete type. We can do this version without that requirement.
Definition at line 123 of file sharedptr.h.
|
inline |
Allow assignment to a compatible SharedPtr.
Definition at line 134 of file sharedptr.h.
|
inline |
The equality operator returns true if the raw pointers are the same.
Definition at line 152 of file sharedptr.h.
|
inline |
Changes the pointer to point to the given shared, which may be NULL.
Definition at line 92 of file sharedptr.h.
Referenced by ion::text::FontManager::AddFont(), ion::text::Builder::Build(), ion::remote::RemoteServer::RemoteServer(), and ion::gfxutils::ResourceCallback< T >::ResourceCallback().
|
inline |
Make the SharedPtr point to NULL.
Definition at line 102 of file sharedptr.h.
Referenced by ion::base::SharedPtr< AllocationTracker >::operator=().
|
inline |
STL-style function to swap the raw pointer with another SharedPtr without the need for copying.
Definition at line 163 of file sharedptr.h.