|
| 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 | + |
| 12 | +#ifndef O2_FRAMEWORK_DPLFORMATTERS_H_ |
| 13 | +#define O2_FRAMEWORK_DPLFORMATTERS_H_ |
| 14 | + |
| 15 | +#include <fmt/format.h> |
| 16 | +#include "Framework/Lifetime.h" |
| 17 | + |
| 18 | +template <> |
| 19 | +struct fmt::formatter<o2::framework::Lifetime> : fmt::formatter<std::string_view> { |
| 20 | + char presentation = 's'; |
| 21 | + |
| 22 | + template <typename FormatContext> |
| 23 | + auto format(o2::framework::Lifetime const& h, FormatContext& ctx) |
| 24 | + { |
| 25 | + std::string_view s = "unknown"; |
| 26 | + switch (h) { |
| 27 | + case o2::framework::Lifetime::Timeframe: |
| 28 | + s = "timeframe"; |
| 29 | + break; |
| 30 | + case o2::framework::Lifetime::Condition: |
| 31 | + s = "condition"; |
| 32 | + break; |
| 33 | + case o2::framework::Lifetime::QA: |
| 34 | + s = "qos"; |
| 35 | + break; |
| 36 | + case o2::framework::Lifetime::Transient: |
| 37 | + s = "transient"; |
| 38 | + break; |
| 39 | + // Complete the rest of the enum |
| 40 | + case o2::framework::Lifetime::Timer: |
| 41 | + s = "timer"; |
| 42 | + break; |
| 43 | + case o2::framework::Lifetime::Enumeration: |
| 44 | + s = "enumeration"; |
| 45 | + break; |
| 46 | + case o2::framework::Lifetime::Signal: |
| 47 | + s = "signal"; |
| 48 | + break; |
| 49 | + case o2::framework::Lifetime::Optional: |
| 50 | + s = "optional"; |
| 51 | + break; |
| 52 | + case o2::framework::Lifetime::OutOfBand: |
| 53 | + s = "out-of-band"; |
| 54 | + break; |
| 55 | + }; |
| 56 | + return formatter<string_view>::format(s, ctx); |
| 57 | + } |
| 58 | +}; |
| 59 | + |
| 60 | +#endif // O2_FRAMEWORK_DPLFORMATTERS_H_ |
0 commit comments