orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca PEOPLE Contributors Users Project Download Mailing lists
|
ogbuffer.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 #ifndef ORCA_OG_BUFFER_H 00011 #define ORCA_OG_BUFFER_H 00012 00013 #include <map> 00014 00015 #include <orca/ogfusion.h> 00016 //#include "ogfeature.h" 00017 00023 namespace ogfusion{ 00024 00025 class OgBuffer 00026 { 00027 public: 00028 00029 // What to do when we try to insert an element that's already there 00030 enum ReplacementPolicy { 00031 PolicyReplaceLikelihood, // Most recent takes precedence 00032 PolicyAddLikelihood, // Fuse the two 00033 PolicyMaxLikelihood // Take the maximum likelihood of occupancy 00034 }; 00035 00037 00038 OgBuffer(); 00039 ~OgBuffer(); 00040 00041 bool isEmpty() const; 00042 unsigned int size() const; 00043 void clear(); 00044 00045 orca::OgCellLikelihood& begin(); 00046 orca::OgCellLikelihood& end(); 00047 00048 orca::OgCellLikelihood& insert( int ind, const orca::OgCellLikelihood &obs, ReplacementPolicy policy ); 00049 00050 void erase( const int ind ) {}; 00051 void eraseFront(); 00052 void eraseBack(); 00053 00054 void popFront( orca::OgCellLikelihood& obs); 00055 void popBack( orca::OgCellLikelihood& obs ); 00056 00057 void operator[] (const int ) const {}; 00058 00059 const std::map<int,orca::OgCellLikelihood> &bufferAsMap() const { return buffer_; } 00060 00061 private: 00062 00063 00064 std::map<int,orca::OgCellLikelihood> buffer_; 00065 00067 orca::OgCellLikelihood currentFeature_; 00068 00069 }; 00070 00071 // INLINE FUNCTIONS ================== 00072 00073 inline bool OgBuffer::isEmpty() const 00074 { return buffer_.empty(); }; 00075 00076 inline unsigned int OgBuffer::size() const 00077 { return buffer_.size(); }; 00078 00079 inline void OgBuffer::clear() 00080 { buffer_.clear(); }; 00081 00082 inline orca::OgCellLikelihood& OgBuffer::begin() 00083 { return buffer_.begin()->second; }; 00084 00085 inline orca::OgCellLikelihood& OgBuffer::end() 00086 { return buffer_.end()->second; }; 00087 00088 } 00089 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)