Smart object reference. More...
#include <Radiant/RefObj.hpp>
Public Member Functions | |
| void | deepCopy (const RefObj &that) |
| Create a deep copy of the object Instead of sharing a link to an object, this method creates a real copy of the object. More... | |
| T & | operator* () |
| An operator to get a reference to the object. More... | |
| const T & | operator* () const |
| An operator to get a constant reference to the object. More... | |
| RefObj & | operator= (const RefObj &that) |
| Link to the source object. More... | |
| T & | ref () |
| Get a reference to the object. More... | |
| const T & | ref () const |
| Get a constant reference to the object. More... | |
| RefObj () | |
| Constructor. | |
| RefObj (const T &obj) | |
| Creates a RefObj that copies the argument object. More... | |
| RefObj (const RefObj< T > &that) | |
| Share the object pointer with another RefObj. More... | |
| ~RefObj () | |
| Deletes the RefObj, potentially deleting the object. | |
Smart object reference.
This class can be used to share an object between several holders, using reference counters.
Typical use cases for RefObj are situations where one wants to avoid copying objects, instead sharing them inside the application. RefObj implements a basic reference- counter for these situations.
The RefObj class is not fully thread-safe. You can access the objects from multiple threads, but the reference count changes are not thread-safe. Thus you should not do the link/unlink actions without implementing thread-locks yourself. Functions that are affected by this limitation are the consttructors, destructor, and equality operators.
|
inline |
Creates a RefObj that copies the argument object.
| obj | Object to copy |
|
inline |
Share the object pointer with another RefObj.
| that | Object that is being copied |
|
inline |
Create a deep copy of the object Instead of sharing a link to an object, this method creates a real copy of the object.
| that | object to copy |
|
inline |
An operator to get a reference to the object.
|
inline |
An operator to get a constant reference to the object.
|
inline |
Link to the source object.
| that | Object to point to from this objecct |
|
inline |
Get a reference to the object.
|
inline |
Get a constant reference to the object.