Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

InterfaceID Class Reference

Interface ID class. More...

#include <GaudiKernel/Kernel.h>

List of all members.

Public Member Functions

 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
unsigned long id () const
 get the interface 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

Static Public Member Functions

static 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

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 56 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 65 of file IInterface.h.

00066     : 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 68 of file IInterface.h.

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

InterfaceID::~InterfaceID (  )  [inline]

destructor

Definition at line 71 of file IInterface.h.

00071 { }


Member Function Documentation

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

check full compatibility.

Definition at line 93 of file IInterface.h.

00093                                                  {
00094     return ( id() == iid.id() &&
00095              majorVersion() == iid.majorVersion() &&
00096              minorVersion() == iid.minorVersion() );
00097   }

static unsigned int InterfaceID::hash32 ( const char *  key  )  [inline, static]

one-at-time hash function

Definition at line 101 of file IInterface.h.

00101                                               {
00102     unsigned int hash;
00103     const char* k;
00104     for (hash = 0, k = key; *k; k++) {
00105       hash += *k; hash += (hash << 10); hash ^= (hash >> 6);
00106     }
00107     hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15);
00108     return hash;
00109   }

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

get the interface identifier

Definition at line 79 of file IInterface.h.

00079 { return m_id; }

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

get the major version of the interface

Definition at line 81 of file IInterface.h.

00081 { return m_major_ver; }

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

get the minor version of the interface

Definition at line 83 of file IInterface.h.

00083 { return m_minor_ver; }

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

compare operator

Definition at line 99 of file IInterface.h.

00099 { return fullMatch(iid); }

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

00087                                                     {
00088     return ( id() == iid.id() &&
00089              majorVersion() == iid.majorVersion() &&
00090              minorVersion() >= iid.minorVersion() );
00091   }


Member Data Documentation

unsigned long InterfaceID::m_id [private]

Definition at line 112 of file IInterface.h.

unsigned long InterfaceID::m_major_ver [private]

Definition at line 113 of file IInterface.h.

unsigned long InterfaceID::m_minor_ver [private]

Definition at line 114 of file IInterface.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 9 16:31:07 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004