Commit 21785a36 authored by cornimueller's avatar cornimueller
Browse files

[ADD #89] Added method to get the number of samples of a given segment

parent d3e91b26
......@@ -50,6 +50,13 @@ WEEG2Segment::WEEG2Segment( std::size_t segmentID, boost::shared_ptr< WPagerEEG
stream << "The EEG has no segment number " << m_segmentID;
throw WOutOfBounds( stream.str() );
}
m_nbSamples = m_pager->getNumberOfSamples( m_segmentID );
}
std::size_t WEEG2Segment::getNumberOfSamples() const
{
return m_nbSamples;
}
boost::shared_ptr< WEEGValueMatrix > WEEG2Segment::getValues( std::size_t start, std::size_t length ) const
......
......@@ -49,6 +49,13 @@ public:
*/
WEEG2Segment( std::size_t segmentID, boost::shared_ptr< WPagerEEG > pager );
/**
* Get the number of samples this segment consists of.
*
* \return number of samples
*/
std::size_t getNumberOfSamples() const;
/**
* Get the values of all channels for a given sample range.
*
......@@ -62,6 +69,7 @@ protected:
private:
std::size_t m_segmentID; //!< number of this segment
boost::shared_ptr< WPagerEEG > m_pager; //!< pager class which contains the data, read from a file on demand
std::size_t m_nbSamples; //!< number of samples this segment consists of
};
#endif // WEEG2SEGMENT_H
......@@ -60,6 +60,14 @@ public:
*/
virtual std::size_t getNumberOfChannels() const = 0;
/**
* Get the number of samples of a given segment.
*
* \param segmentID segment number being inspected
* \return number of samples
*/
virtual std::size_t getNumberOfSamples( std::size_t segmentID ) const = 0;
/**
* Get the values of all channels for a given sample range.
*
......
......@@ -98,6 +98,18 @@ std::size_t WPagerEEGLibeep::getNumberOfChannels() const
return m_nbChannels;
}
std::size_t WPagerEEGLibeep::getNumberOfSamples( std::size_t segmentID ) const
{
if( segmentID != 0 )
{
std::ostringstream stream;
stream << m_fileName << " has no segment number " << segmentID;
throw WOutOfBounds( stream.str() );
}
return m_nbSamples;
}
boost::shared_ptr< WEEGValueMatrix > WPagerEEGLibeep::getValues( std::size_t segmentID, std::size_t start, std::size_t length ) const
{
if( segmentID != 0 )
......
......@@ -62,6 +62,8 @@ public:
virtual std::size_t getNumberOfChannels() const;
virtual std::size_t getNumberOfSamples( std::size_t segmentID ) const;
virtual boost::shared_ptr< WEEGValueMatrix > getValues( std::size_t segmentID, std::size_t start, std::size_t length ) const;
virtual std::string getChannelLabel( std::size_t channelID ) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment