ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
IdHashTableHelper< N, ID, HASH > Class Template Reference

Helper base class for instantiation of templated class IdentifierHashTable. More...

#include <IdHashTableHelper.h>

Collaboration diagram for IdHashTableHelper< N, ID, HASH >:

Public Types

enum  { NFIELDS = N, NMAX =UINT_MAX }
 N is the number of fields to use from the identifier. More...
 
typedef ID IdentifierType
 define type IdentifierType More...
 
typedef HASH HashType
 define type HashType More...
 
typedef HASH ValueType
 needed for MultiDimArray<> instantiation More...
 

Public Member Functions

 IdHashTableHelper ()
 Default constructor. More...
 
 IdHashTableHelper (const IdentifierType &id)
 Constructor to initialise identifier. More...
 
 IdHashTableHelper (int fields[N])
 Constructor to initialise fields. More...
 
virtual ~IdHashTableHelper ()
 virtual destructor needed because of derivation More...
 
const IdentifierTypegetId () const
 Get the identifier. More...
 
void setId (const IdentifierType &id)
 Set (only) the identifier. More...
 
int operator[] (unsigned int fieldIndex) const
 Return the value encoded in field. More...
 
void setField (int index, int value)
 Set field at index to value. More...
 
void setFields (int fields[N])
 Set fields from array. More...
 

Static Public Member Functions

static void setDefaults (const IdentifierType &defId, const HashType &defHash)
 Set the default (invalid) values for identifier and hash. More...
 
static bool isValid (const IdentifierType &)
 
static HashType defaultHash ()
 Returns default (=invalid) hash. More...
 
static IdentifierType defaultIdentifier ()
 Return default (=invalid) identifier. More...
 
static ValueType defaultValue ()
 Return default hash. More...
 

Private Attributes

IdentifierType m_id
 
int m_fields [N]
 

Static Private Attributes

static IdentifierType s_defaultId
 
static HashType s_defaultHash
 

Detailed Description

template<unsigned int N, class ID, class HASH>
class IdHashTableHelper< N, ID, HASH >

Helper base class for instantiation of templated class IdentifierHashTable.

Definition at line 24 of file IdHashTableHelper.h.

Member Typedef Documentation

◆ HashType

template<unsigned int N, class ID , class HASH >
typedef HASH IdHashTableHelper< N, ID, HASH >::HashType

define type HashType

Definition at line 42 of file IdHashTableHelper.h.

◆ IdentifierType

template<unsigned int N, class ID , class HASH >
typedef ID IdHashTableHelper< N, ID, HASH >::IdentifierType

define type IdentifierType

Definition at line 40 of file IdHashTableHelper.h.

◆ ValueType

template<unsigned int N, class ID , class HASH >
typedef HASH IdHashTableHelper< N, ID, HASH >::ValueType

needed for MultiDimArray<> instantiation

Definition at line 44 of file IdHashTableHelper.h.

Member Enumeration Documentation

◆ anonymous enum

template<unsigned int N, class ID , class HASH >
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 38 of file IdHashTableHelper.h.

73 :
74  //

Constructor & Destructor Documentation

◆ IdHashTableHelper() [1/3]

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::IdHashTableHelper
inline

Default constructor.

Identifier and fields are set to invalid.

Definition at line 87 of file IdHashTableHelper.h.

87  {
88  for ( unsigned int i = 0; i < N; ++i ) m_fields[i] = INT_MAX;
89 }

◆ IdHashTableHelper() [2/3]

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::IdHashTableHelper ( const IdentifierType id)
explicit

Constructor to initialise identifier.

Fields are set to invalid.

◆ IdHashTableHelper() [3/3]

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::IdHashTableHelper ( int  fields[N])
inlineexplicit

Constructor to initialise fields.

Identifier is invalid.

Definition at line 101 of file IdHashTableHelper.h.

101  {
102  for ( unsigned int i = 0; i < N; ++i ) m_fields[i] = fields[i];
103 }

◆ ~IdHashTableHelper()

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::~IdHashTableHelper
inlinevirtual

virtual destructor needed because of derivation

Definition at line 106 of file IdHashTableHelper.h.

106  {
107  // nothing to do
108 }

Member Function Documentation

◆ defaultHash()

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::HashType IdHashTableHelper< N, ID, HASH >::defaultHash
inlinestatic

Returns default (=invalid) hash.

Definition at line 147 of file IdHashTableHelper.h.

147  {
148  return s_defaultHash;
149 }

◆ defaultIdentifier()

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::IdentifierType IdHashTableHelper< N, ID, HASH >::defaultIdentifier
inlinestatic

Return default (=invalid) identifier.

Definition at line 153 of file IdHashTableHelper.h.

153  {
154  return s_defaultId;
155 }

