Stimfit
0.13.15
|
00001 // This program is free software; you can redistribute it and/or 00002 // modify it under the terms of the GNU General Public License 00003 // as published by the Free Software Foundation; either version 2 00004 // of the License, or (at your option) any later version. 00005 00006 // This program is distributed in the hope that it will be useful, 00007 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00008 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00009 // GNU General Public License for more details. 00010 00011 // You should have received a copy of the GNU General Public License 00012 // along with this program; if not, write to the Free Software 00013 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00014 00021 /*------------------------------------------------------------------------ 00022 * References: 00023 * [1] Stroustrup, B.: The C++ Programming Language. 3rd ed. 1997 00024 * [2] Meyers, S.: Effective C++. 3rd ed. 2005 00025 --------------------------------------------------------------------------*/ 00026 // only compile once, even if included more often: 00027 #ifndef _SECTION_H 00028 #define _SECTION_H 00029 00034 00035 class StfioDll Section { 00036 public: 00037 // Construction/Destruction----------------------------------------------- 00039 explicit Section(); 00040 00042 00045 explicit Section( 00046 const Vector_double& valA, 00047 const std::string& label="\0" 00048 ); 00049 00051 00054 explicit Section( 00055 std::size_t size, 00056 const std::string& label="\0" 00057 ); 00058 00060 ~Section(); 00061 00062 // Operators-------------------------------------------------------------- 00064 00067 double& operator[](std::size_t at) { return data[at]; } 00068 00070 00073 double operator[](std::size_t at) const { return data[at]; } 00074 00075 // Public member functions------------------------------------------------ 00076 00078 00082 double at(std::size_t at_) const; 00083 00085 00089 double& at(std::size_t at_); 00090 00092 00096 const Vector_double& get() const { return data; } 00097 00099 00103 Vector_double& get_w() { return data; } 00104 00106 00110 void resize(std::size_t new_size) { data.resize(new_size); } 00111 00113 00115 size_t size() const { return data.size(); } 00116 00118 00120 void SetXScale(double value); 00121 00123 00125 double GetXScale() const { return x_scale; } 00126 00128 00130 const std::string& GetSectionDescription() const { return section_description; } 00131 00133 00135 void SetSectionDescription(const std::string& value) { section_description=value; } 00136 00137 private: 00138 //Private members------------------------------------------------------- 00139 00140 // A description that is specific to this section: 00141 std::string section_description; 00142 00143 // The sampling interval: 00144 double x_scale; 00145 00146 // The data: 00147 Vector_double data; 00148 }; 00149 00152 #endif