ESyS-Particle
4.0.1
|
00001 00002 // // 00003 // Copyright (c) 2003-2011 by The University of Queensland // 00004 // Earth Systems Science Computational Centre (ESSCC) // 00005 // http://www.uq.edu.au/esscc // 00006 // // 00007 // Primary Business: Brisbane, Queensland, Australia // 00008 // Licensed under the Open Software License version 3.0 // 00009 // http://www.opensource.org/licenses/osl-3.0.php // 00010 // // 00012 00013 #ifndef __RINGBUFFER_H 00014 #define __RINGBUFFER_H 00015 00016 // --- STL includes --- 00017 #include <vector> 00018 using std::vector; 00019 00023 template <typename T> 00024 class RingBuffer 00025 { 00026 private: 00027 vector<T> m_buffer; 00028 int m_idx; 00029 int m_size; 00030 00031 public: 00032 RingBuffer(int); 00033 00034 T& operator[](int); 00035 T operator[] (int) const; 00036 void insert(const T&); 00037 inline int size() const {return m_size;}; 00038 }; 00039 00040 #include "Foundation/RingBuffer.hpp" 00041 00042 #endif // __RINGBUFFER_H