ESyS-Particle  2.3.2
RingBuffer.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __RINGBUFFER_H
14 #define __RINGBUFFER_H
15 
16 // --- STL includes ---
17 #include <vector>
18 using std::vector;
19 
23 template <typename T>
25 {
26  private:
27  vector<T> m_buffer;
28  int m_idx;
29  int m_size;
30 
31  public:
32  RingBuffer(int);
33 
34  T& operator[](int);
35  T operator[] (int) const;
36  void insert(const T&);
37  inline int size() const {return m_size;};
38 };
39 
41 
42 #endif // __RINGBUFFER_H