nub::soft_ref< T > Class Template Reference

#include <nub/ref.h>

List of all members.

Public Member Functions

 soft_ref (nub::uid i, ref_type tp=STRONG)
 soft_ref (T *master, ref_type tp=STRONG, ref_vis vis=DEFAULT)
template<class U >
 soft_ref (const soft_ref< U > &other)
template<class U >
 soft_ref (const ref< U > &other)
void reset (T *p=0)
 Shorthand for assignment.
T * get () const
T * operator-> () const
T & operator* () const
T * get_weak () const throw ()
ref_type get_ref_type () const throw ()
bool is_valid () const throw ()
bool is_invalid () const throw ()
bool operator== (const soft_ref &other) const throw ()
bool operator!= (const soft_ref &other) const throw ()
bool operator< (const soft_ref &other) const throw ()
 Comparison operator for sorting, to insert in std::map or std::set, etc.
nub::uid id () const throw ()
T * getWeak () const throw ()
bool isValid () const throw ()
bool isInvalid () const throw ()

Detailed Description

template<class T>
class nub::soft_ref< T >

nub::soft_ref<T> is a ref-counted smart pointer (like nub::ref<T>) for holding ref_counted objects. Construction of a nub::soft_ref<T> is guaranteed not to fail. Because of this, however, a nub::soft_ref<T> is not guaranteed to always point to a valid object (this must be tested with is_valid() before dereferencing). With these characteristics, a nub::soft_ref<T> can be used with volatile ref_counted objects for which only weak references are available.

Definition at line 231 of file ref.h.


Member Function Documentation

template<class T>
T* nub::soft_ref< T >::get (  )  const [inline]
template<class T>
T* nub::soft_ref< T >::get_weak (  )  const throw () [inline]

Returns the pointee, or returns null if there is not a valid pointee. Will not throw an exception.

Definition at line 281 of file ref.h.

Referenced by ModelComponent::getParent(), and nub::soft_ref< SC8000 >::operator<().

template<class T>
bool nub::soft_ref< T >::operator< ( const soft_ref< T > &  other  )  const throw () [inline]

Comparison operator for sorting, to insert in std::map or std::set, etc.

Definition at line 295 of file ref.h.

template<class T>
void nub::soft_ref< T >::reset ( T *  p = 0  )  [inline]

Shorthand for assignment.

Given ref<T> rr and T* p, then rr.reset(p) is shorthand for rr=ref<T>(p). But of course, rr.reset(p) is much less typing if T happens to be spelt SomeLongType<WithTemplateParams>.

Definition at line 270 of file ref.h.

Referenced by BeoSubOneBal::BeoSubOneBal(), SingleChannelBeoServer::check(), SDLdisplayStream::closeStream(), getSalRegions(), main(), VisualCortexConfigurator::paramChanged(), TigsInputFrameSeries::paramChanged(), FrameGrabberConfigurator::paramChanged(), SDLdisplayStream::SDLdisplayStream(), and SDLdisplayStream::writeFrame().


The documentation for this class was generated from the following file:
Generated on Sun May 8 08:44:40 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3