Line data Source code
1 : /* Copyright (C) 2025 Robert Schiwon 2 : * 3 : * This file is part of libjdx. 4 : * 5 : * libjdx is free software: you can redistribute it and/or modify it under the 6 : * terms of the GNU Lesser General Public License as published by the Free 7 : * Software Foundation, either version 3 of the License, or (at your option) any 8 : * later version. 9 : * 10 : * libjdx is distributed in the hope that it will be useful, but WITHOUT ANY 11 : * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 : * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 : * details. 14 : * 15 : * You should have received a copy of the GNU Lesser General Public License 16 : * along with libjdx. If not, see <https://www.gnu.org/licenses/>. 17 : */ 18 : #include "jdx/PeakTable.hpp" 19 : #include "util/LdrUtils.hpp" 20 : #include "util/PeakTableParser.hpp" 21 : 22 : #include <algorithm> 23 : #include <tuple> 24 : 25 34 : libjdx::jdx::PeakTable::PeakTable(const std::string& label, 26 : std::string variableList, io::TextReader& reader, 27 34 : std::optional<std::string>& nextLine) 28 35 : : TabularData(label, std::move(variableList), reader) 29 : { 30 36 : validateInput(getLabel(), getVariableList(), s_peakTableLabel, 31 70 : std::vector<std::string>{std::begin(s_peakTableVariableLists), 32 : std::end(s_peakTableVariableLists)}); 33 33 : util::skipToNextLdr(reader, nextLine, true); 34 33 : } 35 : 36 15 : std::vector<libjdx::jdx::Peak> libjdx::jdx::PeakTable::getData() const 37 : { 38 19 : util::PeakTableParser parser{getReader(), getVariableList()}; 39 30 : return TabularData::getData<util::PeakTableParser, Peak>(parser); 40 : }