#include <nub/ref.h>
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 () |
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.
T* nub::soft_ref< T >::get | ( | ) | const [inline] |
Returns the pointee, or if throws an exception if there is not a valid pointee.
Definition at line 274 of file ref.h.
Referenced by JunctionChannel::doInput(), MSTChannel::doInput(), MyBeoChipListener::event(), BeoSubOneBal::getBallasts(), BeoSubOneBal::getFrontBallast(), BeoSubOneBal::getRearBallast(), getSalRegions(), main(), nub::ref< RetinaConfigurator >::operator<(), BeobotVisualCortex::process(), and BeoSubBallast::set().
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<().
bool nub::soft_ref< T >::operator< | ( | const soft_ref< T > & | other | ) | const throw () [inline] |
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().