ATLAS Offline Software
Loading...
Searching...
No Matches
CondMultChanCollImpl.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
14
15#ifndef DBDATAOBJECTS_CONDMULTCHANCOLLIMPL_H
16# define DBDATAOBJECTS_CONDMULTCHANCOLLIMPL_H
17
18//<<<<<< INCLUDES >>>>>>
19
23#include <vector>
24
36
38{
39public:
40
41 typedef unsigned int ChanNum;
42 typedef std::vector<ChanNum> ChanVec;
43 typedef std::vector<IOVRange> IOVVec;
44 typedef std::vector<std::string> TokenVec;
45 typedef ChanVec::const_iterator chan_const_iterator;
46 typedef ChanVec::iterator chan_iterator;
47 typedef ChanVec::size_type chan_size_type;
48 typedef IOVVec::const_iterator iov_const_iterator;
49 typedef IOVVec::iterator iov_iterator;
50 typedef IOVVec::size_type iov_size_type;
51 typedef TokenVec::const_iterator token_const_iterator;
52 typedef TokenVec::iterator token_iterator;
53 typedef TokenVec::size_type token_size_type;
54
57
59 virtual ~CondMultChanCollImpl();
60
64
67
71
73 iov_size_type iov_size() const;
74
76 const IOVRange& minRange() const;
77
79 bool hasUniqueIOV() const;
80
84
87
89 void add(ChanNum chanNum);
90
92 void add(const IOVRange& range);
93
96 void addNewStop(const IOVTime& stop);
97
99 void add(const std::string& token);
100
103
105 void resetChannelNumbers();
106
108 void resetTokens();
109
110private:
111
112
120};
121
122//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>>
123//<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
124
125
126inline
128 :
129 m_attrListColl(nullptr),
130 // Assume run/event for minRange
131 m_minRange(IOVRange(IOVTime(IOVTime::MINRUN, IOVTime::MINEVENT),
132 IOVTime(IOVTime::MAXRUN, IOVTime::MAXEVENT))),
133 m_hasUniqueIOV(true),
135{}
136
138inline
141
142
144inline
147{
148 return (m_channels.begin());
149}
150
151inline
154{
155 return (m_channels.end());
156}
157
159inline
162{
163 return (m_channels.size());
164}
165
166
168inline
171{
172 return (m_iovs.begin());
173}
174
175inline
178{
179 return (m_iovs.end());
180}
181
183inline
186{
187 return (m_iovs.size());
188}
189
191inline
192const IOVRange&
194{
195 return (m_minRange);
196}
197
199inline
200bool
205
207inline
210{
211 return m_tokens.begin();
212}
213
214inline
217{
218 return m_tokens.end();
219}
220
222inline
225{
226 return m_tokens.size();
227}
228
230inline
231void
233{
234 m_channels.push_back(chanNum);
235}
236
238inline
239void
241{
242 // Check if we're adding too many iovs - may be a 2nd pass
243 if (m_iovs.size() >= m_channels.size()) {
244 // Should throw an exception here because we are trying to
245 // add more iovs than channels. Now we just return
246 return;
247 }
248
249 // Save range
250 m_iovs.push_back(range);
251
252 // If CondAttrListCollection exists, also add to it
253 if(m_attrListColl) {
254 // Get channel number
255 ChanNum chan = m_channels[m_iovs.size()-1];
256 m_attrListColl->add(chan, range);
257 }
258
260 // On the first push_back we must check if we're using a time
261 // stamp and if so, reset the minRange
262 if(range.start().isTimestamp()) {
265 }
266 m_checkRunEventTime = false;
267 }
268
269 // Accumulate minRange
270 IOVTime start = m_minRange.start();
271 if (m_minRange.start() < range.start()) start = range.start();
272 IOVTime stop = m_minRange.stop();
273 if (range.stop() < m_minRange.stop()) stop = range.stop();
274 m_minRange = IOVRange(start, stop);
275 if (m_hasUniqueIOV && range != m_minRange) m_hasUniqueIOV = false;
276}
277
280inline
281void
283{
284 if (stop < m_minRange.stop()) {
285 m_minRange = IOVRange(m_minRange.start(), stop);
286 }
287}
288
290inline
291void
292CondMultChanCollImpl::add(const std::string& token)
293{
294 m_tokens.push_back(token);
295}
296
298inline
299void
304
306inline
307void
312
314inline
315void
320
321
322#endif // DBDATAOBJECTS_CONDMULTCHANCOLLIMPL_H
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
An STL vector of pointers that by default owns its pointed-to elements.
Validity Range object.
This class is a collection of AttributeLists where each one is associated with a channel number.
TokenVec::const_iterator token_const_iterator
token_size_type token_size() const
number of tokens
std::vector< ChanNum > ChanVec
void add(ChanNum chanNum)
Adding in channel numbers.
IOVVec::iterator iov_iterator
IOVVec::size_type iov_size_type
bool hasUniqueIOV() const
Check whether there is a unique IOV for all channels.
std::vector< IOVRange > IOVVec
IOVVec::const_iterator iov_const_iterator
chan_const_iterator chan_begin() const
Access to Channel numbers via iterators.
ChanVec::iterator chan_iterator
ChanVec::const_iterator chan_const_iterator
CondAttrListCollection * m_attrListColl
chan_size_type chan_size() const
number of channels
ChanVec::size_type chan_size_type
token_const_iterator token_end() const
TokenVec::iterator token_iterator
void setAttrListColl(CondAttrListCollection *coll)
Set pointer to the CondAttrListCollection.
token_const_iterator token_begin() const
Access to tokens via iterators.
std::vector< std::string > TokenVec
const IOVRange & minRange() const
Current minimal IOVRange.
CondMultChanCollImpl()
Default constructor.
iov_size_type iov_size() const
number of IOVs
void resetChannelNumbers()
Reset channel numbers - needed to allow sorting.
virtual ~CondMultChanCollImpl()
Default destructor.
iov_const_iterator iov_begin() const
Access to IOVs via iterators.
iov_const_iterator iov_end() const
chan_const_iterator chan_end() const
void resetTokens()
Reset tokens - needed to multiple I/O of the same object.
TokenVec::size_type token_size_type
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop.
Validity Range object.
Definition IOVRange.h:30
Basic time unit for IOVSvc.
Definition IOVTime.h:33
static constexpr uint64_t MAXTIMESTAMP
Definition IOVTime.h:58
static constexpr uint64_t MINTIMESTAMP
Definition IOVTime.h:56