All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
InterfaceID Class Reference

Interface ID class. More...

#include <GaudiKernel/Kernel.h>

Public Member Functions

 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...
 
 ~InterfaceID ()
 destructor More...
 
unsigned long id () const
 get the interface identifier More...
 
unsigned long majorVersion () const
 get the major version of the interface More...
 
unsigned long minorVersion () const
 get the minor version of the interface More...
 
bool versionMatch (const InterfaceID &iid) const
 check compatibility. More...
 
bool fullMatch (const InterfaceID &iid) const
 check full compatibility. More...
 
bool operator== (const InterfaceID &iid) const
 compare operator More...
 

Static Public Member Functions

static unsigned int hash32 (const char *key)
 one-at-time 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 55 of file IInterface.h.

Constructor & Destructor Documentation

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

constructor from components

Definition at line 64 of file IInterface.h.

65  : m_id( id ), m_major_ver( major ), m_minor_ver( minor ) { }
unsigned long m_id
Definition: IInterface.h:111
unsigned long m_minor_ver
Definition: IInterface.h:113
unsigned long m_major_ver
Definition: IInterface.h:112
InterfaceID::InterfaceID ( const char *  name,
unsigned long  major,
unsigned long  minor = 0 
)
inline

constructor from components

Definition at line 67 of file IInterface.h.

68  : m_id( hash32(name) ), m_major_ver( major ), m_minor_ver( minor ) { }
static unsigned int hash32(const char *key)
one-at-time hash function
Definition: IInterface.h:100
unsigned long m_id
Definition: IInterface.h:111
unsigned long m_minor_ver
Definition: IInterface.h:113
unsigned long m_major_ver
Definition: IInterface.h:112
InterfaceID::~InterfaceID ( )
inline

destructor

Definition at line 70 of file IInterface.h.

70 { }

Member Function Documentation

bool InterfaceID::fullMatch ( const InterfaceID iid) const
inline

check full compatibility.

Definition at line 92 of file IInterface.h.

92  {
93  return ( id() == iid.id() &&
94  majorVersion() == iid.majorVersion() &&
95  minorVersion() == iid.minorVersion() );
96  }
unsigned long id() const
get the interface identifier
Definition: IInterface.h:78
unsigned long majorVersion() const
get the major version of the interface
Definition: IInterface.h:80
unsigned long minorVersion() const
get the minor version of the interface
Definition: IInterface.h:82
static unsigned int InterfaceID::hash32 ( const char *  key)
inlinestatic

one-at-time hash function

Definition at line 100 of file IInterface.h.

100  {
101  unsigned int hash;
102  const char* k;
103  for (hash = 0, k = key; *k; k++) {
104  hash += *k; hash += (hash << 10); hash ^= (hash >> 6);
105  }
106  hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15);
107  return hash;
108  }
unsigned long InterfaceID::id ( ) const
inline

get the interface identifier

Definition at line 78 of file IInterface.h.

78 { return m_id; }
unsigned long m_id
Definition: IInterface.h:111
unsigned long InterfaceID::majorVersion ( ) const
inline

get the major version of the interface

Definition at line 80 of file IInterface.h.

80 { return m_major_ver; }
unsigned long m_major_ver
Definition: IInterface.h:112
unsigned long InterfaceID::minorVersion ( ) const
inline

get the minor version of the interface

Definition at line 82 of file IInterface.h.

82 { return m_minor_ver; }
unsigned long m_minor_ver
Definition: IInterface.h:113
bool InterfaceID::operator== ( const InterfaceID iid) const
inline

compare operator

Definition at line 98 of file IInterface.h.

98 { return fullMatch(iid); }
bool fullMatch(const InterfaceID &iid) const
check full compatibility.
Definition: IInterface.h:92
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 86 of file IInterface.h.

86  {
87  return ( id() == iid.id() &&
88  majorVersion() == iid.majorVersion() &&
89  minorVersion() >= iid.minorVersion() );
90  }
unsigned long id() const
get the interface identifier
Definition: IInterface.h:78
unsigned long majorVersion() const
get the major version of the interface
Definition: IInterface.h:80
unsigned long minorVersion() const
get the minor version of the interface
Definition: IInterface.h:82

Member Data Documentation

unsigned long InterfaceID::m_id
private

Definition at line 111 of file IInterface.h.

unsigned long InterfaceID::m_major_ver
private

Definition at line 112 of file IInterface.h.

unsigned long InterfaceID::m_minor_ver
private

Definition at line 113 of file IInterface.h.


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