| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
InterfaceID Class Referencefinal

Interface ID class. More...

`#include <GaudiKernel/Kernel.h>`

## Public Member Functions
constexpr | InterfaceID (unsigned long id, unsigned long major, unsigned long minor=0)
| constructor from components More...
| InterfaceID (const char *name, unsigned long major, unsigned long minor=0)
| constructor from components More...
constexpr unsigned long | id () const
| get the interface identifier More...
constexpr unsigned long | majorVersion () const
| get the major version of the interface More...
constexpr unsigned long | minorVersion () const
| get the minor version of the interface More...
constexpr bool | versionMatch (const InterfaceID &iid) const
| check compatibility. More...
constexpr bool | fullMatch (const InterfaceID &iid) const
| check full compatibility. More...
constexpr bool | operator== (const InterfaceID &iid) const
| compare operator More...

## Static Public Member Functions
static unsigned int | hash32 (const char *key)
| Jenkins one-at-time hash function – see https://en.wikipedia.org/wiki/Jenkins_hash_function. More...

## Private Attributes
unsigned long | m_id
unsigned long | m_major_ver
unsigned long | m_minor_ver

## 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 29 of file IInterface.h.

## Constructor & Destructor Documentation

## ◆ InterfaceID() [1/2]

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

constructor from components

Definition at line 37 of file IInterface.h.

38 : m_id( id ), m_major_ver( major ), m_minor_ver( minor ) {}
InterfaceID::m_id
unsigned long m_id
Definition: IInterface.h:79
InterfaceID::m_minor_ver
unsigned long m_minor_ver
Definition: IInterface.h:81
InterfaceID::m_major_ver
unsigned long m_major_ver
Definition: IInterface.h:80

## ◆ InterfaceID() [2/2]

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

constructor from components

Definition at line 40 of file IInterface.h.

41 : m_id( hash32( name ) ), m_major_ver( major ), m_minor_ver( minor ) {}
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
InterfaceID::hash32
static unsigned int hash32(const char *key)
Jenkins one-at-time hash function – see https://en.wikipedia.org/wiki/Jenkins_hash_function.
Definition: IInterface.h:65
InterfaceID::m_id
unsigned long m_id
Definition: IInterface.h:79
InterfaceID::m_minor_ver
unsigned long m_minor_ver
Definition: IInterface.h:81
InterfaceID::m_major_ver
unsigned long m_major_ver
Definition: IInterface.h:80

## Member Function Documentation

## ◆ fullMatch()

constexpr bool InterfaceID::fullMatch | ( | const InterfaceID & | iid | ) | const
| inline

check full compatibility.

Definition at line 59 of file IInterface.h.

59 {
60 return ( id() == iid.id() && majorVersion() == iid.majorVersion() && minorVersion() == iid.minorVersion() );
61 }
InterfaceID::id
constexpr unsigned long id() const
get the interface identifier
Definition: IInterface.h:47
InterfaceID::majorVersion
constexpr unsigned long majorVersion() const
get the major version of the interface
Definition: IInterface.h:49
InterfaceID::minorVersion
constexpr unsigned long minorVersion() const
get the minor version of the interface
Definition: IInterface.h:51

## ◆ hash32()

static unsigned int InterfaceID::hash32 | ( | const char * | key | ) |
| inline static

Jenkins one-at-time hash function – see https://en.wikipedia.org/wiki/Jenkins_hash_function.

Definition at line 65 of file IInterface.h.

65 {
66 unsigned int hash = 0;
67 for ( const char* k = key; *k; ++k ) {
68 hash += *k;
69 hash += ( hash << 10 );
70 hash ^= ( hash >> 6 );
71 }
72 hash += ( hash << 3 );
73 hash ^= ( hash >> 11 );
74 hash += ( hash << 15 );
75 return hash;
76 }

## ◆ id()

constexpr unsigned long InterfaceID::id | ( |  | ) | const
| inline

get the interface identifier

Definition at line 47 of file IInterface.h.

47 { return m_id; }
InterfaceID::m_id
unsigned long m_id
Definition: IInterface.h:79

## ◆ majorVersion()

constexpr unsigned long InterfaceID::majorVersion | ( |  | ) | const
| inline

get the major version of the interface

Definition at line 49 of file IInterface.h.

49 { return m_major_ver; }
InterfaceID::m_major_ver
unsigned long m_major_ver
Definition: IInterface.h:80

## ◆ minorVersion()

constexpr unsigned long InterfaceID::minorVersion | ( |  | ) | const
| inline

get the minor version of the interface

Definition at line 51 of file IInterface.h.

51 { return m_minor_ver; }
InterfaceID::m_minor_ver
unsigned long m_minor_ver
Definition: IInterface.h:81

## ◆ operator==()

constexpr bool InterfaceID::operator== | ( | const InterfaceID & | iid | ) | const
| inline

compare operator

Definition at line 63 of file IInterface.h.

63 { return fullMatch( iid ); }
InterfaceID::fullMatch
constexpr bool fullMatch(const InterfaceID &iid) const
check full compatibility.
Definition: IInterface.h:59

## ◆ versionMatch()

constexpr 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 55 of file IInterface.h.

55 {
56 return ( id() == iid.id() && majorVersion() == iid.majorVersion() && minorVersion() >= iid.minorVersion() );
57 }
InterfaceID::id
constexpr unsigned long id() const
get the interface identifier
Definition: IInterface.h:47
InterfaceID::majorVersion
constexpr unsigned long majorVersion() const
get the major version of the interface
Definition: IInterface.h:49
InterfaceID::minorVersion
constexpr unsigned long minorVersion() const
get the minor version of the interface
Definition: IInterface.h:51

## Member Data Documentation

## ◆ m_id

unsigned long InterfaceID::m_id
| private

Definition at line 79 of file IInterface.h.

## ◆ m_major_ver

unsigned long InterfaceID::m_major_ver
| private

Definition at line 80 of file IInterface.h.

## ◆ m_minor_ver

unsigned long InterfaceID::m_minor_ver
| private

Definition at line 81 of file IInterface.h.

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

- GaudiKernel/GaudiKernel/IInterface.h