13 , mode_m(std::ios::out)
16 namespace fs = boost::filesystem;
18 if (fs::exists(
fname_m) && restart) {
33 std::queue<std::string> allLines;
36 fs.open (
fname_m.c_str(), std::fstream::in);
38 if (!fs.is_open())
return;
40 while (getline(fs, line)) {
46 fs.open (
fname_m.c_str(), std::fstream::out);
48 if (!fs.is_open())
return;
50 while (allLines.size() > numberOfLines) {
51 fs << allLines.front() <<
"\n";
63 std::string versionFile;
69 std::queue<std::string> allLines;
72 fs.open (
fname_m.c_str(), std::fstream::in);
74 if (!fs.is_open())
return;
76 while (getline(fs, line)) {
82 fs.open (
fname_m.c_str(), std::fstream::out);
84 if (!fs.is_open())
return;
86 while (allLines.size() > 0) {
87 line = allLines.front();
89 if (line != versionFile) {
119 os_m.setf(std::ios::scientific, std::ios::floatfield);
148 os_m <<
"&description\n"
159 os_m <<
"¶meter\n"
160 <<
indent_m <<
"name=" << std::get<0>(param) <<
",\n"
161 <<
indent_m <<
"type=" << std::get<1>(param) <<
",\n"
162 <<
indent_m <<
"description=\"" << std::get<2>(param) <<
"\"\n"
191 std::stringstream revision;
200 flavor =
"opal-cycl";
207 addParameter(
"revision",
"string",
"git revision of opal", revision.str());
209 addParameter(
"flavor",
"string",
"OPAL flavor that wrote file", flavor);
std::tuple< std::string, std::string, std::string > param_t
void writeHeader()
Write SDDS header.
static constexpr unsigned int precision_m
void rewindLines(size_t numberOfLines)
delete the last 'numberOfLines' lines of the file 'fileName'
void getParameterValue(std::string parameter_name, T &nval)
std::queue< param_t > params_m
double getLastValue(const std::string &column)
SDDSWriter(const std::string &fname, bool restart)
void addParameter(const std::string &name, const std::string &type, const std::string &desc, const T &value)
static OpalData * getInstance()
#define OPAL_PROJECT_NAME
#define OPAL_PROJECT_VERSION
std::ios_base::openmode mode_m
First write to the statistics output file.
std::string getGitRevision()
void writeHeader(std::ostream &os, const std::string &indent) const
void addDefaultParameters()
void getValue(int t, std::string column_name, T &nval)
std::queue< std::string > paramValues_m
void replaceVersionString()
Inform & endl(Inform &inf)