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

#include <IdentifierHashCalc.h>

Collaboration diagram for IdentifierHashCalc< T >:

Public Types

enum  { NFIELDS = T::NFIELDS, NMAX =UINT_MAX }
 N is the number of fields to use from the identifier NMAX is just to make sure we get unsigned int type of enum. More...
 
typedef T IdFieldsType
 define the type IdFieldsType More...
 
typedef T::IdentifierType IdType
 define the type IdType More...
 
typedef T::HashType HashType
 define the type HashType More...
 

Public Member Functions

 IdentifierHashCalc ()
 Default constructor makes empty hash table. More...
 
 IdentifierHashCalc (const T &idFields)
 Make empty table with pointer set to external idHelper, which will be transmitted to the constructor of class T. 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...
 
bool addEntry (const IdType &id)
 Add an identifier to the table. More...
 
void setFieldLimits (unsigned int fieldIndex, int fieldMin, int fieldMax)
 Set the limits of a specific field. More...
 
HashType getHash (const IdType &id) const
 Get hash from 0 to size()-1. More...
 
IdType getIdentifier (const HashType &idHash) 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...
 

Private Member Functions

bool isInRange (const T &idFields) const
 
void update ()
 

Private Attributes

int m_fieldsMin [NFIELDS]
 
int m_fieldsMax [NFIELDS]
 
unsigned int m_fieldsSize [NFIELDS]
 
unsigned int m_fieldsFactor [NFIELDS]
 
m_idFields
 

Detailed Description

template<class T>
class IdentifierHashCalc< T >

Definition at line 29 of file IdentifierHashCalc.h.

Member Typedef Documentation

◆ HashType

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

define the type HashType

Definition at line 43 of file IdentifierHashCalc.h.

◆ IdFieldsType

template<class T >
typedef T IdentifierHashCalc< T >::IdFieldsType

define the type IdFieldsType

Definition at line 39 of file IdentifierHashCalc.h.

◆ IdType

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

define the type IdType

Definition at line 41 of file IdentifierHashCalc.h.

Member Enumeration Documentation

◆ anonymous enum

template<class T >
anonymous enum

N is the number of fields to use from the identifier NMAX is just to make sure we get unsigned int type of enum.

Enumerator
NFIELDS 
NMAX 

Definition at line 37 of file IdentifierHashCalc.h.

37 { NFIELDS = T::NFIELDS, NMAX=UINT_MAX };

Constructor & Destructor Documentation

◆ IdentifierHashCalc() [1/2]

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

Default constructor makes empty hash table.

◆ IdentifierHashCalc() [2/2]

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

Make empty table with pointer set to external idHelper, which will be transmitted to the constructor of class T.

Member Function Documentation

◆ addEntry()

template<class T >
bool IdentifierHashCalc< T >::addEntry ( const IdType id)

Add an identifier to the table.

◆ checkValidity()

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

Check that the table is internally consistent.

An empty table will return false.

◆ clear()

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

Clear the hashtable.

◆ dump()

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

Dump complete table to output stream.

◆ dumpToString()

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

Dump complete table into a string.

◆ getHash()

template<class T >
HashType IdentifierHashCalc< 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 IdentifierHashCalc< T >::getIdentifier ( const HashType idHash) const

Get identifier from hash.

Returns invalid identifier if hash is out of range.

◆ isInRange()

template<class T >
bool IdentifierHashCalc< T >::isInRange ( const T &  idFields) const
private

◆ setFieldLimits()

template<class T >
void IdentifierHashCalc< T >::setFieldLimits ( unsigned int  fieldIndex,
int  fieldMin,
int  fieldMax 
)

Set the limits of a specific field.

◆ size()

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

Number of hashes in the table.

◆ update()

template<class T >
void IdentifierHashCalc< T >::update ( )
private

Member Data Documentation

◆ m_fieldsFactor

template<class T >
unsigned int IdentifierHashCalc< T >::m_fieldsFactor[NFIELDS]
private

Definition at line 76 of file IdentifierHashCalc.h.

◆ m_fieldsMax

template<class T >
int IdentifierHashCalc< T >::m_fieldsMax[NFIELDS]
private

Definition at line 74 of file IdentifierHashCalc.h.

◆ m_fieldsMin

template<class T >
int IdentifierHashCalc< T >::m_fieldsMin[NFIELDS]
private

Definition at line 73 of file IdentifierHashCalc.h.

◆ m_fieldsSize

template<class T >
unsigned int IdentifierHashCalc< T >::m_fieldsSize[NFIELDS]
private

Definition at line 75 of file IdentifierHashCalc.h.

◆ m_idFields

template<class T >
T IdentifierHashCalc< T >::m_idFields
mutableprivate

Definition at line 77 of file IdentifierHashCalc.h.


The documentation for this class was generated from the following file:
IdentifierHashCalc::NMAX
@ NMAX
Definition: IdentifierHashCalc.h:37
IdentifierHashCalc::NFIELDS
@ NFIELDS
Definition: IdentifierHashCalc.h:37