| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# InterfaceID Class Reference

`#include <GaudiKernel/Kernel.h>`

List of all members.

## Detailed Description

Interface ID class.

It consists of several fields: interface number, major version number and minor version number. Interface number should be allocated globally. The major and minor version numbers are used for checking compatibility between interface versions.

Author:
  Pere Mato

  Sebastien Ponce

Definition at line 22 of file IInterface.h.

## Public Member Functions
| InterfaceID (unsigned long lid)
| constructor from a pack long
| InterfaceID (unsigned long id, unsigned long major, unsigned long minor=0)
| constructor from components
| InterfaceID (const char *name, unsigned long major, unsigned long minor=0)
| constructor from components
| ~InterfaceID ()
| destructor
| operator unsigned long () const
| conversion to unsigned long
unsigned long | id () const
| get the interfac identifier
unsigned long | majorVersion () const
| get the major version of the interface
unsigned long | minorVersion () const
| get the minor version of the interface
bool | versionMatch (const InterfaceID &iid) const
| check compatibility.
bool | fullMatch (const InterfaceID &iid) const
| check full compatibility.
bool | operator== (const InterfaceID &iid) const
| compare operator
unsigned int | hash32 (const char *key)
| one-at-time hash function
## Private Attributes
unsigned long | m_id
unsigned long | m_major_ver
unsigned long | m_minor_ver
## Friends
std::ostream & | operator<< (std::ostream &, const InterfaceID &)
| ostream operator for InterfaceID. Needed by PluginSvc

## Constructor & Destructor Documentation

InterfaceID::InterfaceID | ( | unsigned long | lid | ) | `[inline]`

constructor from a pack long

Definition at line 25 of file IInterface.h.

    00025                                    : m_id( lid & 0xFFFF ),
    00026                                      m_major_ver( (lid & 0xFF000000)>>24 ),
    00027                                      m_minor_ver( (lid & 0xFF0000)>> 16 ) { }

InterfaceID::InterfaceID | ( | unsigned long | id,
|  | unsigned long | major,
|  | unsigned long | minor = `0` |
| ) |  |  | `[inline]`

constructor from components

Definition at line 29 of file IInterface.h.

    00030     : m_id( id ), m_major_ver( major ), m_minor_ver( minor ) { }

InterfaceID::InterfaceID | ( | const char * | name,
|  | unsigned long | major,
|  | unsigned long | minor = `0` |
| ) |  |  | `[inline]`

constructor from components

Definition at line 32 of file IInterface.h.

    00033     : m_id( hash32(name) ), m_major_ver( major ), m_minor_ver( minor ) { }

InterfaceID::~InterfaceID | ( |  | ) | `[inline]`

destructor

Definition at line 35 of file IInterface.h.

    00035 { }

## Member Function Documentation

InterfaceID::operator unsigned long | ( |  | ) | const`[inline]`

conversion to unsigned long

Definition at line 37 of file IInterface.h.

References m_id, m_major_ver, and m_minor_ver.

    00037                                  {
    00038     return (m_major_ver << 24) + (m_minor_ver << 16) + m_id;
    00039   }

unsigned long InterfaceID::id | ( |  | ) | const`[inline]`

get the interfac identifier

Definition at line 41 of file IInterface.h.

References m_id.

Referenced by fullMatch(), and versionMatch().

    00041 { return m_id; }

unsigned long InterfaceID::majorVersion | ( |  | ) | const`[inline]`

get the major version of the interface

Definition at line 43 of file IInterface.h.

References m_major_ver.

Referenced by fullMatch(), and versionMatch().

    00043 { return m_major_ver; }

unsigned long InterfaceID::minorVersion | ( |  | ) | const`[inline]`

get the minor version of the interface

Definition at line 45 of file IInterface.h.

References m_minor_ver.

Referenced by fullMatch(), and versionMatch().

    00045 { return m_minor_ver; }

bool InterfaceID::versionMatch | ( | const InterfaceID & | iid | ) | const`[inline]`

check compatibility.

The major version is check and the minor one should be bigger or equal

Definition at line 49 of file IInterface.h.

References id(), majorVersion(), and minorVersion().

Referenced by DetDataSvc::queryInterface(), DataSvc::queryInterface(), Converter::queryInterface(), and ConversionSvc::queryInterface().

    00049                                                     {
    00050     return ( id() == iid.id() &&
    00051              majorVersion() == iid.majorVersion() &&
    00052              minorVersion() >= iid.minorVersion() );
    00053   }

bool InterfaceID::fullMatch | ( | const InterfaceID & | iid | ) | const`[inline]`

check full compatibility.

Definition at line 55 of file IInterface.h.

References id(), majorVersion(), and minorVersion().

Referenced by operator==().

    00055                                                  {
    00056     return ( id() == iid.id() &&
    00057              majorVersion() == iid.majorVersion() &&
    00058              minorVersion() == iid.minorVersion() );
    00059   }

bool InterfaceID::operator== | ( | const InterfaceID & | iid | ) | const`[inline]`

compare operator

Definition at line 61 of file IInterface.h.

References fullMatch().

    00061 { return fullMatch(iid); }

unsigned int InterfaceID::hash32 | ( | const char * | key | ) | `[inline]`

one-at-time hash function

Definition at line 63 of file IInterface.h.

    00063                                        {
    00064     unsigned int hash;
    00065     const char* k;
    00066     for (hash = 0, k = key; *k; k++) {
    00067       hash += *k; hash += (hash << 10); hash ^= (hash >> 6);
    00068     }
    00069     hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15);
    00070     return hash;
    00071   }

## Friends And Related Function Documentation

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

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 }

## Member Data Documentation

unsigned long InterfaceID::m_id`[private]`

Definition at line 74 of file IInterface.h.

Referenced by id(), and operator unsigned long().

unsigned long InterfaceID::m_major_ver`[private]`

Definition at line 75 of file IInterface.h.

Referenced by majorVersion(), and operator unsigned long().

unsigned long InterfaceID::m_minor_ver`[private]`

Definition at line 76 of file IInterface.h.

Referenced by minorVersion(), and operator unsigned long().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/GaudiKernel/IInterface.h