Stimfit @PACKAGE_VERSION@
Loading...
Searching...
No Matches
channel.h
Go to the documentation of this file.
1// This program is free software; you can redistribute it and/or
2// modify it under the terms of the GNU General Public License
3// as published by the Free Software Foundation; either version 2
4// of the License, or (at your option) any later version.
5
6// This program is distributed in the hope that it will be useful,
7// but WITHOUT ANY WARRANTY; without even the implied warranty of
8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9// GNU General Public License for more details.
10
11// You should have received a copy of the GNU General Public License
12// along with this program; if not, write to the Free Software
13// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14
20
21#ifndef _CHANNEL_H
22#define _CHANNEL_H
23
27
28#include <deque>
29#include <string>
30
31#include "section.h"
32
35public:
36
37 //ctor/dtor---------------------------------------------------
39 explicit Channel(void);
40
42
44 explicit Channel(const Section& c_Section);
45
47
49 explicit Channel(const std::deque<Section>& SectionList);
50
52
58 explicit Channel(std::size_t c_n_sections, std::size_t section_size = 0);
59
62
63 //operators---------------------------------------------------
64
66
70 Section& operator[](std::size_t at_) { return SectionArray[at_]; }
71
73
77 const Section& operator[](std::size_t at_) const { return SectionArray[at_]; }
78
79 //member access: read-----------------------------------------
80
82
84 const std::string& GetChannelName() const { return name; }
85
87
89 const std::string& GetYUnits( ) const { return yunits; }
90
92
94 size_t size() const { return SectionArray.size(); }
95
97
101 const Section& at(std::size_t at_) const;
102
104
108 Section& at(std::size_t at_);
109
111
113 const std::deque< Section >& get() const { return SectionArray; }
114
115
117
119 std::deque< Section >& get() { return SectionArray; }
120
121 //member access: write----------------------------------------
122
124
126 void SetChannelName(const std::string& value) { name = value; }
127
129
131 void SetYUnits( const std::string& value ) { yunits = value; }
132
133 //misc--------------------------------------------------------
134
136
142 void InsertSection(const Section& c_Section, std::size_t pos);
143
145
147 void resize(std::size_t newSize);
148
150
153 void reserve(std::size_t resSize);
154
155private:
156 //private members---------------------------------------------
157
158 std::string name, yunits;
159
160 // An array of sections
161 std::deque< Section > SectionArray;
162
163};
164
166
167#endif
168
Represents a continuously sampled sweep of data points.
Definition section.h:36
#define StfioDll
Defines dll export or import functions for Windows.
Definition core.h:49
const Section & operator[](std::size_t at_) const
Unchecked access to a section (read-only)
Definition channel.h:77
const Section & at(std::size_t at_) const
Range-checked access to a section (read-only).
Channel(void)
Default constructor.
Channel(const std::deque< Section > &SectionList)
Constructor.
Section & operator[](std::size_t at_)
Unchecked access to a section (read and write)
Definition channel.h:70
~Channel()
Destructor.
const std::deque< Section > & get() const
Low-level access to the section array (read-only).
Definition channel.h:113
void resize(std::size_t newSize)
Resize the section array.
void SetYUnits(const std::string &value)
Sets the y units string.
Definition channel.h:131
void reserve(std::size_t resSize)
Reserve memory for a number of sections.
std::deque< Section > & get()
Low-level access to the section array (read and write).
Definition channel.h:119
void SetChannelName(const std::string &value)
Sets the channel name.
Definition channel.h:126
const std::string & GetYUnits() const
Retrieves the y units string.
Definition channel.h:89
Channel(std::size_t c_n_sections, std::size_t section_size=0)
Constructor.
Channel(const Section &c_Section)
Constructor.
size_t size() const
Retrieves the size of the section array.
Definition channel.h:94
const std::string & GetChannelName() const
Retrieves the channel name.
Definition channel.h:84
void InsertSection(const Section &c_Section, std::size_t pos)
Inserts a section at the given position, overwriting anything that's currently stored at that positio...
Section & at(std::size_t at_)
Range-checked access to a section (read and write).
Declares the Section class.