/*! \file write_named_series.cc * \brief write named series to output file (implementation) * * ---------------------------------------------------------------------------- * * \author Thomas Forbriger * \date 06/02/2019 * * write named series to output file (implementation) * * Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach) * * ---- * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * ---- * * REVISIONS and CHANGES * - 06/02/2019 V1.0 Thomas Forbriger * * ============================================================================ */ #define TF_WRITE_NAME_SERIES_CC_VERSION \ "TF_WRITE_NAME_SERIES_CC V1.0" #include "croposp.h" #include #include using std::cout; using std::endl; namespace croposp { void write_named_series(const std::string& filename, const std::string& comment, psd::TDseries f, const TNamedSeriesVector& nsv, const Options& opt) { if (opt.verbose) { cout << endl << "output to file " << filename << ":" << endl << comment << endl; } if (!opt.overwrite) { std::ifstream file(filename.c_str(), std::ios_base::in); TFXX_assert((!file.good()),"ERROR: output file exists!"); } TFXX_assert(nsv.size()>0, "data container is empty"); std::ofstream os(filename.c_str()); os << "# " << CROPOSP_VERSION << endl; os << "# " << comment << endl; for (unsigned int i=0; i