DataLog.hpp

Tools for processing a single set of data.

A DataLog takes in a continuous series of data and allows for easy analysis, both by performing calculations on those values and by outputting ascii histograms, etc.

Note

Status: ALPHA

template<typename T>
class DataLog
#include <DataLog.hpp>

Public Functions

DataLog() = default
DataLog(const DataLog&) = default
DataLog(DataLog&&) = default
inline DataLog(const vector<T> &in_data)
DataLog &operator=(const DataLog&) = default
DataLog &operator=(DataLog&&) = default
inline DataLog &operator=(const vector<T> &in_data)
inline size_t GetSize()
inline size_t size()
inline T &operator[](size_t id)
inline const T &operator[](size_t id) const
inline DataLog &Push(T in)
inline DataLog &Sort()
inline T Min() const
inline T Max() const
inline T Mean() const
inline T Variance() const
inline T StdDev() const
inline T StdError() const
inline void AsciiBarGraph(size_t max_width = 80, bool show_scale = true, bool max_scale_1 = true, std::ostream &os = std::cout)

The following function prints an ascii bar graph on to the screen (or provided stream).

Parameters:
  • max_width – What’s the widest bars allowed?

  • show_scale – Should we show the scale at bottom.

  • max_scale_1 – Should we limit scaling to 1:1?

  • os – Where to output the bar graph?

inline void AsciiHistogram(size_t num_bins = 40, size_t max_width = 80, bool show_scale = true, std::ostream &os = std::cout)

Take the input data, break it into bins, and print it as a bar graph.

Parameters:
  • num_bins – How many bins in histogram?

  • max_width – What’s the widest bars allowed?

  • show_scale – Should we show the scale at bottom?

  • os – Where to output the bar graph?

Private Types

using data_t = T

Private Members

vector<T> data