time_series_stats.cpp

Example for RDM::TIME_SERIES template classes. This example needs a compiled schema, time_series_stats.sdl.

#include "time_series_stats_structs.h"
#include <math.h>
static RDM_RETCODE timeSeriesStatsOfSineCurve (RDM_DB db)
{
using namespace RDM_CPP::TIME_SERIES_STATS;
using namespace RDM::TIME_SERIES;
using namespace RDM::DB;
stats <32, MEASUREMENT_STATS1,
stats <32, MEASUREMENT_STATS1,
/* Place holder for something to come: */
dead_end>>ts_chain;
RDM_RETCODE rc = ts_chain.init (db);
for (uint64_t time_stamp = 0; rc == sOKAY && time_stamp < 1024; time_stamp++)
{
const double tau = 6.283185307179586;
const double signal = sin (tau * time_stamp / 50);
RDM_CPP::TIME_SERIES_STATS::MEASUREMENT measurement = {time_stamp, signal};
rc = ts_chain.put_value (&measurement);
}
return rc;
}
Time series for dead end template class.
Time series for split template classes.
RDM_RETCODE init(RDM_DB)
Initialize this object.
Definition: rdm_time_series_dead_end.h:153
The RDM Time Series Namespace.
Definition: rdm_time_series.h:32
Time series for stats template class.
@ sOKAY
Definition: rdmretcodetypes.h:100
Template Class for ignoring.
Definition: rdm_time_series_dead_end.h:42
enum RDM_RETCODE_E RDM_RETCODE
RaimaDB status and error return codes.
The RDM Database Namespace.
Definition: rdm_db.h:31
Template Class for doing a 3-way split.
Definition: rdm_time_series_split.h:648
Template Class for inserting a row.
Definition: rdm_db_insert_row.h:39
Template Class for doing statistics.
Definition: rdm_time_series_stats.h:65
struct RDM_DB_S * RDM_DB
Definition: rdmtypes.h:346
Time series for insert_row template class.