|
MPMA Framework 0.4
|
Deriving from this allows multiple instances of a class to share data, which will be automatically freed when the last instance is freed. More...
#include <ReferenceCount.h>
Public Member Functions | |
| ReferenceCountedData () | |
| Creates a new instance of the data. | |
| virtual | ~ReferenceCountedData () |
| Removes a reference to the data. | |
| ReferenceCountedData (const ReferenceCountedData &other) | |
| Creates a new reference to existing data. | |
| ReferenceCountedData & | operator= (const ReferenceCountedData &other) |
| Removes the old reference and adds a new reference to existing data. | |
| bool | SharesDataWith (const ReferenceCountedData< DataType > &o) |
| Returns whether one objects references the same data as another. | |
Protected Member Functions | |
| DataType & | Data () |
| Returns the data that is being reference counted. | |
| const DataType & | Data () const |
| Returns the data that is being reference counted. | |
| nuint | ReferenceCount () const |
| Returns the number of references left (intended for debugging purposes). | |
| bool | IsOnlyReference () const |
| Returns true if this is the only reference to the shared data. This can be useful in the derived class's constructor/destructor to do any setup or cleanup. | |
| void | CreateNewData () |
| Remove the old reference from this object, and creates a new instance of the data which this objet then references. | |
Deriving from this allows multiple instances of a class to share data, which will be automatically freed when the last instance is freed.
1.7.4