Stimfit 0.12.7
src/libstfio/recording.h
Go to the documentation of this file.
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 #ifndef _RECORDING_H
00022 #define _RECORDING_H
00023 
00028 // #include "./channel.h"
00029 // #include "./section.h"
00030 // #include "./stfio.h"
00031 
00032 class Channel;
00033 class Section;
00034 
00036 
00040 class StfioDll Recording {
00041  public:
00042 
00043     //ctor/dtor-------------------------------------------------------
00045     explicit Recording();
00046 
00048 
00050     explicit Recording(const Channel& c_Channel); 
00051 
00053 
00055     explicit Recording(const std::vector<Channel>& ChannelList); 
00056 
00058 
00064     explicit Recording( std::size_t c_n_channels, std::size_t c_n_sections = 0, std::size_t c_n_points = 0 );
00065 
00067     virtual ~Recording();
00068 
00069     //member access functions: read-----------------------------------
00070     
00072 
00075     std::size_t GetChannelSize(std::size_t n_channel) const;
00076 
00078 
00080     const std::vector<Channel>& get() const { return ChannelArray; }
00081     
00083 
00085     std::vector<Channel>& get() { return ChannelArray; }
00086     
00088 
00090     const std::string& GetFileDescription() const { return file_description; }
00091 
00093 
00095     const std::string& GetGlobalSectionDescription() const { return global_section_description; }
00096 
00098 
00100     const std::string& GetScaling() const { return scaling; }
00101 
00103 
00105     const std::string& GetTime() const { return time; }
00106 
00108 
00110     const std::string& GetDate() const { return date; }
00111 
00113 
00115     const std::string& GetComment() const { return comment; }
00116     
00118 
00120     const std::string& GetXUnits() const { return xunits; }
00121 
00123 
00125     std::size_t size() const { return ChannelArray.size(); }
00126     
00128 
00130     double GetXScale() const { return dt; }
00131     
00133 
00135     double GetSR() const { return 1.0/dt; }
00136 
00138 
00142     const Channel& at(std::size_t n_c) const;
00143 
00145 
00149     Channel& at(std::size_t n_c);
00150 
00151     //member access functions: write---------------------------------
00152 
00154 
00156     void SetFileDescription(const std::string& value) { file_description=value; }
00157 
00159 
00161     void SetGlobalSectionDescription(const std::string& value) {
00162         global_section_description=value;
00163     }
00164 
00166 
00168     void SetScaling(const std::string& value) { scaling=value; }
00169  
00171 
00173     void SetTime(const std::string& value) { time=value; }
00174 
00176 
00178     void SetDate(const std::string& value) { date=value; }
00179 
00181 
00183     void SetComment(const std::string& value) { comment=value; }
00184     
00186 
00189     void SetGlobalYUnits(std::size_t n_channel, const std::string& value);
00190 
00192 
00194     void SetXUnits(const std::string& value) { xunits=value; }
00195 
00197 
00200     void SetXScale(double value);
00201     
00202     //misc-----------------------------------------------------------
00203 
00205 
00208     virtual void resize(std::size_t c_n_channels);
00209 
00211 
00215     virtual void InsertChannel(Channel& c_Channel, std::size_t pos);
00216 
00218 
00222     void CopyAttributes(const Recording& c_Recording);
00223 
00225 
00238     void MakeAverage( Section& AverageReturn, Section& SigReturn, std::size_t channel,
00239                       const std::vector<std::size_t>& section_index, bool isSig,
00240                       const std::vector<int>& shift) const;
00241 
00243 
00245     void AddRec(const Recording& toAdd);
00246     
00247     //operators------------------------------------------------------
00248 
00250 
00253     Channel& operator[](std::size_t at) { return ChannelArray[at]; }
00254 
00256 
00259     const Channel& operator[](std::size_t at) const { return ChannelArray[at]; }
00260 
00261  private:
00262     std::vector<Channel> ChannelArray;
00263     std::string global_section_description, scaling;
00264 
00265     /* public: */
00266     
00267     double dt;
00268     std::string file_description, time, date, comment, xunits;
00269 
00270     void init();
00271 
00272 };
00273 
00276 #endif