#include <GaudiKernel/Kernel.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 |
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.
Sebastien Ponce
Definition at line 22 of file IInterface.h.
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] |
InterfaceID::operator unsigned long | ( | ) | const [inline] |
conversion to unsigned long
Definition at line 37 of file IInterface.h.
00037 { 00038 return (m_major_ver << 24) + (m_minor_ver << 16) + m_id; 00039 }
unsigned long InterfaceID::id | ( | ) | const [inline] |
unsigned long InterfaceID::majorVersion | ( | ) | const [inline] |
get the major version of the interface
Definition at line 43 of file IInterface.h.
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.
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.
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.
00055 { 00056 return ( id() == iid.id() && 00057 majorVersion() == iid.majorVersion() && 00058 minorVersion() == iid.minorVersion() ); 00059 }
bool InterfaceID::operator== | ( | const InterfaceID & | iid | ) | const [inline] |
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 }
std::ostream& operator<< | ( | std::ostream & | s, | |
const InterfaceID & | id | |||
) | [friend] |
unsigned long InterfaceID::m_id [private] |
Definition at line 74 of file IInterface.h.
unsigned long InterfaceID::m_major_ver [private] |
Definition at line 75 of file IInterface.h.
unsigned long InterfaceID::m_minor_ver [private] |
Definition at line 76 of file IInterface.h.