Stimfit 0.12.7
Public Member Functions
Recording Class Reference

Represents the data within a file. More...

#include <recording.h>

Inheritance diagram for Recording:
Inheritance graph
[legend]
Collaboration diagram for Recording:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Recording ()
 Default constuctor.
 Recording (const Channel &c_Channel)
 Constructor.
 Recording (const std::vector< Channel > &ChannelList)
 Constructor.
 Recording (std::size_t c_n_channels, std::size_t c_n_sections=0, std::size_t c_n_points=0)
 Constructor.
virtual ~Recording ()
 Destructor.
std::size_t GetChannelSize (std::size_t n_channel) const
 Retrieves the number of sections in a channel.
const std::vector< Channel > & get () const
 Retrieves the channels (read-only).
std::vector< Channel > & get ()
 Retrieves the channels (read and write).
const std::string & GetFileDescription () const
 Retrieves the file description.
const std::string & GetGlobalSectionDescription () const
 Retrieves the common section description.
const std::string & GetScaling () const
 Retrieves the scaling as a string.
const std::string & GetTime () const
 Retrieves the time of recording as a string.
const std::string & GetDate () const
 Retrieves the date of recording as a string.
const std::string & GetComment () const
 Retrieves a comment string.
const std::string & GetXUnits () const
 Retrieves the x units.
std::size_t size () const
 Retrieves the size of the channel array.
double GetXScale () const
 Retrieves the x scaling (sampling interval).
double GetSR () const
 Retrieves the sampling rate ( 1 / x-scale )
const Channelat (std::size_t n_c) const
 Range-checked access to a channel (read-only).
Channelat (std::size_t n_c)
 Range-checked access to a channel (read and write).
void SetFileDescription (const std::string &value)
 Sets the file description.
void SetGlobalSectionDescription (const std::string &value)
 Sets the common section description.
void SetScaling (const std::string &value)
 Sets the scaling as a string.
void SetTime (const std::string &value)
 Sets the time of recording as a string.
void SetDate (const std::string &value)
 Sets the date of recording as a string.
void SetComment (const std::string &value)
 Sets a comment string.
void SetGlobalYUnits (std::size_t n_channel, const std::string &value)
 Sets the y units for a channel.
void SetXUnits (const std::string &value)
 Sets the x units.
void SetXScale (double value)
 Sets the x scaling.
virtual void resize (std::size_t c_n_channels)
 Resize the Recording to a new number of channels.
virtual void InsertChannel (Channel &c_Channel, std::size_t pos)
 Insert a Channel at a given position.
void CopyAttributes (const Recording &c_Recording)
 Copy descriptive attributes from another Recording to this Recording.
void MakeAverage (Section &AverageReturn, Section &SigReturn, std::size_t channel, const std::vector< std::size_t > &section_index, bool isSig, const std::vector< int > &shift) const
 Calculates an average of several traces.
void AddRec (const Recording &toAdd)
 Add a Recording at the end of this Recording.
Channeloperator[] (std::size_t at)
 Unchecked channel access (read and write)
const Channeloperator[] (std::size_t at) const
 Unchecked channel access (read-only)

Detailed Description

Represents the data within a file.

Contains an array of channels that can be accessed either via at() (range-checked, will throw an exception if out of range) or the []-operator (range unchecked). Moreover all the metadata such as time, date, samling rate and comments are stored here.


Constructor & Destructor Documentation

Recording::Recording ( const Channel c_Channel) [explicit]

Constructor.

Parameters:
c_ChannelThe Channel from which to construct a new Recording.
Recording::Recording ( const std::vector< Channel > &  ChannelList) [explicit]

Constructor.

Parameters:
ChannelListA vector of channels from which to construct a new Recording.
Recording::Recording ( std::size_t  c_n_channels,
std::size_t  c_n_sections = 0,
std::size_t  c_n_points = 0 
) [explicit]

Constructor.

Setting the number of channels and sections at construction time will avoid unnecessary memory re-allocations.

Parameters:
c_n_channelsThe number of channels.
c_n_sectionsThe number of sections.
c_n_pointsThe number of sampling points per section.

Member Function Documentation

void Recording::AddRec ( const Recording toAdd)

Add a Recording at the end of this Recording.

Parameters:
toAddThe Recording to be added.
const Channel& Recording::at ( std::size_t  n_c) const

Range-checked access to a channel (read-only).

Will throw std::out_of_range if out of range.

Parameters:
n_cThe index of the channel.
Returns:
The channel at index n_c.
Channel& Recording::at ( std::size_t  n_c)

Range-checked access to a channel (read and write).

Will throw std::out_of_range if out of range.

Parameters:
n_cThe index of the channel.
Returns:
The channel at index n_c.
void Recording::CopyAttributes ( const Recording c_Recording)

Copy descriptive attributes from another Recording to this Recording.

This will copy the file and global section decription, the scaling, time, date, comment and global y units strings and the x-scale.

