Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Private Attributes
Fling::MovingAverage< T, t_Size > Class Template Reference

A moving average can be used to calculate things like FPS. More...

#include <MovingAverage.hpp>

Public Member Functions

 MovingAverage ()
 
 ~MovingAverage ()=default
 
void Push (T t_Element)
 Push a value onto the buffer to be calculated. More...
 
GetAverage () const
 Get the average (Sum / num elements) More...
 

Private Attributes

size_t m_CurrentIndex = {}
 Index for keeping track of what part of the buffer we should be inserting into. More...
 
size_t m_Count = {}
 Current count of things pushed to this average. More...
 
size_t m_MaxSize = {}
 Max sample size in this moving average. More...
 
m_Buffer [t_Size] = {}
 Buffer of samples used to calculate the moving average. More...
 

Detailed Description

template<typename T, size_t t_Size>
class Fling::MovingAverage< T, t_Size >

A moving average can be used to calculate things like FPS.

Constructor & Destructor Documentation

◆ MovingAverage()

template<typename T , size_t t_Size>
Fling::MovingAverage< T, t_Size >::MovingAverage ( )
inline

◆ ~MovingAverage()

template<typename T, size_t t_Size>
Fling::MovingAverage< T, t_Size >::~MovingAverage ( )
default

Member Function Documentation

◆ GetAverage()

template<typename T , size_t t_Size>
T Fling::MovingAverage< T, t_Size >::GetAverage ( ) const
inline

Get the average (Sum / num elements)

◆ Push()

template<typename T, size_t t_Size>
void Fling::MovingAverage< T, t_Size >::Push ( t_Element)
inline

Push a value onto the buffer to be calculated.

Field Documentation

◆ m_Buffer

template<typename T, size_t t_Size>
T Fling::MovingAverage< T, t_Size >::m_Buffer[t_Size] = {}
private

Buffer of samples used to calculate the moving average.

◆ m_Count

template<typename T, size_t t_Size>
size_t Fling::MovingAverage< T, t_Size >::m_Count = {}
private

Current count of things pushed to this average.

◆ m_CurrentIndex

template<typename T, size_t t_Size>
size_t Fling::MovingAverage< T, t_Size >::m_CurrentIndex = {}
private

Index for keeping track of what part of the buffer we should be inserting into.

◆ m_MaxSize

template<typename T, size_t t_Size>
size_t Fling::MovingAverage< T, t_Size >::m_MaxSize = {}
private

Max sample size in this moving average.


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