Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# RingBufferWithSum< n > Class Template Reference

template class for cyclic buffering of the last n values of Type int and with a function that returns the sum of all entries More...

`#include <RingBufferWithSum.h>`

List of all members.

## Public Member Functions
| RingBufferWithSum ()
| Constructor.
void | init ()
| initializes the RingBufferWithSum
void | add (int value)
| adds an entry to the buffer
int | getEntry (int i)
| returns an entry
int | getSum ()
int | getMinimum ()
int | operator[] (int i)
| returns an entry
int | operator[] (int i) const
| returns a constant entry.
int | getNumberOfEntries () const
## Private Attributes
int | current
int | numberOfEntries
int | buffer [n]
int | sum

## Detailed Description

### template<int n>
class RingBufferWithSum< n >

template class for cyclic buffering of the last n values of Type int and with a function that returns the sum of all entries

Definition at line 20 of file RingBufferWithSum.h.

## Constructor & Destructor Documentation

template<int n>
RingBufferWithSum< n >::RingBufferWithSum | ( |  | ) | `[inline]`

| Constructor. Definition at line 24 of file RingBufferWithSum.h.

## Member Function Documentation

template<int n>
void RingBufferWithSum< n >::init | ( |  | ) | `[inline]`

| initializes the RingBufferWithSum Definition at line 29 of file RingBufferWithSum.h. Referenced by RingBufferWithSum< 60 >::RingBufferWithSum().

template<int n>
void RingBufferWithSum< n >::add | ( | int | value | ) | `[inline]`

  | adds an entry to the buffer Parameters:
  value | value to be added
Definition at line 35 of file RingBufferWithSum.h. Referenced by ObstaclesModel::getAngleOfLargeGapInRange(), and ObstaclesModel::getAngleOfLargeGapInRange2().

template<int n>
int RingBufferWithSum< n >::getEntry | ( | int | i | ) | `[inline]`

  | returns an entry Parameters:
  i | index of entry counting from last added (last=0,...)
Returns: a reference to the buffer entry Definition at line 50 of file RingBufferWithSum.h. Referenced by RingBufferWithSum< 60 >::add(), and RingBufferWithSum< 60 >::operator[]().

template<int n>
int RingBufferWithSum< n >::getSum | ( |  | ) | `[inline]`

| Definition at line 58 of file RingBufferWithSum.h. Referenced by ObstaclesModel::getAngleOfLargeGapInRange(), and ObstaclesModel::getAngleOfLargeGapInRange2().

template<int n>
int RingBufferWithSum< n >::getMinimum | ( |  | ) | `[inline]`

| Definition at line 63 of file RingBufferWithSum.h. Referenced by ObstaclesModel::getAngleOfLargeGapInRange2().

template<int n>
int RingBufferWithSum< n >::operator[] | ( | int | i | ) | `[inline]`

  | returns an entry Parameters:
  i | index of entry counting from last added (last=0,...)
Returns: a reference to the buffer entry Definition at line 78 of file RingBufferWithSum.h.

template<int n>
int RingBufferWithSum< n >::operator[] | ( | int | i | ) | const`[inline]`

  | returns a constant entry. Parameters:
  i | index of entry counting from last added (last=0,...)
Returns: a reference to the buffer entry Definition at line 88 of file RingBufferWithSum.h.

template<int n>
int RingBufferWithSum< n >::getNumberOfEntries | ( |  | ) | const`[inline]`

| Definition at line 93 of file RingBufferWithSum.h.

## Member Data Documentation

template<int n>
int RingBufferWithSum< n >::current`[private]`

| Definition at line 99 of file RingBufferWithSum.h.

template<int n>
int RingBufferWithSum< n >::numberOfEntries`[private]`

| Definition at line 100 of file RingBufferWithSum.h.

template<int n>
int RingBufferWithSum< n >::buffer[n]`[private]`

| Definition at line 101 of file RingBufferWithSum.h.

template<int n>
int RingBufferWithSum< n >::sum`[private]`

| Definition at line 103 of file RingBufferWithSum.h.

The documentation for this class was generated from the following file:

- Tools/RingBufferWithSum.h