test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ora::Handle< T > Class Template Reference

#include <Handle.h>

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.

77  :
78  m_holder( new Holder<T>() ){
79 }
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T>
Handle::Handle ( T ptr)
inlineexplicit

Definition at line 83 of file Handle.h.

83  :
84  m_holder( new Holder<T>( ptr ) ){
85 }
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T>
Handle::Handle ( const Handle< T > &  rhs)
inline

Definition at line 89 of file Handle.h.

89  :
90  m_holder( rhs.m_holder ){
91 }
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T >
Handle::~Handle ( )
inline

Definition at line 95 of file Handle.h.

95  {
96 }

Member Function Documentation

template<typename T >
void Handle::clear ( void  )
inline
template<typename T >
T * Handle::get ( ) const
inline
template<typename T >
Handle::operator bool ( ) const
inline

Definition at line 135 of file Handle.h.

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

135  {
136  return m_holder->ptr.get()!=0;
137 }
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T >
bool Handle::operator! ( ) const
inline

Definition at line 141 of file Handle.h.

141  {
142  return m_holder->ptr.get()==0;
143 }
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T >
T & Handle::operator* ( ) const
inline

Definition at line 128 of file Handle.h.

128  {
129  validate();
130  return *m_holder->ptr.get();
131 }
void validate() const
Definition: Handle.h:113
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T >
T * Handle::operator-> ( ) const
inline

Definition at line 121 of file Handle.h.

121  {
122  validate();
123  return m_holder->ptr.get();
124 }
void validate() const
Definition: Handle.h:113
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
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.

100  {
101  m_holder = rhs.m_holder;
102  return *this;
103 }
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T>
void Handle::reset ( T ptr)
inline

Definition at line 107 of file Handle.h.

Referenced by MatrixReader.MatrixReader::__init__(), data_sources.json_list::next(), and MatrixReader.MatrixReader::showRaw().

107  {
108  m_holder.reset( new Holder<T>( ptr ) );
109 }
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54
template<typename T >
void Handle::validate ( ) const
inlineprivate

Definition at line 113 of file Handle.h.

References ora::throwException().

113  {
114  if(!m_holder->ptr.get()) {
115  throwException( "Handle is not valid.",typeid(Handle<T>),"validate");
116  }
117 }
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
boost::shared_ptr< Holder< T > > m_holder
Definition: Handle.h:54

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=().