ATLAS Offline Software
Loading...
Searching...
No Matches
AttrListIndexes.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 IOVDBTPCNV_ATTRLISTINDEXES_H
6# define IOVDBTPCNV_ATTRLISTINDEXES_H
7
18
20{
21public:
23 AttrListIndexes(unsigned short nameIndex, unsigned short typeIndex, unsigned short objIndex);
24 AttrListIndexes(unsigned short typeIndex, unsigned short objIndex);
25 AttrListIndexes(unsigned int combinedIndex);
26
28 unsigned short nameIndex() const;
29
31 unsigned short typeIndex() const;
32
35 unsigned short objIndex() const;
36
38 unsigned int combinedIndex() const;
39
41 bool isValid() const;
42
43 void setCombinedIndex(unsigned int combinedIndex);
44 void setAttrIndex(unsigned short nameIndex);
45 void setTypeIndex(unsigned short typeIndex);
46 void setObjIndex(unsigned short index);
47
48private:
49 unsigned short m_typeIndex;
50 unsigned short m_objIndex;
51};
52
53
54
55// inline definitions
56
57inline
59 :
60 m_typeIndex(0xFFFF),
61 m_objIndex(0xFFFF)
62{}
63
64inline
65AttrListIndexes::AttrListIndexes(unsigned short nameIndex, unsigned short typeIndex, unsigned short objIndex)
66 :
67 // m_typeIndex: 10 bits nameIndex + 6 bits typeIndex:
68 m_typeIndex( ((nameIndex & 0x03FF) << 6) | (typeIndex & 0x003F)),
70{}
71
72
73inline
75 :
76 m_typeIndex(typeIndex & 0x003F),
78{}
79
80inline
85
86
87inline
88unsigned short
90{
91 return ((m_typeIndex >> 6) & 0x03FF);
92}
93
94inline
95unsigned short
97{
98 return (m_typeIndex & 0x003F);
99}
100
101inline
102unsigned short
104{
105 return (m_objIndex);
106}
107
108inline
109unsigned int
111{
112 // Concatenate type and obj indexes
113 unsigned int result = (m_typeIndex << 16) + m_objIndex;
114 return (result);
115}
116
117inline
118bool
120{
121 // is valid if both type and obj indexes are not default values
122 return (m_typeIndex != 0xFFFF && m_objIndex != 0xFFFF);
123}
124
125
126inline
127void
129{
130 // Extract type and obj indexes
132 m_objIndex = combinedIndex & 0xFFFF;
133}
134
135inline
136void
138{
139 // add in only the attribute index, keeping the type index
140 m_typeIndex = ((index & 0x03FF) << 6) | (m_typeIndex & 0x003F);
141}
142
143
144inline
145void
147{
148 // add in only the type index, keeping the attribute index
149 m_typeIndex = (m_typeIndex & 0x03FF) | (index & 0x003F);
150}
151
152inline
153void
155{
157}
158
159#endif
unsigned short nameIndex() const
Index into attribute name vector.
unsigned short objIndex() const
Index into the type-specific value vectors - type index identifies which one.
void setCombinedIndex(unsigned int combinedIndex)
void setAttrIndex(unsigned short nameIndex)
void setTypeIndex(unsigned short typeIndex)
unsigned int combinedIndex() const
Access to the bit-packed value.
void setObjIndex(unsigned short index)
unsigned short typeIndex() const
Index into the type name vector.
unsigned short m_typeIndex
unsigned short m_objIndex
bool isValid() const
Uninitialized index is NOT valid.
Definition index.py:1