00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ARRANGEBUFFER_H
00027 #define ARRANGEBUFFER_H
00028
00029 #include "ariaUtil.h"
00030 #include "ariaTypedefs.h"
00031 #include "ArTransform.h"
00032 #include <list>
00033 #include <vector>
00034
00036 class ArRangeBuffer
00037 {
00038 public:
00040 AREXPORT ArRangeBuffer(int size);
00042 AREXPORT virtual ~ArRangeBuffer();
00044 AREXPORT size_t getSize(void) const;
00046 AREXPORT void setSize(size_t size);
00048 AREXPORT ArPose getPoseTaken() const;
00050 AREXPORT void setPoseTaken(ArPose p);
00052 AREXPORT ArPose getEncoderPoseTaken() const;
00054 AREXPORT void setEncoderPoseTaken(ArPose p);
00056 AREXPORT void addReading(double x, double y);
00058 AREXPORT void beginInvalidationSweep(void);
00060 AREXPORT void invalidateReading(std::list<ArPoseWithTime*>::iterator readingIt);
00062 AREXPORT void endInvalidationSweep(void);
00063 #ifndef SWIG
00064
00067 AREXPORT const std::list<ArPoseWithTime *> *getBuffer(void) const;
00068 #endif
00069
00070 AREXPORT std::list<ArPoseWithTime *> *getBuffer(void);
00071
00073 AREXPORT double getClosestPolar(double startAngle, double endAngle,
00074 ArPose position, unsigned int maxRange,
00075 double *angle = NULL) const;
00077 AREXPORT double getClosestBox(double x1, double y1, double x2, double y2,
00078 ArPose position, unsigned int maxRange,
00079 ArPose *readingPos = NULL,
00080 ArPose targetPose = ArPose(0, 0, 0)) const;
00082 AREXPORT void applyTransform(ArTransform trans);
00084 AREXPORT void clear(void);
00086 AREXPORT void clearOlderThan(int milliSeconds);
00088 AREXPORT void clearOlderThanSeconds(int seconds);
00090 AREXPORT void reset(void);
00092 AREXPORT void beginRedoBuffer(void);
00094 AREXPORT void redoReading(double x, double y);
00096 AREXPORT void endRedoBuffer(void);
00098 AREXPORT std::vector<ArPoseWithTime> *getBufferAsVector(void);
00100 AREXPORT static double getClosestPolarInList(
00101 double startAngle, double endAngle, ArPose position,
00102 unsigned int maxRange, double *angle,
00103 const std::list<ArPoseWithTime *> *buffer);
00105 AREXPORT static double getClosestBoxInList(
00106 double x1, double y1, double x2, double y2, ArPose position,
00107 unsigned int maxRange, ArPose *readingPos,
00108 ArPose targetPose, const std::list<ArPoseWithTime *> *buffer);
00109 protected:
00110 std::vector<ArPoseWithTime> myVector;
00111 ArPose myBufferPose;
00112 ArPose myEncoderBufferPose;
00113
00114 std::list<ArPoseWithTime *> myBuffer;
00115 std::list<ArPoseWithTime *> myInvalidBuffer;
00116 std::list<std::list<ArPoseWithTime *>::iterator > myInvalidSweepList;
00117 std::list<std::list<ArPoseWithTime *>::iterator >::iterator myInvalidIt;
00118 std::list<ArPoseWithTime *>::iterator myRedoIt;
00119 int myNumRedone;
00120 bool myHitEnd;
00121
00122 size_t mySize;
00123 std::list<ArPoseWithTime *>::reverse_iterator myRevIterator;
00124 std::list<ArPoseWithTime *>::iterator myIterator;
00125
00126 ArPoseWithTime * myReading;
00127 };
00128
00129 #endif // ARRANGEBUFFER_H