|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef TRTCONDITIONSDATA_ARRAYSTORE_H
6 #define TRTCONDITIONSDATA_ARRAYSTORE_H
31 template <
typename IdType =
int,
typename StorageType = std::vector<
float> >
35 typedef std::less<IdType>
lessp;
37 typedef typename BufferMap::const_iterator
map_citr;
47 const std::string&
tag()
const;
65 void share(
const IdType&
ident,
const IdType& referenceIdent);
87 template <
typename IdType,
typename StorageType>
90 template <
typename IdType,
typename StorageType>
93 template <
typename IdType,
typename StorageType>
96 template <
typename IdType,
typename StorageType>
99 template <
typename IdType,
typename StorageType>
101 m_buf.push_back(
value);
102 m_bufmap[
ident]= m_buf.size()-1;
105 template <
typename IdType,
typename StorageType>
108 template <
typename IdType,
typename StorageType>
111 template <
typename IdType,
typename StorageType>
114 template <
typename IdType,
typename StorageType>
117 template <
typename IdType,
typename StorageType>
120 template <
typename IdType,
typename StorageType>
123 template <
typename IdType,
typename StorageType>
126 template <
typename IdType,
typename StorageType>
128 if (existID(referenceIdent)){
129 m_bufmap[
ident] = -std::abs(m_bufmap[referenceIdent]);
130 m_bufmap[referenceIdent] = -std::abs(m_bufmap[referenceIdent]);
134 template <
typename IdType,
typename StorageType>
137 template <
typename IdType,
typename StorageType>
140 template <
typename IdType,
typename StorageType>
143 template <
typename IdType,
typename StorageType>
146 template <
typename IdType,
typename StorageType>
149 #ifndef TRTCONDITIONSDATA_ARRAYSTORE_ICC
150 #define TRTCONDITIONSDATA_ARRAYSTORE_ICC
152 template <
typename IdType,
typename StorageType>
154 std::multimap<int,IdType> indexmap;
157 for (;itr!=m_bufmap.end();++itr)
158 indexmap.insert(std::pair<int,IdType>(std::abs(itr->second),itr->first));
159 std::vector<StorageType>
tmp(m_buf);
167 for (
pos=indexmap.lower_bound(
i);
pos!=indexmap.upper_bound(
i); ++
pos){
170 shared_id=
pos->second;
171 this->push_back(shared_id,
tmp[std::abs(
i)]);
173 this->share(
pos->second,shared_id);
JetConstituentVector::iterator iterator
BufferMap::const_iterator map_citr
void dbg() const
print method
void removeID(const IdType &ident)
remove index
void share(const IdType &ident, const IdType &referenceIdent)
makes index ident share data with referenceIdent
const std::string & tag() const
Tag accessor.
virtual ~ArrayStore()
destructor
int numberOfIDs()
Size accessor.
void push_back(const IdType &ident, const StorageType &value)
makes new index
BufferMap::iterator map_itr
std::less< IdType > lessp
bool existID(const IdType &ident)
returns flag for index existing in the std::map
map_citr cbegin() const
begin/end const iterators
ArrayStore(const std::string &tag)
const StorageType & operator[](const IdType &ident) const
Overload [] const access.
StorageType & operator[](const IdType &ident)
Overload [] modifier.
ArrayStore()
constructors, optionally with a tag
std::string m_tag
The tag std::string.
void clear()
remove all indices
BufferMap m_bufmap
The std::map.
std::vector< StorageType > m_buf
The object stored in each second element.
void cleanUp()
remove data with no index pointing to it
bool sharedID(const IdType &ident)
returns flag for index sharing data
std::map< IdType, int, lessp > BufferMap
map_itr begin()
begin/end iterators