Project
Loading...
Searching...
No Matches
QualityControlFlag.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13
14#include <iostream>
15#include <tuple>
16
17namespace o2::quality_control
18{
19
21 : mInterval(start, end), mFlag(flag), mComment(comment), mSource(source)
22{
23 if (mInterval.isInvalid()) {
24 throw std::runtime_error("QualityControlFlag start time '" + std::to_string(mInterval.getMin()) + "' is larger than end time '" + std::to_string(mInterval.getMax()) + "'");
25 }
26}
27
29{
30 return std::tie(mInterval, mFlag, mComment, mSource) == std::tie(rhs.mInterval, rhs.mFlag, rhs.mComment, rhs.mSource);
31}
32
34{
35 // We don't use the comparison mechanism in Bracket,
36 // because std::set which is used in TRFCollection assumes that a < b, a > b <=> a == b.
37 // Using relation operators in Bracket would break insertion and merging.
38 return std::tie(static_cast<const time_type&>(mInterval.getMin()), static_cast<const time_type&>(mInterval.getMax()), mFlag, mComment, mSource) < std::tie(static_cast<const time_type&>(rhs.mInterval.getMin()), static_cast<const time_type&>(rhs.mInterval.getMax()), rhs.mFlag, rhs.mComment, rhs.mSource);
39}
40
42{
43 // we don't use the comparison mechanism in Bracket,
44 // because std::set which is used in TRFCollection assumes that a < b, a > b <=> a == b
45 return std::tie(static_cast<const time_type&>(mInterval.getMin()), static_cast<const time_type&>(mInterval.getMax()), mFlag, mComment, mSource) > std::tie(static_cast<const time_type&>(rhs.mInterval.getMin()), static_cast<const time_type&>(rhs.mInterval.getMax()), rhs.mFlag, rhs.mComment, rhs.mSource);
46}
47
48void QualityControlFlag::streamTo(std::ostream& output) const
49{
50 output << "QualityControlFlag:\n";
51 output << "- Start: " << mInterval.getMin() << "\n";
52 output << "- End: " << mInterval.getMax() << "\n";
53 output << "- " << mFlag << "\n";
54 output << "- Comment: " << mComment << "\n";
55 output << "- Source: " << mSource;
56}
57
58std::ostream& operator<<(std::ostream& output, const QualityControlFlag& data)
59{
60 data.streamTo(output);
61 return output;
62}
63
64} // namespace o2::quality_control
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
Class to define a flag type with a time range and comments.
bool operator>(const QualityControlFlag &rhs) const
bool operator<(const QualityControlFlag &rhs) const
comparison operators
void streamTo(std::ostream &output) const
write data to ostream
bool operator==(const QualityControlFlag &rhs) const
equal operator
GLuint GLuint end
Definition glcorearb.h:469
GLsizei GLsizei GLchar * source
Definition glcorearb.h:798
GLboolean * data
Definition glcorearb.h:298
GLuint start
Definition glcorearb.h:469
std::ostream & operator<<(std::ostream &os, FlagType const &my)
Definition FlagType.cxx:26
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52