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

# IInterface.h File Reference

`#include "GaudiKernel/Kernel.h"`
`#include "GaudiKernel/StatusCode.h"`
`#include <ostream>`

Include dependency graph for IInterface.h:

Go to the source code of this file.

## Classes
class | InterfaceID
| Interface ID class. More...
class | IInterface
| Definition of the basic interface. More...
## Functions
static const InterfaceID | IID_IInterface (1, 0, 0)
| Typedef for backward compatibility on existing code.
template<class I>
bool | isValidInterface (I *i)
| Templated function that throws an exception if the version if the interface implemented by the object behind the interface is incompatible.
std::ostream & | operator<< (std::ostream &s, const InterfaceID &id)
| ostream operator for InterfaceID. Needed by PluginSvc
template<class DEST, class SRC>
DEST ** | pp_cast (SRC **ptr)
| Small function to be used instead of the construct (void**)&pointer, which produces, on gcc 4.1 optimized, the warning <quote>warning: dereferencing type-punned pointer will break strict-aliasing rules</quote> The assempler code produced is equivalent to the one with the direct cast.

## Function Documentation

static const InterfaceID IID_IInterface | ( | 1 | ,
|  | 0 | ,
|  | 0 |  |
| ) |  |  | `[static]`

Typedef for backward compatibility on existing code.

template<class I>

bool isValidInterface | ( | I * | i | ) | `[inline]`

Templated function that throws an exception if the version if the interface implemented by the object behind the interface is incompatible.

This is the case if the major version differs or that the minor version of the client is bigger than of the implementer.

Author:
  Pere Mato

Definition at line 133 of file IInterface.h.

    00133                              {
    00134   void* ii;
    00135   StatusCode sc =  i->queryInterface( I::interfaceID(), &ii);
    00136   return sc.isSuccess();
    00137 }

std::ostream& operator<< | ( | std::ostream & | s,
|  | const InterfaceID & | id |
| ) |  |  | `[inline]`

ostream operator for InterfaceID. Needed by PluginSvc

Definition at line 140 of file IInterface.h.

    00140                                                                        {
    00141     s << "IID_" << id.m_id;
    00142     return s;
    00143 }

template<class DEST, class SRC>

DEST** pp_cast | ( | SRC ** | ptr | ) | `[inline]`

Small function to be used instead of the construct (void**)&pointer, which produces, on gcc 4.1 optimized, the warning <quote>warning: dereferencing type-punned pointer will break strict-aliasing rules</quote> The assempler code produced is equivalent to the one with the direct cast.

The function can be used als to replace the construct (IInterface *&)m_MySvc. Replacement rules:

`(void**)&pointer` | `pp_cast<void>(&pointer)`
`(IInterface *&)m_mySvc` | `*pp_cast<IInterface>(&m_mySvc)`

Definition at line 156 of file IInterface.h.

    00156                                 {
    00157   return reinterpret_cast<DEST**>(ptr);
    00158 }