8#include "yaml-cpp/yaml.h"
10#define YAML YAML_NAMESPACE
37 inline string _iotypestr(
const string& baseiotype) {
44 void WriterYODA::_writeAnnotations(std::ostream& os,
const AnalysisObject& ao) {
45 os << scientific << setprecision(_aoprecision);
46 for (
const string& a : ao.annotations()) {
47 if (a.empty())
continue;
49 string ann = ao.annotation(a);
52 ann.erase(std::remove(ann.begin(), ann.end(),
'\n'), ann.end());
53 os << a <<
": " << ann <<
"\n";
60 ios_base::fmtflags oldflags = os.flags();
61 os << scientific << showpoint << setprecision(_aoprecision);
62 os <<
"BEGIN " << _iotypestr(ao.
type()) <<
" " << ao.
path() <<
"\n";
63 _writeAnnotations(os, ao);
64 ao._renderYODA(os, _aoprecision+7);
65 os <<
"END " << _iotypestr(ao.
type()) <<
"\n\n";
AnalysisObject is the base class for histograms and scatters.
virtual std::string type() const
Get name of the analysis object type.
const std::string path() const
Get the AO path.
Persistency writer for YODA flat text format.
void writeAO(std::ostream &stream, const AnalysisObject &c)
static Writer & create()
Singleton creation function.
Pure virtual base class for various output writers.
void setPrecision(int precision)
Set precision of numerical quantities in this writer's output.
Anonymous namespace to limit visibility.
static const int YODA_FORMAT_VERSION