/* Copyright 2018 Michal Fratczak This file is part of habdec. habdec 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 3 of the License, or (at your option) any later version. habdec 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 habdec. If not, see . */ #pragma once #include #include namespace habdec { /* just a vector with spectrum power values and some extra info */ template class SpectrumInfo : public std::vector { public: typedef T TValue; mutable T min_ = 0; mutable T max_ = 0; mutable double noise_floor_ = 0; mutable double noise_variance_ = 0; mutable double sampling_rate_ = 0; mutable double shift_ = 0; mutable int peak_left_ = 0; mutable int peak_right_ = 0; mutable bool peak_left_valid_ = false; mutable bool peak_right_valid_ = false; SpectrumInfo() = default; template SpectrumInfo(const SpectrumInfo& rhs) : std::vector::vector(rhs), noise_floor_(rhs.noise_floor_), noise_variance_(rhs.noise_variance_), peak_left_(rhs.peak_left_), peak_right_(rhs.peak_right_), peak_left_valid_(rhs.peak_left_valid_), peak_right_valid_(rhs.peak_right_valid_) { // } template const SpectrumInfo& operator=(const SpectrumInfo& rhs) { std::vector::operator=(rhs); noise_floor_ = rhs.noise_floor_; noise_variance_ = rhs.noise_variance_; peak_left_ = rhs.peak_left_; peak_right_ = rhs.peak_right_; peak_left_valid_ = rhs.peak_left_valid_; peak_right_valid_ = rhs.peak_right_valid_; return *this; } const SpectrumInfo& operator=(const std::vector& rhs) { std::vector::operator=(rhs); return *this; } }; } // namespace habdec