Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | List of all members
Mezzanine::ReferenceCount< TypePointedTo > Class Template Reference

This exists once per object managed by a group of shared pointer to track items in memory. More...

#include <countedptr.h>

Public Member Functions

 ReferenceCount (TypePointedTo *InitialPointer=0, unsigned InitialCount=0)
 Constructor. More...
 
virtual ~ReferenceCount ()
 Destructor, cleans up the object when the last reference deletes this.
 
Whole DecrementReferenceCount ()
 Decrease the reference count by one and return the updated count. More...
 
virtual TypePointedTo * GetMostDerived ()
 Get a pointer to the Target as a The most derived type in of this object*. More...
 
Whole GetReferenceCount ()
 Get the current amount of references. More...
 
TypePointedTo * GetReferenceCountTargetAsPointer ()
 Gets the actual pointer to the target. More...
 
Whole IncrementReferenceCount ()
 Increase the reference count by one and return the updated count. More...
 

Detailed Description

template<typename TypePointedTo>
class Mezzanine::ReferenceCount< TypePointedTo >

This exists once per object managed by a group of shared pointer to track items in memory.

This exists to track the pointer to the managed object, and stores the single counter of existing references. Only one of these should be created for each group of pointers managing the same object.

Note
It should be extremely rare to need to create one of these outside of pointer implemenation.

Definition at line 96 of file countedptr.h.

Constructor & Destructor Documentation

template<typename TypePointedTo >
Mezzanine::ReferenceCount< TypePointedTo >::ReferenceCount ( TypePointedTo *  InitialPointer = 0,
unsigned  InitialCount = 0 
)
inline

Constructor.

Parameters
InitialPointerA pointer to the type of this template. This defaults to 0 if not provided
InitialCountThe number of references to default to this defaults to 1 if not provided.

Definition at line 109 of file countedptr.h.

Member Function Documentation

template<typename TypePointedTo >
Whole Mezzanine::ReferenceCount< TypePointedTo >::DecrementReferenceCount ( )
inline

Decrease the reference count by one and return the updated count.

Returns
The updated count;

Definition at line 124 of file countedptr.h.

template<typename TypePointedTo >
virtual TypePointedTo* Mezzanine::ReferenceCount< TypePointedTo >::GetMostDerived ( )
inlinevirtual

Get a pointer to the Target as a The most derived type in of this object*.

Returns
A pointer, for use with CountedPtrCast

Definition at line 139 of file countedptr.h.

template<typename TypePointedTo >
Whole Mezzanine::ReferenceCount< TypePointedTo >::GetReferenceCount ( )
inline

Get the current amount of references.

Returns
A Whole with the current reference count

Definition at line 134 of file countedptr.h.

template<typename TypePointedTo >
TypePointedTo* Mezzanine::ReferenceCount< TypePointedTo >::GetReferenceCountTargetAsPointer ( )
inline

Gets the actual pointer to the target.

Returns
A Pointer of the targeted type to the object being managed.

Definition at line 129 of file countedptr.h.

template<typename TypePointedTo >
Whole Mezzanine::ReferenceCount< TypePointedTo >::IncrementReferenceCount ( )
inline

Increase the reference count by one and return the updated count.

Returns
The updated count;

Definition at line 119 of file countedptr.h.


The documentation for this class was generated from the following file: