#include <UniqueRef.h>
Public Member Functions | |
void * | address () const |
template<class C > | |
UniqueRef< T > & | cast (const UniqueRef< C > &) |
T * | get () const |
bool | isLoaded () const |
boost::shared_ptr< IPtrLoader > & | loader () const |
operator bool () const | |
bool | operator! () const |
template<class C > | |
bool | operator!= (const UniqueRef< C > &aPtr) const |
T & | operator* () const |
T * | operator-> () const |
template<class C > | |
UniqueRef< T > & | operator= (const UniqueRef< C > &) |
UniqueRef< T > & | operator= (const UniqueRef< T > &) |
UniqueRef< T > & | operator= (T *) |
template<class C > | |
bool | operator== (const UniqueRef< C > &aPtr) const |
void | reset () |
boost::shared_ptr< T > & | share () const |
const std::type_info * | typeInfo () const |
UniqueRef (const UniqueRef< T > &) | |
UniqueRef (T *anObject) | |
template<class C > | |
UniqueRef (const UniqueRef< C > &) | |
UniqueRef () | |
virtual | ~UniqueRef () |
Private Member Functions | |
T * | ptr (bool throw_flag) const |
Private Attributes | |
bool | m_isLoaded |
boost::shared_ptr< IPtrLoader > | m_loader |
boost::shared_ptr< T > | m_ptr |
Templated class for the persistency of associated objects. Same features as Ptr (lazy loading) + support of polymorhism .
Definition at line 14 of file UniqueRef.h.
ora::UniqueRef< T >::UniqueRef | ( | ) |
Definition at line 114 of file UniqueRef.h.
: m_ptr(),m_loader(),m_isLoaded(false) {}
ora::UniqueRef< T >::UniqueRef | ( | T * | anObject | ) | [explicit] |
Definition at line 117 of file UniqueRef.h.
: m_ptr(anObject),m_loader(),m_isLoaded(true) {}
ora::UniqueRef< T >::UniqueRef | ( | const UniqueRef< T > & | aPtr | ) |
Definition at line 120 of file UniqueRef.h.
: m_ptr(aPtr.m_ptr),m_loader(aPtr.m_loader),m_isLoaded(false){ }
Definition at line 125 of file UniqueRef.h.
References trackerHits::c, funct::C, and matplotRender::t.
ora::UniqueRef< T >::~UniqueRef | ( | ) | [virtual] |
Definition at line 131 of file UniqueRef.h.
{ }
void * ora::UniqueRef< T >::address | ( | ) | const |
Definition at line 184 of file UniqueRef.h.
{ return m_ptr.get(); }
ora::UniqueRef< T > & ora::UniqueRef< T >::cast | ( | const UniqueRef< C > & | aPtr | ) |
Definition at line 159 of file UniqueRef.h.
References reset().
{ reset(); m_loader = aPtr.loader(); m_ptr = boost::dynamic_pointer_cast(aPtr.share()); m_isLoaded = aPtr.isLoaded(); return *this; }
T * ora::UniqueRef< T >::get | ( | void | ) | const |
Definition at line 175 of file UniqueRef.h.
{ return ptr(false); }
bool ora::UniqueRef< T >::isLoaded | ( | ) | const [inline] |
Definition at line 90 of file UniqueRef.h.
:
boost::shared_ptr<IPtrLoader>& ora::UniqueRef< T >::loader | ( | ) | const [inline] |
Definition at line 85 of file UniqueRef.h.
{
ora::UniqueRef< T >::operator bool | ( | ) | const |
Definition at line 194 of file UniqueRef.h.
{ return ptr(false); }
bool ora::UniqueRef< T >::operator! | ( | ) | const |
Definition at line 198 of file UniqueRef.h.
{ return ptr(false)==0; }
bool ora::UniqueRef< T >::operator!= | ( | const UniqueRef< C > & | aPtr | ) | const [inline] |
Definition at line 75 of file UniqueRef.h.
:
T & ora::UniqueRef< T >::operator* | ( | ) | const |
Definition at line 171 of file UniqueRef.h.
{ return *ptr(true); }
T * ora::UniqueRef< T >::operator-> | ( | ) | const |
Definition at line 167 of file UniqueRef.h.
{ return ptr(true); }
ora::UniqueRef< T > & ora::UniqueRef< T >::operator= | ( | const UniqueRef< T > & | aPtr | ) |
Definition at line 141 of file UniqueRef.h.
References reset().
{ reset(); m_loader = aPtr.m_loader; m_ptr = aPtr.m_ptr; m_isLoaded = aPtr.m_isLoaded; return *this; }
ora::UniqueRef< T > & ora::UniqueRef< T >::operator= | ( | T * | aPtr | ) |
Definition at line 134 of file UniqueRef.h.
References reset().
{ reset(); m_ptr.reset(aPtr); m_isLoaded = true; return *this; }
ora::UniqueRef< T > & ora::UniqueRef< T >::operator= | ( | const UniqueRef< C > & | aPtr | ) |
Definition at line 150 of file UniqueRef.h.
References trackerHits::c, funct::C, reset(), and matplotRender::t.
bool ora::UniqueRef< T >::operator== | ( | const UniqueRef< C > & | aPtr | ) | const [inline] |
Definition at line 71 of file UniqueRef.h.
{
T * ora::UniqueRef< T >::ptr | ( | bool | throw_flag | ) | const [private] |
Definition at line 208 of file UniqueRef.h.
References ora::throwException().
{ if(!m_ptr.get()){ if(!m_loader.get()){ if(throwFlag) throwException("Loader is not installed.", "UniqueRef::ptr()"); } if(!m_isLoaded && m_loader.get()){ m_ptr.reset( static_cast<T*>(m_loader->load())); m_isLoaded = true; } } if(!m_ptr.get()){ if(throwFlag) throwException("Underlying pointer is null.", "UniqueRef::ptr()"); } return m_ptr.get(); }
void ora::UniqueRef< T >::reset | ( | void | ) |
Definition at line 202 of file UniqueRef.h.
{ m_ptr.reset(); m_loader.reset(); m_isLoaded = false; }
boost::shared_ptr< T > & ora::UniqueRef< T >::share | ( | ) | const [inline] |
Definition at line 180 of file UniqueRef.h.
{ return m_ptr; }
const std::type_info * ora::UniqueRef< T >::typeInfo | ( | ) | const |
Definition at line 188 of file UniqueRef.h.
References runTheMatrix::ret.
bool ora::UniqueRef< T >::m_isLoaded [mutable, private] |
Definition at line 108 of file UniqueRef.h.
boost::shared_ptr<IPtrLoader> ora::UniqueRef< T >::m_loader [mutable, private] |
Definition at line 105 of file UniqueRef.h.
boost::shared_ptr<T> ora::UniqueRef< T >::m_ptr [mutable, private] |
Definition at line 102 of file UniqueRef.h.