Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::statistics_utils::sample_data Class Reference

Class for collecting and managing time-series sample data. Maintains a rolling buffer of samples with automatic statistics calculation. More...

#include <statistics_utils.h>

Public Member Functions

 sample_data ()
 Constructor that initializes all samples to zero.
 
auto reset (float value) -> void
 Reset all samples to a specific value.
 
auto push_sample (float value) -> void
 Add a new sample to the rolling buffer. Automatically updates min, max, and average statistics.
 
auto get_values () const -> const float *
 Get the raw sample values array.
 
auto get_offset () const -> int32_t
 Get the current offset in the rolling buffer.
 
auto get_min () const -> float
 Get the minimum value in the current sample set.
 
auto get_max () const -> float
 Get the maximum value in the current sample set.
 
auto get_average () const -> float
 Get the average value of the current sample set.
 

Static Public Attributes

static constexpr uint32_t NUM_SAMPLES = 500
 

Detailed Description

Class for collecting and managing time-series sample data. Maintains a rolling buffer of samples with automatic statistics calculation.

Definition at line 15 of file statistics_utils.h.

Constructor & Destructor Documentation

◆ sample_data()

unravel::statistics_utils::sample_data::sample_data ( )

Constructor that initializes all samples to zero.

Definition at line 16 of file statistics_utils.cpp.

Member Function Documentation

◆ get_average()

auto unravel::statistics_utils::sample_data::get_average ( ) const -> float
inline

Get the average value of the current sample set.

Returns
The average sample value

Definition at line 94 of file statistics_utils.h.

◆ get_max()

auto unravel::statistics_utils::sample_data::get_max ( ) const -> float
inline

Get the maximum value in the current sample set.

Returns
The maximum sample value

Definition at line 83 of file statistics_utils.h.

◆ get_min()

auto unravel::statistics_utils::sample_data::get_min ( ) const -> float
inline

Get the minimum value in the current sample set.

Returns
The minimum sample value

Definition at line 72 of file statistics_utils.h.

◆ get_offset()

auto unravel::statistics_utils::sample_data::get_offset ( ) const -> int32_t
inline

Get the current offset in the rolling buffer.

Returns
The current offset position

Definition at line 61 of file statistics_utils.h.

◆ get_values()

auto unravel::statistics_utils::sample_data::get_values ( ) const -> const float*
inline

Get the raw sample values array.

Returns
Pointer to the internal sample array

Definition at line 50 of file statistics_utils.h.

◆ push_sample()

auto unravel::statistics_utils::sample_data::push_sample ( float value) -> void

Add a new sample to the rolling buffer. Automatically updates min, max, and average statistics.

Parameters
valueThe new sample value

Definition at line 33 of file statistics_utils.cpp.

◆ reset()

auto unravel::statistics_utils::sample_data::reset ( float value) -> void

Reset all samples to a specific value.

Parameters
valueThe value to reset all samples to

Definition at line 21 of file statistics_utils.cpp.

Member Data Documentation

◆ NUM_SAMPLES

uint32_t unravel::statistics_utils::sample_data::NUM_SAMPLES = 500
staticconstexpr

Definition at line 18 of file statistics_utils.h.


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