TOBI Interface A  0.1
tia::DataPacketImpl Class Reference

A Class to manage the DataPacket to be distributed over network. More...

#include <data_packet_impl.h>

+ Inheritance diagram for tia::DataPacketImpl:
+ Collaboration diagram for tia::DataPacketImpl:

Public Member Functions

 DataPacketImpl ()
 Default constructor -- building an empty DataPacket.
void reset (void *mem)
 Resets the whole DataPacket to be (re)build a DataPacket from raw memory.
virtual ~DataPacketImpl ()
 Destructor.
 DataPacketImpl (const DataPacketImpl &src)
 Copy constructor -- does NOT copy the raw memory representation.
virtual DataPacketImploperator= (const DataPacketImpl &src)
virtual void reset ()
 Resets the whole DataPacket (samples are deleted).
void incSampleNr ()
 Increase the static sample number by one.
virtual void incPacketID ()
virtual void insertDataBlock (std::vector< double > v, boost::uint32_t signal_flag, boost::uint16_t blocks, bool prepend=false)
 Insert data (only one signal type) from a hardware device into the DataPacket (will be automatically placed correct).
void setPacketNr (boost::uint64_t)
 Set the packet number (can differ from the samplenumber -- e.g. if sending with different rates)
virtual void setConnectionPacketNr (boost::uint64_t val)
boost::uint64_t getPacketNr ()
 Set the packet number (can differ from the samplenumber -- e.g. if sending with different rates)
virtual boost::uint64_t getConnectionPacketNr ()
void setBoostPosixTimestamp ()
 Set the timestamp to localtime.
boost::posix_time::ptime getBoostPosixTimestamp ()
 Get the timestamp (localtime) of the datapacket.
virtual void setTimestamp ()
 Set the timestamp to localtime.
virtual boost::uint64_t getTimestamp ()
 Get the timestamp (localtime) of the datapacket.
virtual bool hasFlag (boost::uint32_t f)
 Check, if a flag is already set.
virtual boost::uint16_t getNrOfSignalTypes ()
 Get the number of signal types stored in the DataPacket.
virtual boost::uint32_t getFlags ()
 Get the flags (including packetversion) of the DataPacket.
boost::uint64_t getSampleNr ()
 Get the sample number of the DataPacket.
virtual boost::uint64_t getPacketID ()
virtual void setPacketID (boost::uint64_t val)
virtual std::vector
< boost::uint16_t > 
getNrOfBlocks ()
 Get a vector containing the blocksizes for every signal type.
std::vector< boost::uint16_t > getNrOfSamples ()
 Get a vector containing the number of values (NOT channels!) for every signal type.
const std::vector< double > & getData ()
 Get all samples stored in the DataPacket as a vector.
virtual std::vector< double > getSingleDataBlock (boost::uint32_t flag)
 Get a vector containing all samples for a specific signal type.
virtual boost::uint16_t getNrOfSamples (boost::uint32_t flag)
 Get the number of values for a specific signal type.
boost::uint16_t getNrOfBlocks (boost::uint32_t flag)
 Get the number of blocks for a specific signal type.
virtual std::vector
< boost::uint16_t > 
getNrSamplesPerChannel ()
virtual std::vector
< boost::uint16_t > 
getNrOfChannels ()
virtual boost::uint16_t getNrOfChannels (boost::uint32_t flag)
virtual boost::uint16_t getNrSamplesPerChannel (boost::uint32_t flag)
virtual void * getRaw ()
 Get a pointer to a memory region, containing the raw representation of the DataPacket.
virtual boost::uint32_t getRawMemorySize ()
 Get the size (in bytes) of the raw memory region holding the raw DataPacket.
virtual boost::uint32_t getRequiredRawMemorySize ()
 Get the required size (in bytes) to hold a given raw DataPacket.
virtual boost::uint32_t getRequiredRawMemorySize (void *mem, boost::uint32_t bytes_available)
 Get the required size (in bytes) to hold raw DataPacket stored in RAW memory. This function can be used to check, wether a memory region is able to hold a whole DataPacket by analyzing its header. If the RAW memory Region is too small to hold the DataPacket, 0 is returned.

Detailed Description

A Class to manage the DataPacket to be distributed over network.

The DataPacket class provides methods inserting Samples of different, predefined signal types (see defines.h) into a packet. Inserted data is identified through flags. The datapacket stores the acquired samples in ascending order by their signal types. (EEG first, then EMG, EOG, ...). It provides methods to get stored data wether again as a vector or in a raw representation. For raw representations, it holds raw memory objects, storing the respective representation.

Todo:
Implementing the possibility to built a raw DataPacket representation with freely selectable content.

Definition at line 73 of file data_packet_impl.h.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations