34 , mode_m(std::ios::out)
37 namespace fs = std::filesystem;
39 if (fs::exists(
fname_m) && restart) {
54 std::queue<std::string> allLines;
57 fs.open (
fname_m.c_str(), std::fstream::in);
59 if (!fs.is_open())
return;
61 while (getline(fs, line)) {
66 fs.open (
fname_m.c_str(), std::fstream::out);
68 if (!fs.is_open())
return;
70 while (allLines.size() > numberOfLines) {
71 fs << allLines.front() <<
"\n";
83 std::string versionFile;
89 std::queue<std::string> allLines;
92 fs.open (
fname_m.c_str(), std::fstream::in);
94 if (!fs.is_open())
return;
96 while (getline(fs, line)) {
101 fs.open (
fname_m.c_str(), std::fstream::out);
103 if (!fs.is_open())
return;
105 while (!allLines.empty()) {
106 line = allLines.front();
108 if (line != versionFile) {
138 os_m.setf(std::ios::scientific, std::ios::floatfield);
167 os_m <<
"&description\n"
178 os_m <<
"¶meter\n"
179 <<
indent_m <<
"name=" << std::get<0>(param) <<
",\n"
180 <<
indent_m <<
"type=" << std::get<1>(param) <<
",\n"
181 <<
indent_m <<
"description=\"" << std::get<2>(param) <<
"\"\n"
210 std::stringstream revision;
219 flavor =
"opal-cycl";
226 addParameter(
"revision",
"string",
"git revision of opal", revision.str());
228 addParameter(
"flavor",
"string",
"OPAL flavor that wrote file", flavor);
static constexpr unsigned int precision_m
static OpalData * getInstance()
#define OPAL_PROJECT_VERSION
std::string getGitRevision()
void addParameter(const std::string &name, const std::string &type, const std::string &desc, const T &value)
SDDSWriter(const std::string &fname, bool restart)
#define OPAL_PROJECT_NAME
Inform & endl(Inform &inf)
std::tuple< std::string, std::string, std::string > param_t
void getValue(int t, std::string column_name, T &nval)
std::queue< param_t > params_m
void addDefaultParameters()
std::queue< std::string > paramValues_m
void rewindLines(size_t numberOfLines)
delete the last 'numberOfLines' lines of the file 'fileName'
void writeHeader()
Write SDDS header.
void replaceVersionString()
void getParameterValue(std::string parameter_name, T &nval)
void writeHeader(std::ostream &os, const std::string &indent) const
double getLastValue(const std::string &column)
std::ios_base::openmode mode_m
First write to the statistics output file.