oasys::ScopePtr< _Class > Class Template Reference

#include <Pointers.h>

List of all members.


Detailed Description

template<typename _Class>
class oasys::ScopePtr< _Class >

NOTE: Used only for things that are created which need to be deleted when exiting a scope.

Note how the * operator returns a _reference_ to the stored pointer. This template is mainly used to clean up call site regions where the functions allocate memory and take a double pointer as an argument, which makes it impossible to use a std::auto_ptr.

Definition at line 17 of file Pointers.h.

Public Member Functions

 ScopePtr ()
 ScopePtr (_Class *obj)
 ~ScopePtr ()
_Class & operator * () const
_Class * operator-> () const
ScopePtroperator= (_Class *ptr)
 Assignment operator that ensures there is no currently assigned pointer before claiming the given one.
_Class *& ptr ()
 This construction basically allows you to pass the ptr_ to a double pointer taking function, cleaning up the syntax quite a bit.
ScopePtroperator= (const ScopePtr &)
 Not implemented on purpose.

Private Attributes

_Class * ptr_


Constructor & Destructor Documentation

template<typename _Class>
oasys::ScopePtr< _Class >::ScopePtr (  )  [inline]

Definition at line 19 of file Pointers.h.

template<typename _Class>
oasys::ScopePtr< _Class >::ScopePtr ( _Class *  obj  )  [inline]

Definition at line 20 of file Pointers.h.

template<typename _Class>
oasys::ScopePtr< _Class >::~ScopePtr (  )  [inline]

Definition at line 21 of file Pointers.h.

References oasys::ScopePtr< _Class >::ptr_.


Member Function Documentation

template<typename _Class>
_Class& oasys::ScopePtr< _Class >::operator * (  )  const [inline]

Definition at line 23 of file Pointers.h.

References oasys::ScopePtr< _Class >::ptr_.

template<typename _Class>
_Class* oasys::ScopePtr< _Class >::operator-> (  )  const [inline]

Definition at line 24 of file Pointers.h.

References oasys::ScopePtr< _Class >::ptr_.

template<typename _Class>
ScopePtr& oasys::ScopePtr< _Class >::operator= ( _Class *  ptr  )  [inline]

Assignment operator that ensures there is no currently assigned pointer before claiming the given one.

Definition at line 30 of file Pointers.h.

References ASSERT, and oasys::ScopePtr< _Class >::ptr_.

template<typename _Class>
_Class*& oasys::ScopePtr< _Class >::ptr (  )  [inline]

This construction basically allows you to pass the ptr_ to a double pointer taking function, cleaning up the syntax quite a bit.

Definition at line 41 of file Pointers.h.

References oasys::ScopePtr< _Class >::ptr_.

template<typename _Class>
ScopePtr& oasys::ScopePtr< _Class >::operator= ( const ScopePtr< _Class > &   ) 

Not implemented on purpose.

Don't handle assignment to another ScopePtr


Member Data Documentation

template<typename _Class>
_Class* oasys::ScopePtr< _Class >::ptr_ [private]

Definition at line 50 of file Pointers.h.

Referenced by oasys::ScopePtr< _Class >::operator *(), oasys::ScopePtr< _Class >::operator->(), oasys::ScopePtr< _Class >::operator=(), oasys::ScopePtr< _Class >::ptr(), and oasys::ScopePtr< _Class >::~ScopePtr().


The documentation for this class was generated from the following file:
Generated on Fri Dec 22 14:48:08 2006 for DTN Reference Implementation by  doxygen 1.5.1