ATLAS Offline Software
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 
20 {
21 public:
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 
48 private:
49  unsigned short m_typeIndex;
50  unsigned short m_objIndex;
51 };
52 
53 
54 
55 // inline definitions
56 
57 inline
59  :
60  m_typeIndex(0xFFFF),
61  m_objIndex(0xFFFF)
62 {}
63 
64 inline
65 AttrListIndexes::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)),
69  m_objIndex(objIndex)
70 {}
71 
72 
73 inline
74 AttrListIndexes::AttrListIndexes(unsigned short typeIndex, unsigned short objIndex)
75  :
76  m_typeIndex(typeIndex & 0x003F),
77  m_objIndex(objIndex)
78 {}
79 
80 inline
81 AttrListIndexes::AttrListIndexes(unsigned int combinedIndex)
82 {
84 }
85 
86 
87 inline
88 unsigned short
90 {
91  return ((m_typeIndex >> 6) & 0x03FF);
92 }
93 
94 inline
95 unsigned short
97 {
98  return (m_typeIndex & 0x003F);
99 }
100 
101 inline
102 unsigned short
104 {
105  return (m_objIndex);
106 }
107 
108 inline
109 unsigned int
111 {
112  // Concatenate type and obj indexes
113  unsigned int result = (m_typeIndex << 16) + m_objIndex;
114  return (result);
115 }
116 
117 inline
118 bool
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 
126 inline
127 void
128 AttrListIndexes::setCombinedIndex(unsigned int combinedIndex)
129 {
130  // Extract type and obj indexes
131  m_typeIndex = combinedIndex >> 16;
132  m_objIndex = combinedIndex & 0xFFFF;
133 }
134 
135 inline
136 void
138 {
139  // add in only the attribute index, keeping the type index
140  m_typeIndex = ((index & 0x03FF) << 6) | (m_typeIndex & 0x003F);
141 }
142 
143 
144 inline
145 void
147 {
148  // add in only the type index, keeping the attribute index
149  m_typeIndex = (m_typeIndex & 0x03FF) | (index & 0x003F);
150 }
151 
152 inline
153 void
155 {
156  m_objIndex = index;
157 }
158 
159 #endif
get_generator_info.result
result
Definition: get_generator_info.py:21
AttrListIndexes
Indexes to attribute name, type name and object value for the persistent storage of an attribute list...
Definition: AttrListIndexes.h:20
AttrListIndexes::isValid
bool isValid() const
Uninitialized index is NOT valid.
Definition: AttrListIndexes.h:119
index
Definition: index.py:1
AttrListIndexes::objIndex
unsigned short objIndex() const
Index into the type-specific value vectors - type index identifies which one.
Definition: AttrListIndexes.h:103
AttrListIndexes::setTypeIndex
void setTypeIndex(unsigned short typeIndex)
Definition: AttrListIndexes.h:146
AttrListIndexes::setCombinedIndex
void setCombinedIndex(unsigned int combinedIndex)
Definition: AttrListIndexes.h:128
AttrListIndexes::typeIndex
unsigned short typeIndex() const
Index into the type name vector.
Definition: AttrListIndexes.h:96
AttrListIndexes::m_objIndex
unsigned short m_objIndex
Definition: AttrListIndexes.h:50
AttrListIndexes::nameIndex
unsigned short nameIndex() const
Index into attribute name vector.
Definition: AttrListIndexes.h:89
AttrListIndexes::setObjIndex
void setObjIndex(unsigned short index)
Definition: AttrListIndexes.h:154
AttrListIndexes::AttrListIndexes
AttrListIndexes()
Definition: AttrListIndexes.h:58
DeMoScan.index
string index
Definition: DeMoScan.py:362
AttrListIndexes::combinedIndex
unsigned int combinedIndex() const
Access to the bit-packed value.
Definition: AttrListIndexes.h:110
AttrListIndexes::m_typeIndex
unsigned short m_typeIndex
Definition: AttrListIndexes.h:49
AttrListIndexes::setAttrIndex
void setAttrIndex(unsigned short nameIndex)
Definition: AttrListIndexes.h:137