ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
IdentifierHashTable< T > Class Template Reference

#include <IdentifierHashTable.h>

Collaboration diagram for IdentifierHashTable< T >:

Public Types

typedef T::IdentifierType IdType
 define the type IdType More...
 
typedef T::HashType HashType
 define the type HashType More...
 

Public Member Functions

 IdentifierHashTable ()
 Default constructor makes empty hash table with default idFields object. More...
 
 IdentifierHashTable (const T &idFields)
 Make empty hash table initialised with idFields object. More...
 
void clear ()
 Clear the hashtable. More...
 
unsigned int size () const
 Number of hashes in the table. More...
 
bool checkValidity () const
 Check that the table is internally consistent. More...
 
HashType addEntry (const IdType &id)
 Add an identifier to the table. More...
 
HashType getHash (const IdType &id) const
 Get hash from 0 to size()-1. More...
 
IdType getIdentifier (const HashType &hash) const
 Get identifier from hash. More...
 
void dump (std::ostream &os=std::cout) const
 Dump complete table to output stream. More...
 
std::string dumpToString () const
 Dump complete table into a string. More...
 

Static Public Member Functions

static HashType defaultHashValue ()
 Helper function to get a properly initialised hash. More...
 

Private Attributes

IdentifierToHash< T > m_idToHash
 
std::vector< IdTypem_hashToId
 

Detailed Description

template<class T>
class IdentifierHashTable< T >

Definition at line 37 of file IdentifierHashTable.h.

Member Typedef Documentation

◆ HashType

template<class T >
typedef T::HashType IdentifierHashTable< T >::HashType

define the type HashType

Definition at line 45 of file IdentifierHashTable.h.

◆ IdType

template<class T >
typedef T::IdentifierType IdentifierHashTable< T >::IdType

define the type IdType

Definition at line 43 of file IdentifierHashTable.h.

Constructor & Destructor Documentation

◆ IdentifierHashTable() [1/2]

template<class T >
IdentifierHashTable< T >::IdentifierHashTable ( )

Default constructor makes empty hash table with default idFields object.

◆ IdentifierHashTable() [2/2]

template<class T >
IdentifierHashTable< T >::IdentifierHashTable ( const T &  idFields)
explicit

Make empty hash table initialised with idFields object.

Member Function Documentation

◆ addEntry()

template<class T >
HashType IdentifierHashTable< T >::addEntry ( const IdType id)

Add an identifier to the table.

Return the assigned hash. If adding the entry fails, a default HashType is returned.

◆ checkValidity()

template<class T >
bool IdentifierHashTable< T >::checkValidity ( ) const

Check that the table is internally consistent.

An empty table will return false.

◆ clear()

template<class T >
void IdentifierHashTable< T >::clear ( )

Clear the hashtable.

◆ defaultHashValue()

template<class T >
static HashType IdentifierHashTable< T >::defaultHashValue ( )
inlinestatic

Helper function to get a properly initialised hash.

Definition at line 47 of file IdentifierHashTable.h.

47  {
49  }

◆ dump()

template<class T >
void IdentifierHashTable< T >::dump ( std::ostream &  os = std::cout) const

Dump complete table to output stream.

◆ dumpToString()

template<class T >
std::string IdentifierHashTable< T >::dumpToString ( ) const

Dump complete table into a string.

◆ getHash()

template<class T >
HashType IdentifierHashTable< T >::getHash ( const IdType id) const

Get hash from 0 to size()-1.

Returns invalid hash if id is not in table.

◆ getIdentifier()

template<class T >
IdType IdentifierHashTable< T >::getIdentifier ( const HashType hash) const

Get identifier from hash.

Returns invalid identifier if hash is out of range.

◆ size()

template<class T >
unsigned int IdentifierHashTable< T >::size ( ) const

Number of hashes in the table.

Member Data Documentation

◆ m_hashToId

template<class T >
std::vector<IdType> IdentifierHashTable< T >::m_hashToId
private

Definition at line 76 of file IdentifierHashTable.h.

◆ m_idToHash

template<class T >
IdentifierToHash<T> IdentifierHashTable< T >::m_idToHash
private

Definition at line 75 of file IdentifierHashTable.h.


The documentation for this class was generated from the following file:
IdentifierToHash::defaultHashValue
static HashType defaultHashValue()
Helper function to get a properly initialised hash.
Definition: IdentifierToHash.h:62