Version: 8.3.0
SharedPtr< T > Class Template Reference

: Allow to manage memory of instances of T. The only constraint on T is to have method incrRef and DecrRef. Typically T inherits from YACS::ENGINE::RefCounter. More...

#include <SharedPtr.hxx>

Collaboration diagram for SharedPtr< T >:

Public Member Functions

 SharedPtr (T *ptr)
 
 SharedPtr (const SharedPtr< T > &other)
 
SharedPtr< T > & operator= (const SharedPtr< T > &other)
 
T & operator* ()
 
const T & operator* () const
 
T * operator-> ()
 
const T * operator-> () const
 
 ~SharedPtr ()
 
 operator T * ()
 
 operator const T * () const
 
 operator T & ()
 
 operator const T & () const
 
SharedPtr< T > operator[] (int i) const
 
SharedPtr< T > operator[] (const char *key) const
 

Private Attributes

T * _ptr
 

Detailed Description

template<class T>
class SharedPtr< T >

: Allow to manage memory of instances of T. The only constraint on T is to have method incrRef and DecrRef. Typically T inherits from YACS::ENGINE::RefCounter.

Definition at line 29 of file SharedPtr.hxx.

Constructor & Destructor Documentation

template<class T>
SharedPtr< T >::SharedPtr ( T *  ptr)
inline

Definition at line 34 of file SharedPtr.hxx.

34 :_ptr(ptr) { }
template<class T>
SharedPtr< T >::SharedPtr ( const SharedPtr< T > &  other)
inline

Definition at line 35 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

35 :_ptr(other._ptr) { _ptr->incrRef(); }
template<class T>
SharedPtr< T >::~SharedPtr ( )
inline

Definition at line 41 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

41 { _ptr->decrRef(); }

Member Function Documentation

template<class T>
SharedPtr< T >::operator const T & ( ) const
inline

Definition at line 45 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

45 { return *_ptr; }
template<class T>
SharedPtr< T >::operator const T * ( ) const
inline

Definition at line 43 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

43 { return _ptr; }
template<class T>
SharedPtr< T >::operator T & ( )
inline

Definition at line 44 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

44 { return *_ptr; }
template<class T>
SharedPtr< T >::operator T * ( )
inline

Definition at line 42 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

42 { return _ptr; }
template<class T>
T& SharedPtr< T >::operator* ( )
inline

Definition at line 37 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

37 { return *_ptr; }
template<class T>
const T& SharedPtr< T >::operator* ( ) const
inline

Definition at line 38 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

38 { return *_ptr; }
template<class T>
T* SharedPtr< T >::operator-> ( )
inline

Definition at line 39 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

39 { return _ptr; }
template<class T>
const T* SharedPtr< T >::operator-> ( ) const
inline

Definition at line 40 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

40 { return _ptr; }
template<class T >
SharedPtr< T > & SharedPtr< T >::operator= ( const SharedPtr< T > &  other)

Definition at line 51 of file SharedPtr.hxx.

References SharedPtr< T >::_ptr.

52 {
53  _ptr->decrRef();
54  _ptr=other._ptr;
55  _ptr->incrRef();
56  return *this;
57 }
template<class T >
SharedPtr< T > SharedPtr< T >::operator[] ( int  i) const

Definition at line 60 of file SharedPtr.hxx.

References CORBAEngineTest::i.

61 {
62  return (*_ptr)[i];
63 }
template<class T >
SharedPtr< T > SharedPtr< T >::operator[] ( const char *  key) const

Definition at line 66 of file SharedPtr.hxx.

67 {
68  return (*_ptr)[key];
69 }

Member Data Documentation


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