Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::RingBuffer< T, N > Class Template Reference

#include <ring_buffer.h>

Public Member Functions

 RingBuffer ()
 
void Add (const T &t)
 
const TGet (int i) const
 
int64_t Size () const
 

Detailed Description

template<typename T, int N>
class dart::RingBuffer< T, N >

Definition at line 15 of file ring_buffer.h.

Constructor & Destructor Documentation

◆ RingBuffer()

template<typename T , int N>
dart::RingBuffer< T, N >::RingBuffer ( )
inline

Definition at line 17 of file ring_buffer.h.

17: count_(0) {}

Member Function Documentation

◆ Add()

template<typename T , int N>
void dart::RingBuffer< T, N >::Add ( const T t)
inline

Definition at line 19 of file ring_buffer.h.

19{ data_[count_++ & kMask] = t; }

◆ Get()

template<typename T , int N>
const T & dart::RingBuffer< T, N >::Get ( int  i) const
inline

Definition at line 22 of file ring_buffer.h.

22 {
23 ASSERT(0 <= i && i < Size());
24 return data_[(count_ - i - 1) & kMask];
25 }
int64_t Size() const
Definition: ring_buffer.h:28
#define ASSERT(E)

◆ Size()

template<typename T , int N>
int64_t dart::RingBuffer< T, N >::Size ( ) const
inline

Definition at line 28 of file ring_buffer.h.

28 {
29 return Utils::Minimum(count_, static_cast<int64_t>(N));
30 }
#define N
Definition: beziers.cpp:19
static T Minimum(T x, T y)
Definition: utils.h:36

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