Template Class for doing an arithmetic mean. More...
#include "rdm_time_series_mean.h"
|
template<class ANY_NEXT > |
class |
RDM::DB::transaction
|
|
template<class ANY_NEXT_1 , class ANY_NEXT_2 > |
class |
split
|
|
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_NEXT > |
class |
collect
|
|
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_INDATA_T , class ANY_NEXT > |
class |
fft
|
|
template<uint32_t ANY_N, class ANY_AGGREGATE_T , class ANY_AGG_ELEMENT_T , class ANY_NEXT > |
class |
mean
|
|
template<class ANY_RATIO , class ANY_NEXT > |
class |
scale
|
|
template<uint32_t ANY_N, class ANY_STATS_T , class ANY_NEXT > |
class |
stats
|
|
template<uint32_t ANY_N, class ANY_NEXT > |
class |
downsample
|
|
template<class ANY_NEXT > |
class |
custom
|
|
template<uint32_t N, class AGGREGATE_T, class AGG_ELEMENT_T, class NEXT>
class RDM::TIME_SERIES::mean< N, AGGREGATE_T, AGG_ELEMENT_T, NEXT >
Template Class for doing an arithmetic mean.
Template class for taking the arithmetic means of data values or ranges. What is received will be collected and used for taking arithmetic means. The result of those arithmetic means will be forwarded to the next class in the chain.
This class is incomplete as it does not have the code for doing the actual FFT computation. Use one of the following derived classes:
- Template Parameters
-
N |
The number of receved RANGE calculations for each arithmetic mean. |
AGGREGATE_T |
The aggregate range or stats class for which objects will be passed to the next class. |
AGG_ELEMENT_T |
The type for the elements that must be aggregated to compute the mean. |
NEXT |
The class in the chain to receive arithmetic means. |
flush_range()
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
Flush this object.
Call this method to flush what has been collected so far. A threshold can also be provided. All the data collected for those ranges will be kept as is. The same is the case where the threshold has not been reached.
This operation can be specified as being transactional. However, if the caller always rolls back the transaction in the case of a failure, there is no need to specify single operations to be transactional.
- Return values
-
sOKAY |
Normal, successful return. |
eNOSTARTUPDATE |
An update operation was attempted when no rdm_dbStartUpdate() is active. |
eNOTLOCKED |
Attempt to access a table for reading or update without proper locks. |
eCURSORDB |
Cursor is associated with a different database. |
eDBNOTOPEN |
Database not open. |
ePRECOMMITTED |
A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
eDUPLICATE |
Attempt to insert a duplicate value as a unique/primary key. |
eREADONLY |
Database is read-only and cannot be updated. |
eREFINTEGRITY |
Integrity constraint violation. |
eROWLIMIT |
Table row limit reached. |
eINVARG |
Invalid argument. |
- Parameters
-
threshold |
[IN] Only flush objects where at least this many elements have been collected |
transactional |
[IN] Is the flush required to be transactional |
303if (n >= threshold && n > 0)
305 AGGREGATE_T scaled_aggregate = aggregate;
307for (uint32_t i = 0; i <
RDM_LEN(aggregate.value_range); i++)
309 agg_scale (n, scaled_aggregate.value_range[i]);
324 n_just_before_last_flush = n;
352 n_just_before_last_flush = 0;
354 rc = next.flush_range (threshold, transactional);
References RDM::DB::NOT_TRANSACTIONAL, rdm_dbStartUpdate(), RDM_LEN, rdm_transEnd(), rdm_transEndRollback(), sOKAY, and RDM::DB::TRANSACTIONAL.
flush_value()
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
Flush this object.
Call this method to flush what has been collected so far. A threshold can also be provided. All the data collected for those values will be kept as is. The same is the case where the threshold has not been reached.
This operation can be specified as being transactional. However, if the caller always rolls back the transaction in the case of a failure, there is no need to specify single operations to be transactional.
- Return values
-
sOKAY |
Normal, successful return. |
eNOSTARTUPDATE |
An update operation was attempted when no rdm_dbStartUpdate() is active. |
eNOTLOCKED |
Attempt to access a table for reading or update without proper locks. |
eCURSORDB |
Cursor is associated with a different database. |
eDBNOTOPEN |
Database not open. |
ePRECOMMITTED |
A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
eDUPLICATE |
Attempt to insert a duplicate value as a unique/primary key. |
eREADONLY |
Database is read-only and cannot be updated. |
eREFINTEGRITY |
Integrity constraint violation. |
eROWLIMIT |
Table row limit reached. |
eINVARG |
Invalid argument. |
- Parameters
-
threshold |
[IN] Only flush objects where at least this many elements have been collected |
transactional |
[IN] Is the flush required to be transactional |
218if (n >= threshold && n > 0)
220 AGGREGATE_T scaled_aggregate = aggregate;
222 agg_scale (n, scaled_aggregate.value_range[0]);
236 n_just_before_last_flush = n;
264 n_just_before_last_flush = 0;
266 rc = next.flush_range (threshold, transactional);
References RDM::DB::NOT_TRANSACTIONAL, rdm_dbStartUpdate(), rdm_transEnd(), rdm_transEndRollback(), sOKAY, and RDM::DB::TRANSACTIONAL.
init()
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
Initialize this object.
Call this method before sending it any ranges or statistics.
- Return values
-
sOKAY |
Normal, successful return. |
eINVARG |
Invalid argument. |
eDBNOTOPEN |
Database not open. |
eCURSORDB |
Cursor is associated with a different database. |
ePRECOMMITTED |
A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
- Parameters
-
db |
[IN] Use this database for chained classes that need to insert rows |
put_range()
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<class SOURCE_AGGREGATE_T >
Template method for receiving ranges.
Receive one range and process it accordingly.
The type for the value provided is required to have columns for 'time_stamp_first', 'time_stamp_last', and 'value_range' with appropriate types. The column 'value_range' must be an array that is able to hold a static number of elements. Such a type can be generated using rdm-compile with a schema including a table similar to this:
CREATE TABLE range
(
value_range DOUBLE ARRAY [32] NOT NULL,
time_stamp_first UINT64 NOT NULL,
time_stamp_last UINT64 PRIMARY KEY
);
This operation can be specified as being transactional. However, if the caller always rolls back the transaction in the case of a failure, there is no need to specify single operations to be transactional.
- Template Parameters
-
SOURCE_AGGREGATE_T |
The actual type of the range received. |
- Return values
-
sOKAY |
Normal, successful return. |
eNOSTARTUPDATE |
An update operation was attempted when no rdm_dbStartUpdate() is active. |
eNOTLOCKED |
Attempt to access a table for reading or update without proper locks. |
eCURSORDB |
Cursor is associated with a different database. |
eDBNOTOPEN |
Database not open. |
ePRECOMMITTED |
A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
eDUPLICATE |
Attempt to insert a duplicate value as a unique/primary key. |
eREADONLY |
Database is read-only and cannot be updated. |
eREFINTEGRITY |
Integrity constraint violation. |
eROWLIMIT |
Table row limit reached. |
eINVARG |
Invalid argument. |
- Parameters
-
[in] |
source_range |
The source range sent to this class |
|
transactional |
[IN] Is the put required to be transactional |
493 prev_aggregate = aggregate;
497 aggregate.time_stamp_first =
498 source_range->time_stamp_first;
499for (uint32_t i = 0; i <
RDM_LEN(aggregate.value_range); i++)
501 agg_set (source_range->value_range[i], aggregate.value_range[i]);
506for (uint32_t i = 0; i <
RDM_LEN(aggregate.value_range); i++)
508 agg_add (source_range->value_range[i], aggregate.value_range[i]);
511 aggregate.time_stamp_last =
512 source_range->time_stamp_last;
516 AGGREGATE_T scaled_aggregate = aggregate;
518for (uint32_t i = 0; i <
RDM_LEN(aggregate.value_range); i++)
520 agg_scale (N, scaled_aggregate.value_range[i]);
523 rc = next.put_range (&scaled_aggregate, transactional);
526 n_just_before_last_put = n;
531 aggregate = prev_aggregate;
References RDM_LEN, and sOKAY.
put_value()
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<class SOURCE_VALUE_T >
Template method for receiving a data values.
Receive one data value and return an error.
The type for the value provided is required to have columns for 'time_stamp_current' and 'value_current' with appropriate types. Such a type can be generated using rdm-compile with a schema including a table similar to this:
CREATE TABLE measurement
(
time_stamp_current UINT64 PRIMARY KEY,
value_current DOUBLE NOT NULL
);
This operation can be specified as being transactional. However, if the caller always rolls back the transaction in the case of a failure, there is no need to specify single operations to be transactional.
- Template Parameters
-
SOURCE_VALUE_T |
The actual type of the source values received |
- Return values
-
sOKAY |
Normal, successful return. |
eNOSTARTUPDATE |
An update operation was attempted when no rdm_dbStartUpdate() is active. |
eNOTLOCKED |
Attempt to access a table for reading or update without proper locks. |
eCURSORDB |
Cursor is associated with a different database. |
eDBNOTOPEN |
Database not open. |
ePRECOMMITTED |
A precommitted transaction must be committed or rolled back before further operations on this database are allowed. |
eDUPLICATE |
Attempt to insert a duplicate value as a unique/primary key. |
eREADONLY |
Database is read-only and cannot be updated. |
eREFINTEGRITY |
Integrity constraint violation. |
eROWLIMIT |
Table row limit reached. |
eINVARG |
Invalid argument. |
- Parameters
-
[in] |
source_value |
The source value sent to this class |
|
transactional |
[IN] Is the put required to be transactional |
405 prev_aggregate = aggregate;
409 aggregate.time_stamp_first =
410 source_value->time_stamp_current;
411 agg_set (source_value->value_current, aggregate.value_range[0]);
415 agg_add (source_value->value_current, aggregate.value_range[0]);
417 aggregate.time_stamp_last =
418 source_value->time_stamp_current;
422 AGGREGATE_T scaled_aggregate = aggregate;
424 agg_scale (N, scaled_aggregate.value_range[0]);
426 rc = next.put_range (&scaled_aggregate, transactional);
429 n_just_before_last_put = n;
434 aggregate = prev_aggregate;
References sOKAY.
reset()
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
Reset this object.
Call this method to discard all internally kept data values, ranges, and statistics that have not yet been persisted and start over from scratch.
collect
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_NEXT >
custom
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<class ANY_NEXT >
downsample
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<uint32_t ANY_N, class ANY_NEXT >
fft
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_INDATA_T , class ANY_NEXT >
mean
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<uint32_t ANY_N, class ANY_AGGREGATE_T , class ANY_AGG_ELEMENT_T , class ANY_NEXT >
RDM::DB::transaction
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<class ANY_NEXT >
scale
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<class ANY_RATIO , class ANY_NEXT >
split
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<class ANY_NEXT_1 , class ANY_NEXT_2 >
stats
template<uint32_t N, class AGGREGATE_T , class AGG_ELEMENT_T , class NEXT >
template<uint32_t ANY_N, class ANY_STATS_T , class ANY_NEXT >
The documentation for this class was generated from the following files:
RDM_RETCODE rdm_transEnd(RDM_TRANS trans)
End a transactional operation.
@ NOT_TRANSACTIONAL
Definition: rdm_db_transaction.h:36
RDM_RETCODE rdm_transEndRollback(RDM_TRANS trans)
End a transactional operation with a rollback.
@ sOKAY
Definition: rdmretcodetypes.h:97
struct RDM_TRANS_S * RDM_TRANS
Definition: rdmtypes.h:307
RDM_RETCODE rdm_dbStartUpdate(RDM_DB db, const RDM_TABLE_ID *writeTableIds, uint32_t numWriteTableIds, const RDM_TABLE_ID *readTableIds, uint32_t numReadTableIds, RDM_TRANS *pTrans)
Get write locks.
#define RDM_LEN(x)
Definition: psptypes.h:78
@ TRANSACTIONAL
Definition: rdm_db_transaction.h:35
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:43
Copyright © 2023, Raima Inc. All rights reserved. [4/12/2023 3:25:40 PM]