Parameters:
c_RecordingThe Recording from which to copy the attributes.
const std::vector<Channel>& Recording::get ( ) const [inline]

Retrieves the channels (read-only).

Returns:
A vector containing the channels.
std::vector<Channel>& Recording::get ( ) [inline]

Retrieves the channels (read and write).

Returns:
A vector containing the channels.
std::size_t Recording::GetChannelSize ( std::size_t  n_channel) const

Retrieves the number of sections in a channel.

Parameters:
n_channelThe index of the channel (range-checked).
Returns:
The number of sections in n_channel.
const std::string& Recording::GetComment ( ) const [inline]

Retrieves a comment string.

Returns:
A string containing a comment.
const std::string& Recording::GetDate ( ) const [inline]

Retrieves the date of recording as a string.

Returns:
A string containing the date of recording.
const std::string& Recording::GetFileDescription ( ) const [inline]

Retrieves the file description.

Returns:
The file description.
const std::string& Recording::GetGlobalSectionDescription ( ) const [inline]

Retrieves the common section description.

Returns:
The common section description.
const std::string& Recording::GetScaling ( ) const [inline]

Retrieves the scaling as a string.

Returns:
A string containing the description.
double Recording::GetSR ( ) const [inline]

Retrieves the sampling rate ( 1 / x-scale )

Returns:
The sampling rate.
const std::string& Recording::GetTime ( ) const [inline]

Retrieves the time of recording as a string.

Returns:
A string containing the time of recording.
double Recording::GetXScale ( ) const [inline]

Retrieves the x scaling (sampling interval).

Returns:
The x scaling.
const std::string& Recording::GetXUnits ( ) const [inline]

Retrieves the x units.

Returns:
The x units. Currently hard-coded to be "ms".
virtual void Recording::InsertChannel ( Channel c_Channel,
std::size_t  pos 
) [virtual]

Insert a Channel at a given position.

Will throw std::out_of_range if range check fails.

Parameters:
c_ChannelThe Channel to be inserted.
posThe position at which to insert the channel (0-based).

Reimplemented in wxStfDoc.

void Recording::MakeAverage ( Section AverageReturn,
Section SigReturn,
std::size_t  channel,
const std::vector< std::size_t > &  section_index,
bool  isSig,
const std::vector< int > &  shift 
) const

Calculates an average of several traces.

Parameters:
AverageReturnThe average will be returned in this variable by passing a reference. AverageReturn has to have the correct size upon entering this function already, it won't be resized.
SigReturnThe standard deviation will be returned in this variable by passing a reference if isSig == true. SigReturn has to have the correct size upon entering this function already, it won't be resized.
channelThe index of the channel to be used.
section_indexA vector containing the indices of the sections to be used for the average.
isSigSet to true if the standard deviation should be calculated as well.
shiftA vector indicating by how many data points each section should be shifted before averaging.
Channel& Recording::operator[] ( std::size_t  at) [inline]

Unchecked channel access (read and write)

Use at() for range-checked access.

Parameters:
atThe channel index.
const Channel& Recording::operator[] ( std::size_t  at) const [inline]

Unchecked channel access (read-only)

Use at() for range-checked access.

Parameters:
atThe channel index.
virtual void Recording::resize ( std::size_t  c_n_channels) [virtual]

Resize the Recording to a new number of channels.

Resizes both the channel and the global y units arrays.

Parameters:
c_n_channelsThe new number of channels.

Reimplemented in wxStfDoc.

void Recording::SetComment ( const std::string &  value) [inline]

Sets a comment string.

Parameters:
valueA string containing a comment.
void Recording::SetDate ( const std::string &  value) [inline]

Sets the date of recording as a string.

Parameters:
valueA string containing the date of recording.
void Recording::SetFileDescription ( const std::string &  value) [inline]

Sets the file description.

Parameters:
valueThe file description.
void Recording::SetGlobalSectionDescription ( const std::string &  value) [inline]

Sets the common section description.

Parameters:
valueThe common section description.
void Recording::SetGlobalYUnits ( std::size_t  n_channel,
const std::string &  value 
)

Sets the y units for a channel.

Parameters:
n_channelThe channel index for which to set the units.
valueA string containing the y units.
void Recording::SetScaling ( const std::string &  value) [inline]

Sets the scaling as a string.

Parameters:
valueA string containing the description.
void Recording::SetTime ( const std::string &  value) [inline]

Sets the time of recording as a string.

Parameters:
valueA string containing the time of recording.
void Recording::SetXScale ( double  value)

Sets the x scaling.

Note that setting the global x-scale will set it for all sections

Parameters:
valueThe x scaling.
void Recording::SetXUnits ( const std::string &  value) [inline]

Sets the x units.

Parameters:
valueA string containing the x units.
std::size_t Recording::size ( ) const [inline]

Retrieves the size of the channel array.

Returns:
The size of the channel array.

The documentation for this class was generated from the following file: