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
00027 #ifndef ARRANGEBUFFER_H
00028 #define ARRANGEBUFFER_H
00029
00030 #include "ariaUtil.h"
00031 #include "ariaTypedefs.h"
00032 #include "ArTransform.h"
00033 #include <list>
00034 #include <vector>
00035
00037 class ArRangeBuffer
00038 {
00039 public:
00041 ArRangeBuffer(int size);
00043 virtual ~ArRangeBuffer();
00045 size_t getSize(void) const;
00047 void setSize(size_t size);
00049 ArPose getPoseTaken() const;
00051 void setPoseTaken(ArPose p);
00053 ArPose getEncoderPoseTaken() const;
00055 void setEncoderPoseTaken(ArPose p);
00057 void addReading(double x, double y);
00059 void beginInvalidationSweep(void);
00061 void invalidateReading(std::list<ArPoseWithTime*>::iterator readingIt);
00063 void endInvalidationSweep(void);
00064 #ifndef SWIG
00065
00066 const std::list<ArPoseWithTime *> *getBuffer(void) const;
00067 #endif
00068
00069 std::list<ArPoseWithTime *> *getBuffer(void);
00070
00072 double getClosestPolar(double startAngle, double endAngle,
00073 ArPose position, unsigned int maxRange,
00074 double *angle = NULL) const;
00076 double getClosestBox(double x1, double y1, double x2, double y2,
00077 ArPose position, unsigned int maxRange,
00078 ArPose *readingPos = NULL,
00079 ArPose targetPose = ArPose(0, 0, 0)) const;
00081 void applyTransform(ArTransform trans);
00083 void clear(void);
00085 void clearOlderThan(int milliSeconds);
00087 void clearOlderThanSeconds(int seconds);
00089 void reset(void);
00091 void beginRedoBuffer(void);
00093 void redoReading(double x, double y);
00095 void endRedoBuffer(void);
00097 std::vector<ArPoseWithTime> *getBufferAsVector(void);
00099 static double getClosestPolarInList(
00100 double startAngle, double endAngle, ArPose position,
00101 unsigned int maxRange, double *angle,
00102 const std::list<ArPoseWithTime *> *buffer);
00104 static double getClosestBoxInList(
00105 double x1, double y1, double x2, double y2, ArPose position,
00106 unsigned int maxRange, ArPose *readingPos,
00107 ArPose targetPose, const std::list<ArPoseWithTime *> *buffer);
00108 protected:
00109 std::vector<ArPoseWithTime> myVector;
00110 ArPose myBufferPose;
00111 ArPose myEncoderBufferPose;
00112
00113 std::list<ArPoseWithTime *> myBuffer;
00114 std::list<ArPoseWithTime *> myInvalidBuffer;
00115 std::list<std::list<ArPoseWithTime *>::iterator > myInvalidSweepList;
00116 std::list<std::list<ArPoseWithTime *>::iterator >::iterator myInvalidIt;
00117 std::list<ArPoseWithTime *>::iterator myRedoIt;
00118 int myNumRedone;
00119 bool myHitEnd;
00120
00121 size_t mySize;
00122 std::list<ArPoseWithTime *>::reverse_iterator myRevIterator;
00123 std::list<ArPoseWithTime *>::iterator myIterator;
00124
00125 ArPoseWithTime * myReading;
00126 };
00127
00128 #endif // ARRANGEBUFFER_H