34 , mode_m(
std::ios::out)
37 namespace fs = boost::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)) {
67 fs.open (
fname_m.c_str(), std::fstream::out);
69 if (!
fs.is_open())
return;
71 while (allLines.size() > numberOfLines) {
72 fs << allLines.front() <<
"\n";
84 std::string versionFile;
90 std::queue<std::string> allLines;
93 fs.open (
fname_m.c_str(), std::fstream::in);
95 if (!
fs.is_open())
return;
97 while (getline(
fs, line)) {
103 fs.open (
fname_m.c_str(), std::fstream::out);
105 if (!
fs.is_open())
return;
107 while (!allLines.empty()) {
108 line = allLines.front();
110 if (line != versionFile) {
140 os_m.setf(std::ios::scientific, std::ios::floatfield);
169 os_m <<
"&description\n"
180 os_m <<
"¶meter\n"
181 <<
indent_m <<
"name=" << std::get<0>(param) <<
",\n"
182 <<
indent_m <<
"type=" << std::get<1>(param) <<
",\n"
183 <<
indent_m <<
"description=\"" << std::get<2>(param) <<
"\"\n"
212 std::stringstream revision;
221 flavor =
"opal-cycl";
228 addParameter(
"revision",
"string",
"git revision of opal", revision.str());
230 addParameter(
"flavor",
"string",
"OPAL flavor that wrote file", flavor);
#define OPAL_PROJECT_VERSION
#define OPAL_PROJECT_NAME
Inform & endl(Inform &inf)
std::string getGitRevision()
static OpalData * getInstance()
void writeHeader(std::ostream &os, const std::string &indent) const
void replaceVersionString()
SDDSWriter(const std::string &fname, bool restart)
void rewindLines(size_t numberOfLines)
delete the last 'numberOfLines' lines of the file 'fileName'
static constexpr unsigned int precision_m
double getLastValue(const std::string &column)
void addDefaultParameters()
std::queue< std::string > paramValues_m
void writeHeader()
Write SDDS header.
std::ios_base::openmode mode_m
First write to the statistics output file.
std::tuple< std::string, std::string, std::string > param_t
std::queue< param_t > params_m
void addParameter(const std::string &name, const std::string &type, const std::string &desc, const T &value)
void getParameterValue(std::string parameter_name, T &nval)
void getValue(int t, std::string column_name, T &nval)