Stimfit  0.13.15
Public Member Functions
Recording Class Reference

Represents the data within a file. More...

#include <recording.h>

Inheritance diagram for Recording:
Inheritance 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 ()
 Retrieves the time of recording as a string.
const std::string & GetDate ()
 Retrieves the date of recording as a string.
struct tm GetDateTime () 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 )
std::size_t GetCurChIndex () const
 Retrieves the index of the current channel.
std::size_t GetSecChIndex () const
 Retrieves the index of the second channel.
std::size_t GetCurSecIndex () const
 Retrieves the index of the current section.
const std::vector< std::size_t > & GetSelectedSections () const
 Retrieves the indices of the selected sections (read-only).
std::vector< std::size_t > & GetSelectedSectionsW ()
 Retrieves the indices of the selected sections (read and write).
const Vector_double & GetSelectBase () const
 Retrieves the stored baseline values of the selected sections (read-only).
Vector_double & GetSelectBaseW ()
 Retrieves the stored baseline values of the selected sections (read and write).
const Sectioncursec () const
 Retrieves the currently accessed section in the active channel (read-only)
Sectioncursec ()
 Retrieves the currently accessed section in the active channel (read and write)
const Sectionsecsec () const
 Retrieves the currently accessed section in the second (reference) channel (read-only)
const Channelcurch () const
 Retrieves the active channel (read-only)
Channelcurch ()
 Retrieves active channel (read and write)
const Channelsecch () const
 Retrieves the second (reference) channel (read-only)
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.
int SetTime (const std::string &value)
 Sets the time of recording as a string.
int SetTime (int hour, int minute, int sec)
int SetDate (const std::string &value)
 Sets the date of recording as a string.
int SetDate (int year, int month, int mday)
void SetDateTime (const struct tm &value)
 Sets the date and time of recording as struct tm.
void SetDateTime (int year, int month, int mday, int hour, int minute, int sec)
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.
void SetCurChIndex (std::size_t value)
 Sets the index of the current channel.
void SetSecChIndex (std::size_t value)
 Sets the index of the second channel.
void SetCurSecIndex (std::size_t value)
 Sets the index of the current section.
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.
void SelectTrace (std::size_t sectionToSelect, std::size_t base_start, std::size_t base_end)
 Selects a section.
bool UnselectTrace (std::size_t sectionToUnselect)
 Unselects a section if it was selected before.
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.

Definition at line 39 of file recording.h.


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 Channel& Recording::curch ( ) const [inline]

Retrieves the active channel (read-only)

Returns:
The active channel.

Definition at line 194 of file recording.h.

Channel& Recording::curch ( ) [inline]

Retrieves active channel (read and write)

Returns:
The active channel.

Definition at line 199 of file recording.h.

const Section& Recording::cursec ( ) const [inline]

Retrieves the currently accessed section in the active channel (read-only)

Returns:
The currently accessed section in the active channel.

Definition at line 179 of file recording.h.

Section& Recording::cursec ( ) [inline]

Retrieves the currently accessed section in the active channel (read and write)

Returns:
The currently accessed section in the active channel.

Definition at line 184 of file recording.h.

const std::vector<Channel>& Recording::get ( ) const [inline]

Retrieves the channels (read-only).

Returns:
A vector containing the channels.

Definition at line 79 of file recording.h.

std::vector<Channel>& Recording::get ( ) [inline]

Retrieves the channels (read and write).

Returns:
A vector containing the channels.

Definition at line 84 of file recording.h.

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.

Definition at line 119 of file recording.h.

std::size_t Recording::GetCurChIndex ( ) const [inline]

Retrieves the index of the current channel.

Returns:
The index of the current channel.

Definition at line 144 of file recording.h.

std::size_t Recording::GetCurSecIndex ( ) const [inline]

Retrieves the index of the current section.

Returns:
The index of the current section.

Definition at line 154 of file recording.h.

const std::string& Recording::GetDate ( )

Retrieves the date of recording as a string.

Returns:
A string containing the date of recording.
struct tm Recording::GetDateTime ( ) const [inline, read]

Retrieves the date of recording as a string.

Returns:
A string containing the date of recording.

Definition at line 114 of file recording.h.

const std::string& Recording::GetFileDescription ( ) const [inline]

Retrieves the file description.

Returns:
The file description.

Definition at line 89 of file recording.h.

const std::string& Recording::GetGlobalSectionDescription ( ) const [inline]

