Back to index

salome-gui  6.5.0
Public Member Functions | Private Attributes | Friends
SmartPtr< T > Class Template Reference

Template class that provides automatic casting for hold RefCount based objects. More...

#include <SUIT_SmartPtr.h>

List of all members.

Public Member Functions

 SmartPtr ()
 default constructor
template<class Y >
 SmartPtr (Y *y_)
 constructor from any RefCount-based class
template<class Y >
 SmartPtr (const SmartPtr< Y > &y_)
 copy constructor from any RefCount-based class
 SmartPtr (const SmartPtr &t_)
 copy constructor
virtual ~SmartPtr (void)
 destructor
T & operator* () const
 return *pointer
T * operator-> () const
 return pointer
 operator T * () const
 return pointer
T * get () const
 return pointer
template<class Y >
SmartPtroperator= (const SmartPtr< Y > &y_)
 assignment
SmartPtroperator= (const SmartPtr &t_)
SmartPtroperator= (T *p_)
int operator== (const SmartPtr &t_)
 comparing
int operator== (const T *p_)
 comparing
int operator!= (SmartPtr &t_)
 comparing
int operator!= (T *p_)
 comparing
void nullify ()
 nullify
bool isNull () const
 check for null

Private Attributes

T * p
 stored pointer

Friends

int operator== (const T *p_, const SmartPtr &t_)
 comparing
int operator!= (T *p_, SmartPtr &t_)
 comparing

Detailed Description

template<class T>
class SmartPtr< T >

Template class that provides automatic casting for hold RefCount based objects.

Definition at line 60 of file SUIT_SmartPtr.h.


Constructor & Destructor Documentation

template<class T>
SmartPtr< T >::SmartPtr ( ) [inline]

default constructor

Definition at line 63 of file SUIT_SmartPtr.h.

: p( 0 ) {}
template<class T>
template<class Y >
SmartPtr< T >::SmartPtr ( Y *  y_) [inline]

constructor from any RefCount-based class

Definition at line 65 of file SUIT_SmartPtr.h.

{ p = dynamic_cast<T*>( y_ ); if ( p ) p->upcount(); }
template<class T>
template<class Y >
SmartPtr< T >::SmartPtr ( const SmartPtr< Y > &  y_) [inline]

copy constructor from any RefCount-based class

Definition at line 67 of file SUIT_SmartPtr.h.

{ p = dynamic_cast<T*>( y_.get() ); if ( p ) p->upcount(); }

Here is the call graph for this function:

template<class T>
SmartPtr< T >::SmartPtr ( const SmartPtr< T > &  t_) [inline]

copy constructor

Definition at line 69 of file SUIT_SmartPtr.h.

: p( t_.p ) { if ( p ) p->upcount();   }
template<class T>
virtual SmartPtr< T >::~SmartPtr ( void  ) [inline, virtual]

destructor

Definition at line 71 of file SUIT_SmartPtr.h.

  { 
    if ( p )
      p->downcount(); 
  }

Member Function Documentation

template<class T>
T* SmartPtr< T >::get ( ) const [inline]

return pointer

Definition at line 81 of file SUIT_SmartPtr.h.

Here is the caller graph for this function:

template<class T>
bool SmartPtr< T >::isNull ( ) const [inline]

check for null

Definition at line 117 of file SUIT_SmartPtr.h.

{ return p == 0; }
template<class T>
void SmartPtr< T >::nullify ( ) [inline]

nullify

Definition at line 115 of file SUIT_SmartPtr.h.

{ if ( p ) p->downcount(); p = 0; }
template<class T>
SmartPtr< T >::operator T * ( ) const [inline]

return pointer

Definition at line 80 of file SUIT_SmartPtr.h.

template<class T>
int SmartPtr< T >::operator!= ( SmartPtr< T > &  t_) [inline]

comparing

Definition at line 110 of file SUIT_SmartPtr.h.

template<class T>
int SmartPtr< T >::operator!= ( T *  p_) [inline]

comparing

Definition at line 111 of file SUIT_SmartPtr.h.

template<class T>
T& SmartPtr< T >::operator* ( ) const [inline]

return *pointer

Definition at line 78 of file SUIT_SmartPtr.h.

template<class T>
T* SmartPtr< T >::operator-> ( ) const [inline]

return pointer

Definition at line 79 of file SUIT_SmartPtr.h.

template<class T>
template<class Y >
SmartPtr& SmartPtr< T >::operator= ( const SmartPtr< Y > &  y_) [inline]

assignment

Definition at line 84 of file SUIT_SmartPtr.h.

  { 
    if ( this == &y_) return *this;
    return operator=( y_.get() );
  }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
SmartPtr& SmartPtr< T >::operator= ( const SmartPtr< T > &  t_) [inline]

assignment

Definition at line 90 of file SUIT_SmartPtr.h.

Here is the call graph for this function:

template<class T>
SmartPtr& SmartPtr< T >::operator= ( T *  p_) [inline]

Definition at line 96 of file SUIT_SmartPtr.h.

  {
    if ( p )
      p->downcount(); 
    p = p_; 
    if ( p )
      p->upcount(); 
    return *this;
  }
template<class T>
int SmartPtr< T >::operator== ( const SmartPtr< T > &  t_) [inline]

comparing

Definition at line 107 of file SUIT_SmartPtr.h.

template<class T>
int SmartPtr< T >::operator== ( const T *  p_) [inline]

comparing

Definition at line 108 of file SUIT_SmartPtr.h.


Friends And Related Function Documentation

template<class T>
int operator!= ( T *  p_,
SmartPtr< T > &  t_ 
) [friend]

comparing

Definition at line 112 of file SUIT_SmartPtr.h.

template<class T>
int operator== ( const T *  p_,
const SmartPtr< T > &  t_ 
) [friend]

comparing

Definition at line 109 of file SUIT_SmartPtr.h.


Member Data Documentation

template<class T>
T* SmartPtr< T >::p [private]

stored pointer

Definition at line 120 of file SUIT_SmartPtr.h.


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