◆ defaultValue()

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::ValueType IdHashTableHelper< N, ID, HASH >::defaultValue
inlinestatic

Return default hash.

Needed for class MultiDimArray.

Definition at line 159 of file IdHashTableHelper.h.

159  {
160  return defaultHash();
161 }

◆ getId()

template<unsigned int N, class ID , class HASH >
const IdHashTableHelper< N, ID, HASH >::IdentifierType & IdHashTableHelper< N, ID, HASH >::getId
inline

Get the identifier.

Definition at line 117 of file IdHashTableHelper.h.

117  {
118  return m_id;
119 }

◆ isValid()

template<unsigned int N, class ID , class HASH >
bool IdHashTableHelper< N, ID, HASH >::isValid ( const IdentifierType id)
inlinestatic

Definition at line 164 of file IdHashTableHelper.h.

164  {
165  return id != s_defaultId;
166 }

◆ operator[]()

template<unsigned int N, class ID , class HASH >
int IdHashTableHelper< N, ID, HASH >::operator[] ( unsigned int  fieldIndex) const
inline

Return the value encoded in field.

No range check!

Definition at line 111 of file IdHashTableHelper.h.

111  {
112  return m_fields[index];
113 }

◆ setDefaults()

template<unsigned int N, class ID , class HASH >
void IdHashTableHelper< N, ID, HASH >::setDefaults ( const IdentifierType defId,
const HashType defHash 
)
inlinestatic

Set the default (invalid) values for identifier and hash.

Must be called (once per type T) if the default constructors of HashType or IdentifierType do not give a well defined (invalid!) value. This is typically the case for built-in types.

Definition at line 138 of file IdHashTableHelper.h.

140  {
141  s_defaultId = defId;
142  s_defaultHash = defHash;
143 }

◆ setField()

template<unsigned int N, class ID , class HASH >
void IdHashTableHelper< N, ID, HASH >::setField ( int  index,
int  value 
)
inline

Set field at index to value.

No range check!

Definition at line 128 of file IdHashTableHelper.h.

128  {
129  m_fields[index] = value;
130 }

◆ setFields()

template<unsigned int N, class ID , class HASH >
void IdHashTableHelper< N, ID, HASH >::setFields ( int  fields[N])
inline

Set fields from array.

Definition at line 133 of file IdHashTableHelper.h.

133  {
134  for ( unsigned int i = 0; i < N; ++i ) m_fields[i] = fields[i];
135 }

◆ setId()

template<unsigned int N, class ID , class HASH >
void IdHashTableHelper< N, ID, HASH >::setId ( const IdentifierType id)
inline

Set (only) the identifier.

Definition at line 123 of file IdHashTableHelper.h.

123  {
124  m_id = id;
125 }

Member Data Documentation

◆ m_fields

template<unsigned int N, class ID , class HASH >
int IdHashTableHelper< N, ID, HASH >::m_fields[N]
private

Definition at line 85 of file IdHashTableHelper.h.

◆ m_id

template<unsigned int N, class ID , class HASH >
IdentifierType IdHashTableHelper< N, ID, HASH >::m_id
private

Definition at line 84 of file IdHashTableHelper.h.

◆ s_defaultHash

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::HashType IdHashTableHelper< N, ID, HASH >::s_defaultHash
staticprivate
Initial value:

Definition at line 90 of file IdHashTableHelper.h.

◆ s_defaultId

template<unsigned int N, class ID , class HASH >
IdHashTableHelper< N, ID, HASH >::IdentifierType IdHashTableHelper< N, ID, HASH >::s_defaultId
staticprivate
Initial value:

Definition at line 89 of file IdHashTableHelper.h.


The documentation for this class was generated from the following file:
IdHashTableHelper::m_fields
int m_fields[N]
Definition: IdHashTableHelper.h:85
IdHashTableHelper::m_id
IdentifierType m_id
Definition: IdHashTableHelper.h:84
athena.value
value
Definition: athena.py:124
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
IdHashTableHelper::s_defaultId
static IdentifierType s_defaultId
Definition: IdHashTableHelper.h:89
lumiFormat.i
int i
Definition: lumiFormat.py:85
IdHashTableHelper::IdentifierType
ID IdentifierType
define type IdentifierType
Definition: IdHashTableHelper.h:40
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
IdHashTableHelper::defaultHash
static HashType defaultHash()
Returns default (=invalid) hash.
Definition: IdHashTableHelper.h:147
DeMoScan.index
string index
Definition: DeMoScan.py:364
IdHashTableHelper::s_defaultHash
static HashType s_defaultHash
Definition: IdHashTableHelper.h:90
CaloCondBlobAlgs_fillNoiseFromASCII.fields
fields
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:106
IdHashTableHelper::HashType
HASH HashType
define type HashType
Definition: IdHashTableHelper.h:42