g2o
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
g2o::ScopedPointer< T, Del > Class Template Reference

a scoped pointer for an objectarray, i.e., object will be deleted on leaving the scope More...

#include <scoped_pointer.h>

Public Member Functions

 ScopedPointer (T *t=0)
 
 ~ScopedPointer ()
 
T & operator* () const
 dereference the pointer More...
 
T * operator-> () const
 access the pointer via -> More...
 
T * get () const
 return the pointer More...
 
void reset (T *p)
 
void swap (ScopedPointer &b)
 

Protected Attributes

T * _pointer
 

Private Member Functions

 ScopedPointer (const ScopedPointer &)
 
const ScopedPointeroperator= (const ScopedPointer &)
 

Detailed Description

template<typename T, typename Del = ScopedPointerDeleter>
class g2o::ScopedPointer< T, Del >

a scoped pointer for an objectarray, i.e., object will be deleted on leaving the scope

Definition at line 46 of file scoped_pointer.h.

Constructor & Destructor Documentation

template<typename T , typename Del = ScopedPointerDeleter>
g2o::ScopedPointer< T, Del >::ScopedPointer ( T *  t = 0)
inline

Definition at line 49 of file scoped_pointer.h.

49 : _pointer(t) {}
template<typename T , typename Del = ScopedPointerDeleter>
g2o::ScopedPointer< T, Del >::~ScopedPointer ( )
inline

Definition at line 51 of file scoped_pointer.h.

52  {
53  Del deleter;
54  deleter(_pointer);
55  }
template<typename T , typename Del = ScopedPointerDeleter>
g2o::ScopedPointer< T, Del >::ScopedPointer ( const ScopedPointer< T, Del > &  )
private

Member Function Documentation

template<typename T , typename Del = ScopedPointerDeleter>
T* g2o::ScopedPointer< T, Del >::get ( ) const
inline

return the pointer

Definition at line 62 of file scoped_pointer.h.

62 { return _pointer;}
template<typename T , typename Del = ScopedPointerDeleter>
T& g2o::ScopedPointer< T, Del >::operator* ( ) const
inline

dereference the pointer

Definition at line 58 of file scoped_pointer.h.

58 { return *_pointer;}
template<typename T , typename Del = ScopedPointerDeleter>
T* g2o::ScopedPointer< T, Del >::operator-> ( ) const
inline

access the pointer via ->

Definition at line 60 of file scoped_pointer.h.

60 { return _pointer;}
template<typename T , typename Del = ScopedPointerDeleter>
const ScopedPointer& g2o::ScopedPointer< T, Del >::operator= ( const ScopedPointer< T, Del > &  )
private
template<typename T , typename Del = ScopedPointerDeleter>
void g2o::ScopedPointer< T, Del >::reset ( T *  p)
inline

store another pointer inside

Definition at line 67 of file scoped_pointer.h.

68  {
69  assert((p == 0 || p != _pointer) && "ScopedPointer should not reset with itself");
70  ScopedPointer aux(p);
71  swap(aux);
72  }
void swap(ScopedPointer &b)
template<typename T , typename Del = ScopedPointerDeleter>
void g2o::ScopedPointer< T, Del >::swap ( ScopedPointer< T, Del > &  b)
inline

swap with another pointer

Definition at line 77 of file scoped_pointer.h.

References g2o::ScopedPointer< T, Del >::_pointer.

78  {
79  T* aux = b._pointer;
80  b._pointer = _pointer;
81  _pointer = aux;
82  }

Member Data Documentation

template<typename T , typename Del = ScopedPointerDeleter>
T* g2o::ScopedPointer< T, Del >::_pointer
protected

Definition at line 85 of file scoped_pointer.h.

Referenced by g2o::ScopedPointer< T, Del >::swap().


The documentation for this class was generated from the following file: