Reference counting janitor class. More...
#include <xsens_janitors.h>
Public Types | |
| typedef T | ElementType |
| A type definition for an element type. More... | |
| typedef void(* | PostDeallocateFunc) () |
| A function prototype for a post deallocation function. More... | |
| typedef JanitorRCDeallocation< T, DeallocationPolicy > | ThisType |
| A type definition for this type. More... | |
Public Member Functions | |
| void | disable (void) |
| Disables the reference counting. More... | |
| void | enable (void) |
| Enables the reference counting. More... | |
| ElementType * | get () const throw () |
| JanitorRCDeallocation (const ThisType &j, bool enabled=true) | |
| Constructor with this type. More... | |
| JanitorRCDeallocation (ElementType *target=0, bool enabled=true) | |
| Constructor with an element type. More... | |
| ElementType & | operator* () const |
| ElementType * | operator-> () const |
| JanitorRCDeallocation & | operator= (const JanitorRCDeallocation &rhs) |
| Copy the data from rhs. More... | |
| void | reset (ElementType *p=0) throw () |
| Swaps an element type with this type. More... | |
| void | swap (JanitorRCDeallocation &other) throw () |
| Swaps the current object's variables with an other object's variables. More... | |
| virtual | ~JanitorRCDeallocation () |
| Destructor. More... | |
Private Member Functions | |
| void | addRef (void) |
| Adds a reference to a reference counter. More... | |
| void | removeRef (void) |
| Removes a reference from a reference counter. More... | |
Private Attributes | |
| bool | m_enabled |
| int * | m_refCounter |
| ElementType * | m_target |
Friends | |
| void | swap (JanitorRCDeallocation &first, JanitorRCDeallocation &second) |
| Swaps the two object's variables. More... | |
Reference counting janitor class.
This class can be used to make sure that the associated pointer is deleted/freed when the last janitor for it leaves scope.
Definition at line 1001 of file xsens_janitors.h.
| typedef T xsens::JanitorRCDeallocation< T, DeallocationPolicy >::ElementType |
A type definition for an element type.
Definition at line 1005 of file xsens_janitors.h.
| typedef void(* xsens::JanitorRCDeallocation< T, DeallocationPolicy >::PostDeallocateFunc) () |
A function prototype for a post deallocation function.
Definition at line 1006 of file xsens_janitors.h.
| typedef JanitorRCDeallocation<T, DeallocationPolicy> xsens::JanitorRCDeallocation< T, DeallocationPolicy >::ThisType |
A type definition for this type.
Definition at line 1004 of file xsens_janitors.h.
|
inline |
Constructor with an element type.
Definition at line 1010 of file xsens_janitors.h.
|
inline |
Constructor with this type.
Definition at line 1020 of file xsens_janitors.h.
|
inlinevirtual |
Destructor.
Definition at line 1030 of file xsens_janitors.h.
|
inlineprivate |
Adds a reference to a reference counter.
Definition at line 1121 of file xsens_janitors.h.
|
inline |
Disables the reference counting.
Definition at line 1066 of file xsens_janitors.h.
|
inline |
Enables the reference counting.
Definition at line 1073 of file xsens_janitors.h.
|
inline | |||||||||||||
Definition at line 1080 of file xsens_janitors.h.
|
inline |
Definition at line 1059 of file xsens_janitors.h.
|
inline |
Definition at line 1052 of file xsens_janitors.h.
|
inline |
Copy the data from rhs.
| rhs | The janitor deallication class |
Definition at line 1039 of file xsens_janitors.h.
|
inlineprivate |
Removes a reference from a reference counter.
Definition at line 1134 of file xsens_janitors.h.
|
inline | ||||||||||||||
Swaps an element type with this type.
If no argument is passed the object will be reset
| p | The pointer to an element type |
Definition at line 1110 of file xsens_janitors.h.
|
inline | ||||||||||||||
Swaps the current object's variables with an other object's variables.
| other | The reference to an other object |
Definition at line 1088 of file xsens_janitors.h.
|
friend |
Swaps the two object's variables.
| first | The reference to the first object |
| second | The reference to the second object |
Definition at line 1100 of file xsens_janitors.h.
|
private |
Definition at line 1150 of file xsens_janitors.h.
|
private |
Definition at line 1149 of file xsens_janitors.h.
|
private |
Definition at line 1148 of file xsens_janitors.h.