See file comment. More...
#include "ref_counted_owner.h"
Classes | |
class | Family |
Public Member Functions | |
RefCountedOwner (Family *family) | |
bool | Attach () |
void | Initialize (T *value) |
T * | Get () |
const T * | Get () const |
Friends | |
class | Family |
See file comment.
RefCountedOwner< T >::RefCountedOwner | ( | Family * | family | ) | [inline, explicit] |
Instances of RefCountedOwner that share the same 'family' object will share an instance of T.
bool RefCountedOwner< T >::Attach | ( | ) | [inline] |
If an another member of the family has already created the managed object, Attach() will return true and attach 'this' to it, making the object accessible via get() and pointer operations.
Otherwise, it returns false, and you should call Initialize() to set the object.
< we are already attached, no need to initialize.
Someone already made an instance
If need to create it.
T* RefCountedOwner< T >::Get | ( | ) | [inline] |
Note that you must call Attach() (and Initialize() if it returned false) before using these.
void RefCountedOwner< T >::Initialize | ( | T * | value | ) | [inline] |
Sets the value of the object our family will share. Pre-condition: one must not have been set already (in other words, this must only be called if Attach() returned false).