|
TOBI SignalServer
0.1
|
A container storing and sorting samples directly acquired from a data acquisition device. More...
#include <sample_block.h>
Inheritance diagram for tobiss::SampleBlock< T >:
Collaboration diagram for tobiss::SampleBlock< T >:Public Member Functions | |
| SampleBlock () | |
| Default constructor -- building an empty SampleBlock (unusable before init()). | |
| virtual | ~SampleBlock () |
| Default Destructor. | |
| boost::uint16_t | getNrOfBlocks () |
| Return the blocksize, the data can be stored with. | |
| boost::uint16_t | getNrOfChannels () |
| Return the number of channels that can be stored in the SampleBlock. | |
| boost::uint16_t | getNrOfSamples () |
| Return the amount of samples stored in the SampleBlock. | |
| boost::uint16_t | getNrOfSignalTypes () |
| Return the number of different signal types that can be stored in the SampleBlock. | |
| void | deleteSamples () |
| Delete all samples stored in the SampleBlock. | |
| void | reset () |
| Sets the block counter for blocks to be appended bach to zero. | |
| T | at (boost::uint32_t n) |
| Access the n-th sample. | |
| T | operator[] (boost::uint32_t n) |
| Access the n-th sample. | |
| void | init (boost::uint16_t blocksize, boost::uint16_t nr_ch, std::vector< boost::uint32_t > sig_types) |
| Sets the block counter for blocks to be appended bach to zero. | |
| std::vector< boost::uint32_t > | getTypes () |
| Get a vector with the signal types to be stored in the SampleBlock. | |
| std::vector< T > | getSamples () |
| Get a vector with all samples stored. | |
| boost::uint32_t | getFlagByNr (boost::uint32_t nr) |
| Get the flag of the n-th signal type. | |
| std::vector< T > | getSignalByFlag (boost::uint32_t flag) |
| Get a vector containing samples defined by a flag. | |
| void | getSignalByFlag (boost::uint32_t flag, std::vector< T > &v) |
| Get a vector containing samples defined by a flag. | |
| std::vector< T > | getSignalByNr (boost::uint32_t nr) |
| Get samples of the n-th signal type stored. | |
| void | getSignalByNr (boost::uint32_t nr, std::vector< T > &v) |
| Get samples of the n-th ;signal type stored. | |
| void | appendBlock (std::vector< T > v, boost::uint16_t nr_blocks) |
| Append samples to the SampleBlock. (used to build blocked data) | |
| void | setSamples (std::vector< T > v) |
| Directly set samples into the SampleBlock. | |
Private Member Functions | |
| void | sort (std::vector< T > &v, std::vector< boost::uint32_t > order, boost::uint32_t nr_blocks) |
| Sort a given sample vector by an given order (unordered) vector. | |
| void | checkBlockIntegrity () |
| Check the block integrity (if number of samples equals equals blocks_ *channels_). | |
Private Attributes | |
| boost::uint16_t | blocks_ |
| Blocksize to be used. | |
| boost::uint16_t | channels_ |
| Number of channels to be stored. | |
| bool | homogenous_ |
| To avoid sorting, if only one signal type is stored in the SampleBlock. | |
| boost::uint16_t | curr_block_ |
| Counter to know the current block. | |
| std::vector< boost::uint32_t > | types_input_ |
| Order, how signal types come from the hardware device. | |
| std::map< boost::uint32_t, std::pair< boost::uint16_t, boost::uint16_t > > | block_info_ |
| A Map to store every the offset and number of values for every signal type. | |
| std::vector< T > | samples_ |
| A vector containing the data. | |
A container storing and sorting samples directly acquired from a data acquisition device.
| T | Datatype to be used to store samples in this class. |
A SampleBlock stores samples directly acquired from a data acquisition device and sorts them internally in the correct ascending order (by their signal type -- EEG first, then EMG, ... see defines.h for signal types and their order). The sorting is done by a simple bubble-sort algorithm. A SampleBlock can handle blocked and non-blocked data. Non-blocked data is stored as one channel in an element of a vector with first the channels of one signal type ascending order and afterwards the signal types also in ascending order. --> e.g. EEG_ch1 EEG_ch2 EEG_ch4 EMG_ch3 EMG_ch6 .... (if signal types are not conected ascending to the hardware device, the sample block will reorder the channels like demostrated above -- an EMG channel was placed "between" EEG channels and channel 5 was left blank) Using a blocked data acquisition samples are stored that way: --> e.g. EEG_ch1_bl1 EEG_ch1_bl2 EEG_ch2_bl1 EEG_ch2_bl2 EEG_ch4_bl1 EEG_ch4_bl2 EMG_ch3_bl1 EMG_ch3_bl2 EMG_ch6_bl1 EMG_ch6_bl2 Blocked data storage can be achieved by sampling without blocks and appending samples to the SampleBlock (appendBlock()) or by inserting a samples vector containing already blocked data.
The number of channels and the blocksize have to be defined by initializing the SampleBlock.
Definition at line 90 of file sample_block.h.