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 00015 /** 00016 * A buffer for sensor data sets, containing all frames received at the same time. 00017 * @author Max Risler 00018 */ 00019 class SensorDataBuffer 00020 { 00021 public: 00022 /** Maximum number of frames in the buffer. 00023 */ 00024 enum {maxNumOfFrames = 16}; 00025 00026 /** Constructor */ 00027 SensorDataBuffer(); 00028 00029 /** Number of frames in the buffer */ 00030 int numOfFrames; 00031 00032 /** The joint data frames */ 00033 SensorData frame[maxNumOfFrames]; 00034 00035 /** Returns pointer to the most recent SensorData */ 00036 const SensorData& lastFrame() const 00037 { 00038 if (numOfFrames > 0) 00039 return frame[numOfFrames - 1]; 00040 else 00041 return frame[0]; 00042 }; 00043 }; 00044 00045 /** 00046 * Streaming operator that reads a SensorDataBuffer from a stream. 00047 * @param stream The stream from which is read. 00048 * @param sensorDataBuffer The SensorDataBuffer object. 00049 * @return The stream. 00050 */ 00051 In& operator>>(In& stream,SensorDataBuffer& sensorDataBuffer); 00052 00053 /** 00054 * Streaming operator that writes a SensorDataBuffer to a stream. 00055 * @param stream The stream to write on. 00056 * @param sensorDataBuffer The SensorDataBuffer object. 00057 * @return The stream. 00058 */ 00059 Out& operator<<(Out& stream, const SensorDataBuffer& sensorDataBuffer); 00060 00061 #endif //__SENSORDATABUFFER_H__ 00062 00063 /* 00064 * Change log : 00065 * 00066 * $Log: SensorDataBuffer.h,v $ 00067 * Revision 1.1.1.1 2004/05/22 17:26:03 cvsadm 00068 * created new repository GT2004_WM 00069 * 00070 * Revision 1.1 2003/10/07 10:09:36 cvsadm 00071 * Created GT2004 (M.J.) 00072 * 00073 * Revision 1.1.1.1 2003/07/02 09:40:22 cvsadm 00074 * created new repository for the competitions in Padova from the 00075 * tamara CVS (Tuesday 2:00 pm) 00076 * 00077 * removed unused solutions 00078 * 00079 * Revision 1.3 2003/05/03 15:26:06 risler 00080 * changed 00081 * #endif __SENSORDATABUFFER_H__ 00082 * to 00083 * #endif //__SENSORDATABUFFER_H__ 00084 * :) 00085 * 00086 * Revision 1.2 2003/05/02 19:04:59 loetzsch 00087 * changed 00088 * #endif //__JOINTDATABUFFER_H__ 00089 * to 00090 * #endif __SENSORDATABUFFER_H__ 00091 * 00092 * Revision 1.1 2003/05/02 18:45:40 risler 00093 * SensorDataBuffer added 00094 * replaced SensorData with SensorDataBuffer 00095 * full SensorData resolution now accessible 00096 * 00097 */