Rosetta 3.3
Public Types | Public Member Functions | Friends
utility::pointer::access_ptr< T > Class Template Reference

Non-owning access smart pointer. More...

#include <access_ptr.hh>

Collaboration diagram for utility::pointer::access_ptr< T >:
Collaboration graph
[legend]

List of all members.

Public Types

typedefValue
typedef T & Reference
typedef T const & ConstReference
typedef T * Pointer
typedef T const * ConstPointer
typedefvalue_type
typedefelement_type
typedef T & reference
typedef T const & const_reference
typedef T * pointer
typedef T const * const_pointer

Public Member Functions

 access_ptr ()
 Default constructor.
 access_ptr (access_ptr const &a)
 Copy constructor (implicit)
template<typename U >
 access_ptr (access_ptr< U > const &a)
 Assignable copy constructor (implicit)
 access_ptr (pointer object_p)
 Object pointer constructor (implicit)
 access_ptr (reference object)
 Object constructor.
 ~access_ptr ()
 Destructor: Non-owning => doesn't delete object.
access_ptroperator= (access_ptr const &a)
 Copy assignment.
template<typename U >
access_ptroperator= (access_ptr< U > const &a)
 Assignable copy assignment.
access_ptroperator= (pointer object_p)
 Object pointer assignment.
access_ptroperator= (reference object)
 Object assignment.
 operator bool () const
 bool conversion: points to something?
reference operator* () const
 Dereference.
pointer operator-> () const
 Indirection.
pointer operator() () const
 Raw pointer.
bool operator! () const
 Points to nothing? (some compilers need this)
pointer get () const
 Raw pointer.
void reset_to_null ()
 Reset.
void swap (access_ptr &a)
 Swap.

Friends

class access_ptr

Detailed Description

template<typename T>
class utility::pointer::access_ptr< T >

Non-owning access smart pointer.

access_ptr is a simple pointer wrapper that you can't (directly) delete that is meant for pointing to access objects that are not owned. access_ptr objects can be stored in STL containers and are as small and as fast as raw pointers. Deletion of the wrapped pointer is still possible so this is not bulletproof against determined misuse.

Remarks:

The object pointed to by access_ptr need not be allocated on the heap since access_ptr never deletes the object it points to.

Pointers to const objects: access_ptr< Type const >

Virtual functions shouldn't return access_ptr because, like all template-based smart pointers, it doesn't support covariant return types but raw pointer return values can be assigned to access_ptr.

Casts: The cast functions are merely a convenience for access_ptr (unlike for non-intrusive shared ownership pointers) so for:

access_ptr< Base > pB( new Derived() );

the cast:

dynamic_pointer_cast< Derived >( pB );

is equivalent to:

access_ptr< Derived >( dynamic_cast< Derived * >( pB() ) );


Member Typedef Documentation

template<typename T>
typedef T const* utility::pointer::access_ptr< T >::const_pointer
template<typename T>
typedef T const& utility::pointer::access_ptr< T >::const_reference
template<typename T>
typedef T const* utility::pointer::access_ptr< T >::ConstPointer
template<typename T>
typedef T const& utility::pointer::access_ptr< T >::ConstReference
template<typename T>
typedef T utility::pointer::access_ptr< T >::element_type
template<typename T>
typedef T* utility::pointer::access_ptr< T >::pointer
template<typename T>
typedef T* utility::pointer::access_ptr< T >::Pointer
template<typename T>
typedef T& utility::pointer::access_ptr< T >::reference
template<typename T>
typedef T& utility::pointer::access_ptr< T >::Reference
template<typename T>
typedef T utility::pointer::access_ptr< T >::Value
template<typename T>
typedef T utility::pointer::access_ptr< T >::value_type

Constructor & Destructor Documentation

template<typename T>
utility::pointer::access_ptr< T >::access_ptr ( ) [inline]

Default constructor.

template<typename T>
utility::pointer::access_ptr< T >::access_ptr ( access_ptr< T > const &  a) [inline]

Copy constructor (implicit)

template<typename T>
template<typename U >
utility::pointer::access_ptr< T >::access_ptr ( access_ptr< U > const &  a) [inline]

Assignable copy constructor (implicit)

template<typename T>
utility::pointer::access_ptr< T >::access_ptr ( pointer  object_p) [inline]

Object pointer constructor (implicit)

template<typename T>
utility::pointer::access_ptr< T >::access_ptr ( reference  object) [inline, explicit]

Object constructor.

template<typename T>
utility::pointer::access_ptr< T >::~access_ptr ( ) [inline]

Destructor: Non-owning => doesn't delete object.


Member Function Documentation

template<typename T>
pointer utility::pointer::access_ptr< T >::get ( ) const [inline]
template<typename T>
utility::pointer::access_ptr< T >::operator bool ( ) const [inline]

bool conversion: points to something?

Note:
Enables unwanted conversions but work-around has compiler-dependencies
template<typename T>
bool utility::pointer::access_ptr< T >::operator! ( ) const [inline]

Points to nothing? (some compilers need this)

template<typename T>
pointer utility::pointer::access_ptr< T >::operator() ( ) const [inline]

Raw pointer.

template<typename T>
reference utility::pointer::access_ptr< T >::operator* ( ) const [inline]

Dereference.

template<typename T>
pointer utility::pointer::access_ptr< T >::operator-> ( ) const [inline]

Indirection.

template<typename T>
access_ptr& utility::pointer::access_ptr< T >::operator= ( reference  object) [inline]

Object assignment.

template<typename T>
access_ptr& utility::pointer::access_ptr< T >::operator= ( access_ptr< T > const &  a) [inline]

Copy assignment.

template<typename T>
template<typename U >
access_ptr& utility::pointer::access_ptr< T >::operator= ( access_ptr< U > const &  a) [inline]

Assignable copy assignment.

template<typename T>
access_ptr& utility::pointer::access_ptr< T >::operator= ( pointer  object_p) [inline]

Object pointer assignment.

template<typename T>
void utility::pointer::access_ptr< T >::reset_to_null ( ) [inline]

Reset.

template<typename T>
void utility::pointer::access_ptr< T >::swap ( access_ptr< T > &  a) [inline]

Swap.

References PyMOL_demo::po.

Referenced by utility::pointer::swap().


Friends And Related Function Documentation

template<typename T>
friend class access_ptr [friend]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines