Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Private Member Functions | Private Attributes
Arc::AutoPointer< T > Class Template Reference

Wrapper for pointer with automatic destruction. More...

#include <Utils.h>

List of all members.

Public Member Functions

 AutoPointer (void)
 NULL pointer constructor.
 AutoPointer (T *o)
 Constructor which wraps pointer.
 ~AutoPointer (void)
 Destructor destroys wrapped object using delete()
Toperator* (void) const
 For refering wrapped object.
Toperator-> (void) const
 For refering wrapped object.
 operator bool (void) const
 Returns false if pointer is NULL and true otherwise.
bool operator! (void) const
 Returns true if pointer is NULL and false otherwise.
 operator T * (void) const
 Cast to original pointer.

Private Member Functions

void operator= (const AutoPointer< T > &)
void operator= (T *)
 AutoPointer (const AutoPointer &)

Private Attributes

Tobject

Detailed Description

template<typename T>
class Arc::AutoPointer< T >

Wrapper for pointer with automatic destruction.

If ordinary pointer is wrapped in instance of this class it will be automatically destroyed when instance is destroyed. This is useful for maintaing pointers in scope of one function. Only pointers returned by new() are supported.

Definition at line 34 of file Utils.h.


Constructor & Destructor Documentation

template<typename T>
Arc::AutoPointer< T >::AutoPointer ( const AutoPointer< T > &  ) [inline, private]

Definition at line 39 of file Utils.h.

      : object(NULL) {}
template<typename T>
Arc::AutoPointer< T >::AutoPointer ( void  ) [inline]

NULL pointer constructor.

Definition at line 43 of file Utils.h.

      : object(NULL) {}
template<typename T>
Arc::AutoPointer< T >::AutoPointer ( T o) [inline]

Constructor which wraps pointer.

Definition at line 46 of file Utils.h.

      : object(o) {}
template<typename T>
Arc::AutoPointer< T >::~AutoPointer ( void  ) [inline]

Destructor destroys wrapped object using delete()

Definition at line 49 of file Utils.h.

                       {
      if (object)
        delete object;
    }

Member Function Documentation

template<typename T>
Arc::AutoPointer< T >::operator bool ( void  ) const [inline]

Returns false if pointer is NULL and true otherwise.

Definition at line 62 of file Utils.h.

                              {
      return (object != NULL);
    }
template<typename T>
Arc::AutoPointer< T >::operator T * ( void  ) const [inline]

Cast to original pointer.

Definition at line 70 of file Utils.h.

                            {
      return object;
    }
template<typename T>
bool Arc::AutoPointer< T >::operator! ( void  ) const [inline]

Returns true if pointer is NULL and false otherwise.

Definition at line 66 of file Utils.h.

                               {
      return (object == NULL);
    }
template<typename T>
T& Arc::AutoPointer< T >::operator* ( void  ) const [inline]

For refering wrapped object.

Definition at line 54 of file Utils.h.

                             {
      return *object;
    }
template<typename T>
T* Arc::AutoPointer< T >::operator-> ( void  ) const [inline]

For refering wrapped object.

Definition at line 58 of file Utils.h.

                              {
      return object;
    }
template<typename T>
void Arc::AutoPointer< T >::operator= ( const AutoPointer< T > &  ) [inline, private]

Definition at line 37 of file Utils.h.

{}
template<typename T>
void Arc::AutoPointer< T >::operator= ( T ) [inline, private]

Definition at line 38 of file Utils.h.

{}

Member Data Documentation

template<typename T>
T* Arc::AutoPointer< T >::object [private]

Definition at line 36 of file Utils.h.


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