Skip to content

Commit f3e5554

Browse files
committed
DPL: add streamer for enum Lifetime
1 parent af1ff85 commit f3e5554

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Framework/Core/include/Framework/LifetimeHelpers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ struct LifetimeHelpers {
9090
static ExpirationHandler::Handler dummy(ConcreteDataMatcher const& spec, std::string const& sourceChannel);
9191
};
9292

93+
std::ostream& operator<<(std::ostream& oss, Lifetime const& val);
94+
9395
} // namespace o2::framework
9496

9597
#endif // O2_FRAMEWORK_LIFETIMEHELPERS_H_

Framework/Core/src/LifetimeHelpers.cxx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,4 +482,24 @@ ExpirationHandler::Handler LifetimeHelpers::dummy(ConcreteDataMatcher const& mat
482482
return f;
483483
}
484484

485+
// Life is too short. LISP rules.
486+
#define STREAM_ENUM(x) \
487+
case x: \
488+
oss << #x; \
489+
break;
490+
std::ostream& operator<<(std::ostream& oss, Lifetime const& val)
491+
{
492+
switch (val) {
493+
STREAM_ENUM(Lifetime::Timeframe)
494+
STREAM_ENUM(Lifetime::Condition)
495+
STREAM_ENUM(Lifetime::QA)
496+
STREAM_ENUM(Lifetime::Transient)
497+
STREAM_ENUM(Lifetime::Timer)
498+
STREAM_ENUM(Lifetime::Enumeration)
499+
STREAM_ENUM(Lifetime::Signal)
500+
STREAM_ENUM(Lifetime::Optional)
501+
};
502+
return oss;
503+
}
504+
485505
} // namespace o2::framework

0 commit comments

Comments
 (0)