R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BFormatters.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2023 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14#pragma once
15
16#include "R3BShared.h"
17#include <TVector3.h>
18#include <fmt/format.h>
19
20template <>
21class fmt::formatter<TVector3>
22{
23 public:
24 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
25 template <typename FmtContent>
26 constexpr auto format(const TVector3& vec, FmtContent& ctn) const
27 {
28 return format_to(ctn.out(), "[x: {}, y: {}, z: {}]", vec.X(), vec.Y(), vec.Z());
29 }
30};
31
32template <typename DataType>
33class fmt::formatter<R3B::ValueError<DataType>>
34{
35 public:
36 // TODO: add more options
37 static constexpr auto parse(format_parse_context& ctx) { return ctx.end(); }
38 template <typename FmtContent>
39 constexpr auto format(const R3B::ValueError<DataType>& value_error, FmtContent& ctn) const
40 {
41 return format_to(ctn.out(), "{}+/-{}", value_error.value, value_error.error);
42 }
43};
constexpr auto format(const R3B::ValueError< DataType > &value_error, FmtContent &ctn) const
static constexpr auto parse(format_parse_context &ctx)
constexpr auto format(const TVector3 &vec, FmtContent &ctn) const
static constexpr auto parse(format_parse_context &ctx)