Version: 9.15.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

◆ SharedPtr() [1/2]

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

Definition at line 34 of file SharedPtr.hxx.

34 :_ptr(ptr) { }

◆ SharedPtr() [2/2]

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

Definition at line 35 of file SharedPtr.hxx.

35 :_ptr(other._ptr) { _ptr->incrRef(); }

References SharedPtr< T >::_ptr.

◆ ~SharedPtr()

template<class T >
SharedPtr< T >::~SharedPtr ( )
inline

Definition at line 41 of file SharedPtr.hxx.

41 { _ptr->decrRef(); }

References SharedPtr< T >::_ptr.

Member Function Documentation

◆ operator const T &()

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

Definition at line 45 of file SharedPtr.hxx.

45 { return *_ptr; }

References SharedPtr< T >::_ptr.

◆ operator const T *()

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

Definition at line 43 of file SharedPtr.hxx.

43 { return _ptr; }

References SharedPtr< T >::_ptr.

◆ operator T&()

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

Definition at line 44 of file SharedPtr.hxx.

44 { return *_ptr; }

References SharedPtr< T >::_ptr.

◆ operator T*()

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

Definition at line 42 of file SharedPtr.hxx.

42 { return _ptr; }

References SharedPtr< T >::_ptr.

◆ operator*() [1/2]

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

Definition at line 37 of file SharedPtr.hxx.

37 { return *_ptr; }

References SharedPtr< T >::_ptr.

◆ operator*() [2/2]

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

Definition at line 38 of file SharedPtr.hxx.

38 { return *_ptr; }

References SharedPtr< T >::_ptr.

◆ operator->() [1/2]

template<class T >
T* SharedPtr< T >::operator-> ( )
inline

Definition at line 39 of file SharedPtr.hxx.

39 { return _ptr; }

References SharedPtr< T >::_ptr.

◆ operator->() [2/2]

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

Definition at line 40 of file SharedPtr.hxx.

40 { return _ptr; }

References SharedPtr< T >::_ptr.

◆ operator=()

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

Definition at line 51 of file SharedPtr.hxx.

52 {
53  _ptr->decrRef();
54  _ptr=other._ptr;
55  _ptr->incrRef();
56  return *this;
57 }

References SharedPtr< T >::_ptr.

◆ operator[]() [1/2]

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 }

◆ operator[]() [2/2]

template<class T >
SharedPtr< T > SharedPtr< T >::operator[] ( int  i) const

Definition at line 60 of file SharedPtr.hxx.

61 {
62  return (*_ptr)[i];
63 }

References yacsorb.CORBAEngineTest::i.

Member Data Documentation

◆ _ptr


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