Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

VOS::vRef< T > Class Template Reference

This is a "smart pointer" wrapper class around any RefCounted object. More...

#include <refcount.hh>

List of all members.

Public Member Functions


Detailed Description

template<class T>
class VOS::vRef< T >

This is a "smart pointer" wrapper class around any RefCounted object.

vRef automatically releases its contained object when it goes out of scope (i.e., when it is destroyed). Almost every function in VOS that returns a RefCounted object (e.g. any MetaObject or Vobject) increments that object's reference count before doing so. This means that you must use this class to store that object, or manually call RefCounted::release() on the object when you are done using it.

Note that this class takes care of releasing your object automatically, not acquiring it. For example, if you assign (with =) a pointer (or another vRef) from some vRef and then store that pointer (or other vRef) beyond the life of the original vRef object, its reference count will be incorrect: call acquire() on the object when you store the pointer (or other vRef).

However, the copy constructor does acquire the RefCounted object.

For more discussion and examples, see the VOS manual and the tutorial programs (in "apps/tutorials").

Definition at line 235 of file refcount.hh.


Constructor & Destructor Documentation

template<class T>
VOS::vRef< T >::vRef  )  [inline]
 

Definition at line 240 of file refcount.hh.

template<class T>
VOS::vRef< T >::vRef T *  x  )  [inline]
 

Definition at line 241 of file refcount.hh.

template<class T>
VOS::vRef< T >::vRef T &  x  )  [inline]
 

Definition at line 242 of file refcount.hh.

template<class T>
VOS::vRef< T >::vRef const vRef< T > &  x  )  [inline]
 

Definition at line 243 of file refcount.hh.

template<class T>
VOS::vRef< T >::~vRef  )  [inline]
 

Definition at line 244 of file refcount.hh.


Member Function Documentation

template<class T>
void VOS::vRef< T >::acquire  )  [inline]
 

Definition at line 263 of file refcount.hh.

Referenced by VOS::RemoteSocketSite::flushIncomingBuffers(), VOS::VobjectImplementation::insertChild(), and VOS::VobjectImplementation::setChild().

template<class T>
T* VOS::vRef< T >::operator &  )  [inline]
 

Definition at line 261 of file refcount.hh.

template<class T>
T& VOS::vRef< T >::operator *  )  [inline]
 

Definition at line 259 of file refcount.hh.

template<class T>
bool VOS::vRef< T >::operator!= const vRef< T > &  x  )  [inline]
 

Definition at line 257 of file refcount.hh.

template<class T>
T* VOS::vRef< T >::operator->  )  [inline]
 

Definition at line 260 of file refcount.hh.

template<class T>
vRef<T>& VOS::vRef< T >::operator= const vRef< T > &  x  )  [inline]
 

Definition at line 249 of file refcount.hh.

template<class T>
T& VOS::vRef< T >::operator= T &  x  )  [inline]
 

Definition at line 247 of file refcount.hh.

template<class T>
T* VOS::vRef< T >::operator= T *  x  )  [inline]
 

Definition at line 246 of file refcount.hh.

template<class T>
bool VOS::vRef< T >::operator== const vRef< T > &  x  )  [inline]
 

Definition at line 256 of file refcount.hh.

template<class T>
void VOS::vRef< T >::release  )  [inline]
 

Definition at line 264 of file refcount.hh.

Referenced by VOS::VobjectImplementation::removeChild().


The documentation for this class was generated from the following file:
Generated on Tue Aug 12 03:56:08 2003 for Interreality Project - VOS by doxygen 1.3.2