ATLAS Offline Software
Loading...
Searching...
No Matches
LArConditionsChannelSet.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
15
16#ifndef LARRAWCONDITIONS_LARCONDITIONSCHANNELSET_H
17#define LARRAWCONDITIONS_LARCONDITIONSCHANNELSET_H
32
33#include <vector>
34
35template<class T>
37{
38public:
39
41 typedef unsigned int ChannelId;
42 typedef typename std::pair<ChannelId, T> ChanIdTPair;
43 typedef typename std::vector<ChanIdTPair> ChannelVector;
44 typedef typename ChannelVector::const_iterator ConstChannelIt;
45 typedef typename ChannelVector::iterator ChannelIt;
46
49
52
55
57 ConstChannelIt begin() const;
58 ConstChannelIt end() const;
59
61 size_t size() const;
62
63
66 void insert (ChannelId id, const T& cond);
67
68private:
69
70 class PairSort
71 {
72 public:
73 bool operator () (const ChanIdTPair& x, const ChanIdTPair& y)
74 {
75 return (x.first < y.first);
76 }
77 bool operator () (const ChanIdTPair& x, const unsigned int& id)
78 {
79 return (x.first < id);
80 }
81 };
82
84};
85
86
87// INLINE FUNCTIONS
88
89
90template<class T>
91inline
94
95
96template<class T>
97inline
100
101
102template<class T>
103inline
106{
107 ConstChannelIt result = std::lower_bound(m_channelVec.begin(),
108 m_channelVec.end(),
109 id,
110 PairSort());
111
112 if (result == m_channelVec.end()) return (result);
113 if ((*result).first == id) {
114 return (result);
115 } else {
116 return m_channelVec.end() ;
117 }
118}
119
120
121
122template<class T>
123inline
126{
127 return (m_channelVec.begin());
128}
129
130template<class T>
131inline
134{
135 return (m_channelVec.end());
136}
137
138
139
140template<class T>
141inline
142size_t
144{
145 return (m_channelVec.size());
146}
147
148template<class T>
149inline
150void
152{
153 m_channelVec.push_back(ChanIdTPair(id,cond));
154 std::sort(m_channelVec.begin(), m_channelVec.end(), PairSort());
155}
156
157#endif // LARRAWCONDITIONS_LARCONDITIONSCHANNELSET_H
#define y
#define x
bool operator()(const ChanIdTPair &x, const ChanIdTPair &y)
unsigned int ChannelId
Public typedefs.
std::vector< ChanIdTPair > ChannelVector
size_t size() const
Size of channel set.
void insert(ChannelId id, const T &cond)
Insert a new channel id / T pair.
ConstChannelIt find(ChannelId id) const
Access to a conditions object pair for a given channel id.
ConstChannelIt begin() const
Iterators over channel set.
virtual ~LArConditionsChannelSet()
destructor
LArConditionsChannelSet()
Default constructor.
ChannelVector::iterator ChannelIt
std::pair< ChannelId, T > ChanIdTPair
ChannelVector::const_iterator ConstChannelIt
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.