CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ora::Handle< T > Class Template Reference

#include <Handle.h>

List of all members.

Public Member Functions

void clear ()
Tget () const
 Handle ()
 Handle (T *ptr)
 Handle (const Handle< T > &rhs)
 operator bool () const
bool operator! () const
Toperator* () const
Toperator-> () const
Handleoperator= (const Handle< T > &rhs)
void reset (T *ptr)
 ~Handle ()

Private Member Functions

void validate () const

Private Attributes

boost::shared_ptr< Holder< T > > m_holder

Detailed Description

template<typename T>
class ora::Handle< T >

Definition at line 20 of file Handle.h.


Constructor & Destructor Documentation

template<typename T >
Handle::Handle ( ) [inline]

Definition at line 77 of file Handle.h.

                    :
  m_holder( new Holder<T>() ){
}
template<typename T>
Handle::Handle ( T ptr) [inline, explicit]

Definition at line 83 of file Handle.h.

                          :
  m_holder( new Holder<T>( ptr ) ){
}
template<typename T>
Handle::Handle ( const Handle< T > &  rhs) [inline]

Definition at line 89 of file Handle.h.

                                          :
  m_holder( rhs.m_holder ){
}
template<typename T >
Handle::~Handle ( ) [inline]

Definition at line 95 of file Handle.h.

                     {
}

Member Function Documentation

template<typename T >
void Handle::clear ( void  ) [inline]

Definition at line 153 of file Handle.h.

                        {
  if(m_holder.get()) m_holder->ptr.reset();
} 
template<typename T >
T * Handle::get ( void  ) const [inline]

Definition at line 147 of file Handle.h.

Referenced by ora::Handle< T >::operator bool().

                           {
  return m_holder->ptr.get();  
}
template<typename T >
Handle::operator bool ( ) const [inline]

Definition at line 135 of file Handle.h.

References ora::Handle< T >::get().

                                   {
  return m_holder->ptr.get()!=0;  
}
template<typename T >
bool Handle::operator! ( ) const [inline]

Definition at line 141 of file Handle.h.

                                   {
  return m_holder->ptr.get()==0;  
}
template<typename T >
T & Handle::operator* ( ) const [inline]

Definition at line 128 of file Handle.h.

                                 {
  validate();
  return *m_holder->ptr.get();
}
template<typename T >
T * Handle::operator-> ( ) const [inline]

Definition at line 121 of file Handle.h.

                                  {
  validate();
  return m_holder->ptr.get();
}
template<typename T>
ora::Handle< T > & Handle::operator= ( const Handle< T > &  rhs) [inline]

Definition at line 100 of file Handle.h.

References ora::Handle< T >::m_holder.

                                                           {
  m_holder = rhs.m_holder;
  return *this;
}
template<typename T>
void Handle::reset ( T ptr) [inline]

Definition at line 107 of file Handle.h.

Referenced by ora::DatabaseContainer::iteratorBuffer().

                                {
  m_holder.reset( new Holder<T>( ptr ) );
}
template<typename T >
void Handle::validate ( ) const [inline, private]

Definition at line 113 of file Handle.h.

References ora::throwException().

                                 {
  if(!m_holder->ptr.get()) {
    throwException( "Handle is not valid.",typeid(Handle<T>),"validate");
  }
}

Member Data Documentation

template<typename T>
boost::shared_ptr< Holder<T> > ora::Handle< T >::m_holder [private]

Definition at line 54 of file Handle.h.

Referenced by ora::Handle< T >::operator=().