Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Representations/Perception/SensorDataBuffer.h

Go to the documentation of this file.

    00001 /**
    00002 * @file SensorDataBuffer.h
    00003 *
    00004 * Definition of SensorDataBuffer class.
    00005 *
    00006 * @author Max Risler
    00007 */
    00008 #ifndef __SENSORDATABUFFER_H__
    00009 #define __SENSORDATABUFFER_H__
    00010
    00011 #include "SensorData.h"
    00012
    00013 #include "Tools/Streams/InOut.h"
    00014 #include "Tools/Streams/Streamable.h"
    00015
    00016 /**
    00017 * A buffer for sensor data sets, containing all frames received at the same time.
    00018 * @author Max Risler
    00019 */
    00020 class SensorDataBuffer
    00021 {
    00022 public:
    00023   /** Maximum number of frames in the buffer.
    00024   */
    00025   enum {maxNumOfFrames = 16};
    00026
    00027   /** Constructor */
    00028   SensorDataBuffer();
    00029
    00030   /** Number of frames in the buffer */
    00031   int numOfFrames;
    00032
    00033   /** The joint data frames */
    00034   SensorData frame[maxNumOfFrames];
    00035
    00036   /** Returns pointer to the most recent SensorData */
    00037   const SensorData& lastFrame() const
    00038   {
    00039     if (numOfFrames > 0)
    00040       return frame[numOfFrames - 1];
    00041     else
    00042       return frame[0];
    00043   };
    00044 };
    00045
    00046 /**
    00047  * Streaming operator that reads a SensorDataBuffer from a stream.
    00048  * @param stream The stream from which is read.
    00049  * @param sensorDataBuffer The SensorDataBuffer object.
    00050  * @return The stream.
    00051  */
    00052 In& operator>>(In& stream,SensorDataBuffer& sensorDataBuffer);
    00053
    00054 /**
    00055  * Streaming operator that writes a SensorDataBuffer to a stream.
    00056  * @param stream The stream to write on.
    00057  * @param sensorDataBuffer The SensorDataBuffer object.
    00058  * @return The stream.
    00059  */
    00060 Out& operator<<(Out& stream, const SensorDataBuffer& sensorDataBuffer);
    00061
    00062 #endif //__SENSORDATABUFFER_H__