| 1 |
// Copyright(C) 1999-2024 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#pragma once |
| 8 |
|
| 9 |
#include <sstream> |
| 10 |
#include <string> |
| 11 |
#include <vector> |
| 12 |
|
| 13 |
#include "iohb_export.h" |
| 14 |
|
| 15 |
namespace Iohb { |
| 16 |
class IOHB_EXPORT Layout |
| 17 |
{ |
| 18 |
public: |
| 19 |
Layout(bool show_labels, int precision, std::string separator, int field_width); |
| 20 |
Layout(const Layout &) = delete; |
| 21 |
Layout &operator=(const Layout &) = delete; |
| 22 |
|
| 23 |
const std::string layout() const { return layout_.str(); } |
| 24 |
|
| 25 |
void add_literal(const std::string &label); |
| 26 |
void add_legend(const std::string &label); |
| 27 |
|
| 28 |
template <typename T> void add(const std::string &name, const T &value); |
| 29 |
template <typename T> void add(const std::string &name, const std::vector<T> &value); |
| 30 |
|
| 31 |
private: |
| 32 |
void output_common(const std::string &name); |
| 33 |
std::ostringstream layout_{}; |
| 34 |
std::string separator_{", "}; |
| 35 |
|
| 36 |
int precision_{5}; |
| 37 |
int count_{0}; // Number of fields on current line... |
| 38 |
int fieldWidth_{0}; |
| 39 |
bool showLabels{true}; |
| 40 |
bool legendStarted{false}; |
| 41 |
}; |
| 42 |
|
| 43 |
} // namespace Iohb |