Smart< ReferenceCountedObject > Class Template Reference
Smart pointer to reference counted objects.
More...
#include <reference-count.h>
List of all members.
Detailed Description
template<class ReferenceCountedObject>
class Smart< ReferenceCountedObject >
Smart pointer to reference counted objects.
- Todo:
- actually check whether we cannot create a concurrency problem.
Constructor & Destructor Documentation
template<class ReferenceCountedObject>
| Smart< ReferenceCountedObject >::Smart |
( |
ReferenceCountedObject * |
p = 0 |
) |
[inline, explicit] |
template<class ReferenceCountedObject>
| Smart< ReferenceCountedObject >::Smart |
( |
const Smart< ReferenceCountedObject > & |
o |
) |
[inline] |
template<class ReferenceCountedObject>
| Smart< ReferenceCountedObject >::~Smart |
( |
|
) |
[inline] |
Member Function Documentation
template<class ReferenceCountedObject>
| void Smart< ReferenceCountedObject >::decref |
( |
|
) |
const [inline] |
The general idea is to decrease the reference count of the underlying object in an atomic manner. If the object reaches zero we delete it. With the deletion there are some tricky semantics involved. For instance, if the object that is deleted suddenly passes itself to another one then the reference count will be increased again. However, the object was just being deleted, which means that it should not be deleted again. There are two possible strategies to use this file. Either you do care about using an object that is being deleted (leave everything as it is, the program will crash when you do so). Or you don't care about it and really only want one deletion. In that case, uncomment the assert in the incref method. In both cases, we detect a deletion operation by decreffing the pointer once more.
Referenced by Smart< FragmentFileData >::operator=(), and Smart< FragmentFileData >::~Smart().
template<class ReferenceCountedObject>
| void Smart< ReferenceCountedObject >::incref |
( |
|
) |
const [inline] |
template<class ReferenceCountedObject>
| Smart< ReferenceCountedObject >::operator bool |
( |
|
) |
[inline] |
template<class ReferenceCountedObject>
template<class AnotherReferenceCountedObject >
| Smart< ReferenceCountedObject >::operator Smart< AnotherReferenceCountedObject > |
( |
|
) |
[inline] |
template<class ReferenceCountedObject>
| bool Smart< ReferenceCountedObject >::operator!= |
( |
const Smart< ReferenceCountedObject > & |
o |
) |
const [inline] |
template<class ReferenceCountedObject>
| ReferenceCountedObject& Smart< ReferenceCountedObject >::operator* |
( |
|
) |
[inline] |
template<class ReferenceCountedObject>
| ReferenceCountedObject* Smart< ReferenceCountedObject >::operator-> |
( |
|
) |
[inline] |
template<class ReferenceCountedObject>
| bool Smart< ReferenceCountedObject >::operator< |
( |
const Smart< ReferenceCountedObject > & |
o |
) |
const [inline] |
template<class ReferenceCountedObject>
| bool Smart< ReferenceCountedObject >::operator<= |
( |
const Smart< ReferenceCountedObject > & |
o |
) |
const [inline] |
template<class ReferenceCountedObject>
template<class AnotherReferenceCountedObject >
| Smart<ReferenceCountedObject>& Smart< ReferenceCountedObject >::operator= |
( |
const Smart< AnotherReferenceCountedObject > & |
o |
) |
[inline] |
template<class ReferenceCountedObject>
| Smart<ReferenceCountedObject>& Smart< ReferenceCountedObject >::operator= |
( |
const Smart< ReferenceCountedObject > & |
o |
) |
[inline] |
template<class ReferenceCountedObject>
| bool Smart< ReferenceCountedObject >::operator== |
( |
const Smart< ReferenceCountedObject > & |
o |
) |
const [inline] |
template<class ReferenceCountedObject>
| bool Smart< ReferenceCountedObject >::operator>= |
( |
const Smart< ReferenceCountedObject > & |
o |
) |
const [inline] |
Member Data Documentation
template<class ReferenceCountedObject>
| ReferenceCountedObject* Smart< ReferenceCountedObject >::ptr |
Referenced by Smart< FragmentFileData >::decref(), Smart< FragmentFileData >::incref(), Smart< FragmentFileData >::operator bool(), Smart< FragmentFileData >::operator Smart< AnotherReferenceCountedObject >(), Smart< FragmentFileData >::operator!=(), Smart< FragmentFileData >::operator*(), Smart< FragmentFileData >::operator->(), Smart< FragmentFileData >::operator<(), DataSmart< FragmentFileData >::operator<(), Smart< FragmentFileData >::operator<=(), Smart< FragmentFileData >::operator=(), Smart< FragmentFileData >::operator==(), and Smart< FragmentFileData >::operator>=().
The documentation for this class was generated from the following file: