10#include <fmt/ostream.h>
11#include <fmt/ranges.h>
16#include "iohb_export.h"
22 Layout(
bool show_labels,
int precision, std::string separator,
int field_width);
26 const std::string
layout()
const {
return layout_.str(); }
28 void add_literal(
const std::string &label);
29 void add_legend(
const std::string &label);
31 template <
typename T>
void add(
const std::string &name,
const T &value);
32 template <
typename T>
void add(
const std::string &name,
const std::vector<T> &value);
35 void output_common(
const std::string &name);
36 std::ostringstream layout_{};
37 std::string separator_{
", "};
42 bool showLabels{
true};
43 bool legendStarted{
false};
53 fmt::print(
layout_,
"{}=", name);
57 template <
typename T>
inline void Layout::add(
const std::string &name,
const T &value)
64 fmt::print(
layout_,
"{}", value);
68 template <>
inline void Layout::add(
const std::string &name,
const double &value)
74 fmt::print(
layout_,
"{}", value);
85 inline void Layout::add(
const std::string &name,
const std::vector<T> &value)
87 if (value.size() == 1) {
101 template <>
inline void Layout::add(
const std::string &name,
const std::vector<double> &value)
103 if (value.size() == 1) {
Definition Iohb_Layout.h:20
bool showLabels
Definition Iohb_Layout.h:42
std::string separator_
Definition Iohb_Layout.h:37
int count_
Definition Iohb_Layout.h:40
void output_common(const std::string &name)
Definition Iohb_Layout.h:46
Layout & operator=(const Layout &)=delete
Layout(const Layout &)=delete
int fieldWidth_
Definition Iohb_Layout.h:41
std::ostringstream layout_
Definition Iohb_Layout.h:36
int precision_
Definition Iohb_Layout.h:39
const std::string layout() const
Definition Iohb_Layout.h:26
void add(const std::string &name, const T &value)
Definition Iohb_Layout.h:57
A namespace for the heartbeat database format.
Definition Iohb_DatabaseIO.C:102