ATLAS Offline Software
Loading...
Searching...
No Matches
IdentContIndex.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHLINKS_TOOLS_IDENTCONTINDEX_H
6# define ATHLINKS_TOOLS_IDENTCONTINDEX_H
7
21
23{
24public:
26
28 IdentContIndex(unsigned short collHash, unsigned short objIndex);
29 IdentContIndex(unsigned int hashAndIndex);
31
33
34 unsigned short collHash() const;
36 unsigned short objIndex() const;
38 unsigned int hashAndIndex() const;
40 bool isValid() const;
42
44
45
46 void setHashAndIndex(unsigned int hashAndIndex);
48 void setCollHash(unsigned short hash);
50 void setObjIndex(unsigned short index);
52
53private:
54 unsigned short m_collHash;
55 unsigned short m_objIndex;
56};
57
58
59
60// inline definitions
61
62inline
64 :
65 m_collHash(0xFFFF),
66 m_objIndex(0xFFFF)
67{}
68
69inline
70IdentContIndex::IdentContIndex(unsigned short collHash, unsigned short objIndex)
71 :
74{}
75
76inline
81
82
83inline
84unsigned short
86{
87 return (m_collHash);
88}
89
90inline
91unsigned short
93{
94 return (m_objIndex);
95}
96
97inline
98unsigned int
100{
101 // Concatenate hash and index
102 unsigned int result = (m_collHash << 16) + m_objIndex;
103 return (result);
104}
105
106inline
107bool
109{
110 // is valid if both hash and index are not default values
111 return (m_collHash != 0xFFFF && m_objIndex != 0xFFFF);
112}
113
114
115inline
116void
118{
119 // Extract hash and index
120 m_collHash = static_cast<unsigned short> (hashAndIndex >> 16);
121 m_objIndex = static_cast<unsigned short> (hashAndIndex & 0xFFFF);
122}
123
124inline
125void
126IdentContIndex::setCollHash(unsigned short hash)
127{
128 m_collHash = hash;
129}
130
131inline
132void
134{
136}
137
138#endif // not ATHLINKS_TOOLS_IDENTCONTINDEX_H
unsigned short objIndex() const
object index in collection
void setHashAndIndex(unsigned int hashAndIndex)
Setters of hash, obj index and combined index.
unsigned short m_collHash
void setCollHash(unsigned short hash)
set object index in collection
void setObjIndex(unsigned short index)
set combined index
unsigned int hashAndIndex() const
combined index
unsigned short collHash() const
Accessor to hash, obj index and combined index.
unsigned short m_objIndex
bool isValid() const
check that both fields are set
IdentContIndex()
Constructors.
Definition index.py:1