| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# SmartIF< IInterface > Class Template Reference

`#include <SmartIF.h>`

Inheritance diagram for SmartIF< IInterface >:

[legend]
Collaboration diagram for SmartIF< IInterface >:

[legend]

List of all members.

## Detailed Description

### template<>
class SmartIF< IInterface >

Smart pointer to handle IInterface interfaces.

Description: The smart pointer to IInterface is a little bit special, mainly because the IInterface is contained in any other interface. Hence, the exported methodes are only a subset of the generic template.

Base Class: SmartIFBase<TYPE>

History :

        +---------+----------------------------------------------+--------+
        |    Date |                 Comment                      | Who    |
        +---------+----------------------------------------------+--------+
        | 30/10/99| Initial version.                             | MF     |
        +---------+----------------------------------------------+--------+

Author: M.Frank Version: 1.0

Definition at line 228 of file SmartIF.h.

## Public Types
typedef IInterface | TYPE
## Public Member Functions
| SmartIF (const SmartIF< IInterface > &copy)
| Copy constructor.
| SmartIF (IInterface *iface=0)
| Standard constructor with initialisation.
template<class T>
| SmartIF (const SmartIF< T > &right)
| Constructor from other SmartIF.
virtual | ~SmartIF ()
| Standard Destructor.
template<class T>
SmartIF< TYPE > & | operator= (const SmartIF< T > &iface)
| Copy assignment operator with conversion to requested interface type.
SmartIF< TYPE > & | operator= (const SmartIF< TYPE > &iface)
| Copy assignment operator.
SmartIF< TYPE > & | operator= (TYPE *iface)
| Assignment operator.
bool | operator! () const
| check the validity of the interface

## Member Typedef Documentation

typedef IInterface SmartIF< IInterface >::TYPE

Definition at line 230 of file SmartIF.h.

## Constructor & Destructor Documentation

SmartIF< IInterface >::SmartIF | ( | const SmartIF< IInterface > & | copy | ) | `[inline]`

Copy constructor.

Definition at line 232 of file SmartIF.h.

    00233     : SmartIFBase<IInterface>(copy.m_iid)
    00234   {
    00235     SmartIF<TYPE>::operator=(copy.m_interface);
    00236   }

SmartIF< IInterface >::SmartIF | ( | IInterface * | iface = `0` | ) | `[inline]`

Standard constructor with initialisation.

Definition at line 238 of file SmartIF.h.

    00239   : SmartIFBase<IInterface>(IID_IInterface)
    00240   {
    00241     SmartIF<TYPE>::operator=(iface);
    00242   }

template<class T>

SmartIF< IInterface >::SmartIF | ( | const SmartIF< T > & | right | ) | `[inline]`

Constructor from other SmartIF.

Definition at line 245 of file SmartIF.h.

    00246     : SmartIFBase<IInterface>(IID_IInterface)
    00247   {
    00248     SmartIF<TYPE>::operator=(right.m_interface);
    00249   }

virtual SmartIF< IInterface >::~SmartIF | ( |  | ) | `[inline, virtual]`

Standard Destructor.

Definition at line 251 of file SmartIF.h.

    00251                         {
    00252   }

## Member Function Documentation

template<class T>

SmartIF<TYPE>& SmartIF< IInterface >::operator= | ( | const SmartIF< T > & | iface | ) | `[inline]`

Copy assignment operator with conversion to requested interface type.

Definition at line 255 of file SmartIF.h.

    00256   {
    00257     T* ptr = iface.m_interface ;
    00258     if ( (void*)ptr != (void*)this->m_interface )   {
    00259       TYPE* newIF = 0;
    00260       if ( ptr != 0 )   {
    00261         ptr->queryInterface(this->m_iid, (void**)&newIF).ignore();
    00262       }
    00263       this->releaseInterface();
    00264       this->m_interface = newIF;
    00265     }
    00266     return *this;
    00267   }

SmartIF<TYPE>& SmartIF< IInterface >::operator= | ( | const SmartIF< TYPE > & | iface | ) | `[inline]`

Copy assignment operator.

Definition at line 269 of file SmartIF.h.

    00269                                                             {
    00270     TYPE* newIF = iface.m_interface ;
    00271     return (*this)=newIF ;
    00272   }

SmartIF<TYPE>& SmartIF< IInterface >::operator= | ( | TYPE * | iface | ) | `[inline]`

Assignment operator.

Definition at line 274 of file SmartIF.h.

    00274                                             {
    00275     if ( iface != m_interface )   {
    00276       if ( iface != 0 )   {
    00277         iface->addRef();
    00278       }
    00279       releaseInterface();
    00280       m_interface = iface;
    00281     }
    00282     return *this;
    00283   }

bool SmartIF< IInterface >::operator! | ( |  | ) | const`[inline]`

check the validity of the interface

Reimplemented from SmartIFBase< IInterface >.

Definition at line 285 of file SmartIF.h.

    00285 { return !(this->isValid()) ; }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r3/GaudiKernel/GaudiKernel/SmartIF.h