Retrieves the common section description.

Returns:
The common section description.

Definition at line 94 of file recording.h.

const std::string& Recording::GetScaling ( ) const [inline]

Retrieves the scaling as a string.

Returns:
A string containing the description.

Definition at line 99 of file recording.h.

std::size_t Recording::GetSecChIndex ( ) const [inline]

Retrieves the index of the second channel.

Returns:
The index of the second channel.

Definition at line 149 of file recording.h.

const Vector_double& Recording::GetSelectBase ( ) const [inline]

Retrieves the stored baseline values of the selected sections (read-only).

Returns:
A vector containing the stored baseline values of the selected sections.

Definition at line 169 of file recording.h.

Vector_double& Recording::GetSelectBaseW ( ) [inline]

Retrieves the stored baseline values of the selected sections (read and write).

Returns:
A vector containing the stored baseline values of the selected sections.

Definition at line 174 of file recording.h.

const std::vector<std::size_t>& Recording::GetSelectedSections ( ) const [inline]

Retrieves the indices of the selected sections (read-only).

Returns:
A vector containing the indices of the selected sections.

Definition at line 159 of file recording.h.

std::vector<std::size_t>& Recording::GetSelectedSectionsW ( ) [inline]

Retrieves the indices of the selected sections (read and write).

Returns:
A vector containing the indices of the selected sections.

Definition at line 164 of file recording.h.

double Recording::GetSR ( ) const [inline]

Retrieves the sampling rate ( 1 / x-scale )

Returns:
The sampling rate.

Definition at line 139 of file recording.h.

const std::string& Recording::GetTime ( )

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.

Definition at line 134 of file recording.h.

const std::string& Recording::GetXUnits ( ) const [inline]

Retrieves the x units.

Returns:
The x units. Currently hard-coded to be "ms".

Definition at line 124 of file recording.h.

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.

Definition at line 360 of file recording.h.

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.

Definition at line 366 of file recording.h.

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.

const Channel& Recording::secch ( ) const [inline]

Retrieves the second (reference) channel (read-only)

Returns:
The second (reference) channel.

Definition at line 204 of file recording.h.

const Section& Recording::secsec ( ) const [inline]

Retrieves the currently accessed section in the second (reference) channel (read-only)

Returns:
The currently accessed section in the second (reference) channel.

Definition at line 189 of file recording.h.

void Recording::SelectTrace ( std::size_t  sectionToSelect,
std::size_t  base_start,
std::size_t  base_end 
)

Selects a section.

Parameters:
sectionToSelectThe index of the section to be selected.
base_startStart index for baseline
base_endEnd index for baseline
void Recording::SetComment ( const std::string &  value) [inline]

Sets a comment string.

Parameters:
valueA string containing a comment.

Definition at line 262 of file recording.h.

void Recording::SetCurChIndex ( std::size_t  value)

Sets the index of the current channel.

Parameters:
valueThe index of the current channel.
void Recording::SetCurSecIndex ( std::size_t  value)

Sets the index of the current section.

Parameters:
valueThe index of the current section.
int Recording::SetDate ( const std::string &  value)

Sets the date of recording as a string.

Parameters:
valueA string containing the date of recording.
Returns:
0 in case of success, non-zero in case of failure
void Recording::SetDateTime ( const struct tm &  value) [inline]

Sets the date and time of recording as struct tm.

Parameters:
valuehas type struct tm

Definition at line 256 of file recording.h.

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

Sets the file description.

Parameters:
valueThe file description.

Definition at line 225 of file recording.h.

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

Sets the common section description.

Parameters:
valueThe common section description.

Definition at line 230 of file recording.h.

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.

Definition at line 237 of file recording.h.

void Recording::SetSecChIndex ( std::size_t  value)

Sets the index of the second channel.

Parameters:
valueThe index of the second channel.
int Recording::SetTime ( const std::string &  value)

Sets the time of recording as a string.

Parameters:
valueA string containing the time of recording.
Returns:
0 in case of success, non-zero in case of failure
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.

Definition at line 273 of file recording.h.

std::size_t Recording::size ( ) const [inline]

Retrieves the size of the channel array.

Returns:
The size of the channel array.

Definition at line 129 of file recording.h.

bool Recording::UnselectTrace ( std::size_t  sectionToUnselect)

Unselects a section if it was selected before.

Parameters:
sectionToUnselectThe index of the section to be unselected.
Returns:
true if the section was previously selected, false otherwise.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines