Example for RDM::TIME_SERIES template classes. This example needs a compiled schema, time_series_range.sdl.
This example shows usage of the RDM::TIME_SERIES template classes with a single chain. First, values are collected into ranges by the RDM::TIME_SERIES::collect class, then a number of ranges are averaged using the RDM::TIME_SERIES::geometric_mean class, and finally rows are inserted using the RDM::TIME_SERIES::insert_row class.
#include <math.h>
#include "time_series_range_structs.h"
{
using namespace RDM_CPP::TIME_SERIES_RANGE;
const double tau = 6.283185307179586;
double factor = 1.0442737824;
double adjust = 1.0;
for (uint64_t time_stamp = 0; rc ==
sOKAY && time_stamp < 256; time_stamp++)
{
const double signal = adjust * (sin (tau * time_stamp / 16) * 0.1 + 1);
MEASUREMENT measurement = {time_stamp, signal};
rc = ts_chain.put_value (&measurement);
adjust *= factor;
}
return rc;
}