| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

SmartIF< IInterface > Class Template Reference

Smart pointer to handle IInterface interfaces. More...

#include <SmartIF.h>

Inheritance diagram for SmartIF< IInterface >:

[legend]
Collaboration diagram for SmartIF< IInterface >:
[legend]
List of all members.

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
bool isValid () const
 Allow for check if smart pointer is valid.
 operator IInterface * ()
 Automatic conversion to constined interface type.
 operator const IInterface * () const
 Automatic conversion to constined interface type (CONST).
bool operator!= (const IInterface *test) const
 Check for non-equality.
bool operator== (const IInterface *test) const
 Check for equality.
IInterfaceoperator-> ()
 Dereference operator.
const IInterfaceoperator-> () const
 Dereference operator (CONST).
void ** operator & ()
 Allow for use as void pointer.
const IInterfaceget ()
 Get reference to interface pointer.
IInterface *& pRef ()
 Get reference to interface pointer.
const IInterface *const & pRef () const
 Get reference to interface pointer (CONST).

Protected Member Functions

void releaseInterface ()
 Release interface.

Protected Attributes

const InterfaceID m_iid
IInterfacem_interface

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.


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.

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()) ; }

void SmartIFBase< IInterface >::releaseInterface (  )  [inline, protected, inherited]

Release interface.

Definition at line 36 of file SmartIF.h.

00036                             {
00037     if ( m_interface ) m_interface->release();
00038     m_interface = 0;
00039   }

bool SmartIFBase< IInterface >::isValid (  )  const [inline, inherited]

Allow for check if smart pointer is valid.

Definition at line 49 of file SmartIF.h.

00049                            {
00050     return ( 0 != m_interface );
00051   }

SmartIFBase< IInterface >::operator IInterface * (  )  [inline, inherited]

Automatic conversion to constined interface type.

Definition at line 53 of file SmartIF.h.

00053                       {
00054     return m_interface;
00055   }

SmartIFBase< IInterface >::operator const IInterface * (  )  const [inline, inherited]

Automatic conversion to constined interface type (CONST).

Definition at line 57 of file SmartIF.h.

00057                                   {
00058     return m_interface;
00059   }

bool SmartIFBase< IInterface >::operator!= ( const IInterface test  )  const [inline, inherited]

Check for non-equality.

Definition at line 61 of file SmartIF.h.

00061                                                {
00062     return test != m_interface;
00063   }

bool SmartIFBase< IInterface >::operator== ( const IInterface test  )  const [inline, inherited]

Check for equality.

Definition at line 65 of file SmartIF.h.

00065                                                {
00066     return test == m_interface;
00067   }

IInterface * SmartIFBase< IInterface >::operator-> (  )  [inline, inherited]

Dereference operator.

Definition at line 69 of file SmartIF.h.

00069                         {
00070     return m_interface;
00071   }

const IInterface * SmartIFBase< IInterface >::operator-> (  )  const [inline, inherited]

Dereference operator (CONST).

Definition at line 73 of file SmartIF.h.

00073                                    {
00074     return m_interface;
00075   }

void** SmartIFBase< IInterface >::operator & (  )  [inline, inherited]

Allow for use as void pointer.

Definition at line 77 of file SmartIF.h.

00077                          {
00078     return (void**) &m_interface;
00079   }

const IInterface * SmartIFBase< IInterface >::get (  )  [inline, inherited]

Get reference to interface pointer.

Definition at line 81 of file SmartIF.h.

00081                     {
00082     return m_interface;
00083   }

IInterface *& SmartIFBase< IInterface >::pRef (  )  [inline, inherited]

Get reference to interface pointer.

Definition at line 85 of file SmartIF.h.

00085                 {
00086     return this->m_interface;
00087   }

const IInterface * const& SmartIFBase< IInterface >::pRef (  )  const [inline, inherited]

Get reference to interface pointer (CONST).

Definition at line 89 of file SmartIF.h.

00089                                     {
00090     return this->m_interface;
00091   }


Member Data Documentation

const InterfaceID SmartIFBase< IInterface >::m_iid [protected, inherited]

Definition at line 33 of file SmartIF.h.

IInterface * SmartIFBase< IInterface >::m_interface [protected, inherited]

Definition at line 34 of file SmartIF.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:14 2011 for GaudiKernel by doxygen 1.4.7