Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class FlagReason
FlagReason(uint16_t id, const char* name, bool bad) : mId(id), mName(name), mBad(bad) {}

public:
FlagReason();
FlagReason& operator=(const FlagReason&) = default;
FlagReason(const FlagReason&) = default;
bool operator==(const FlagReason& rhs) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class TimeRangeFlagCollection
collection_t::const_iterator begin() const;
collection_t::const_iterator end() const;

const std::string& getName() const;
const std::string& getDetector() const;

/// write data to ostream
void streamTo(std::ostream& output) const;

Expand Down
5 changes: 5 additions & 0 deletions DataFormats/QualityControl/src/FlagReasons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
namespace o2::quality_control
{

FlagReason::FlagReason()
{
*this = FlagReasonFactory::Invalid();
}

std::ostream& operator<<(std::ostream& os, FlagReason const& my)
{
os << "Flag Reason: id - " << my.mId << ", name - " << my.mName << ", bad - " << (my.mBad ? "true" : "false");
Expand Down
9 changes: 9 additions & 0 deletions DataFormats/QualityControl/src/TimeRangeFlagCollection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,13 @@ std::ostream& operator<<(std::ostream& output, const TimeRangeFlagCollection& da
return output;
}

const std::string& TimeRangeFlagCollection::getName() const
{
return mName;
}
const std::string& TimeRangeFlagCollection::getDetector() const
{
return mDetID;
}

} // namespace o2::quality_control
3 changes: 3 additions & 0 deletions DataFormats/QualityControl/test/testFlagReasons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ BOOST_AUTO_TEST_CASE(FlagReasons)
static_assert(std::is_constructible<FlagReason, uint16_t, const char*, bool>::value == false,
"FlagReason should not be constructible outside of its static methods.");

FlagReason rDefault;
BOOST_CHECK_EQUAL(rDefault, FlagReasonFactory::Invalid());

auto r1 = FlagReasonFactory::Unknown();
BOOST_CHECK_EQUAL(r1.getID(), 1);
BOOST_CHECK_EQUAL(r1.getName(), "Unknown");
Expand Down