#include <AutoRef.h>
Public Types | |
| typedef NodeType | element_type |
| The type of the encapsulated Node. | |
Public Member Functions | |
| AutoRef (NodeType *n=0) throw () | |
| Constructor. | |
| AutoRef (const AutoRef< NodeType > &ar) throw () | |
| Copy constructor. | |
| template<class Y> | |
| AutoRef (const AutoRef< Y > &ar) throw () | |
| Copy constructor from other type of AutoRef. | |
| AutoRef< NodeType > & | operator= (const AutoRef< NodeType > &ar) throw () |
| Assignment operator. | |
| template<class Y> | |
| AutoRef< NodeType > & | operator= (const AutoRef< Y > &ar) throw () |
| Assignment operator for other type of AutoRef. | |
| NodeType & | operator * () const throw () |
| Returns what the encapsulated Node * points to. | |
| NodeType * | operator-> () const throw () |
| Returns the encapsulated Node pointer. | |
| NodeType * | get () const throw () |
| Returns the encapsulated Node pointer. | |
| void | reset (NodeType *p=0) throw () |
| Change the Node pointer that is encapsulated. | |
Protected Member Functions | |
| virtual void | ref (NodeType *n) |
| This function is called when a Node * is to be held by the AutoRef. | |
| virtual void | unref (NodeType *n) |
| This function is called when a Node * is released by the AutoRef. | |
Protected Attributes | |
| NodeType * | node_ptr |
It will keep a reference to the Node pointer it encapsulates, i.e. ref() will be called. When destructed the AutoRef does not delete the pointer, but instead unreferences the Node (if this causes the reference count for the Node to go down to 0 then it will be deleted though).
|
||||||||||
|
This function is called when a Node * is to be held by the AutoRef. It increments the reference counter of the Node by calling the ref() function. Subclasses can override this function in order to get specialized behaviour.
|
|
||||||||||
|
Change the Node pointer that is encapsulated. Will cause an unref on the current Node * and a ref on the new.
|
|
||||||||||
|
This function is called when a Node * is released by the AutoRef. It decrements the reference counter of the Node by calling the unref() function. Subclasses can override this function in order to get specialized behaviour.
|
1.4.5