Template Class for doing custom operations. More...
#include "rdm_time_series_custom.h"

Public Member Functions |
|
RDM_RETCODE | init (RDM_DB db) |
Initialize this object. More... |
|
void | reset (void) |
Reset this object. More... |
|
RDM_RETCODE | flush_value (uint32_t threshold=1, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL) |
Flush this object. More... |
|
RDM_RETCODE | flush_stats (uint32_t threshold=1, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL) |
Flush this object. More... |
|
RDM_RETCODE | flush_range (uint32_t threshold=1, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL) |
Flush this object. More... |
|
template<class SOURCE_VALUE_T > | |
RDM_RETCODE | put_value (SOURCE_VALUE_T *source_value, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL) |
Template method for receiving a data value. More... |
|
template<class SOURCE_STATS_T > | |
RDM_RETCODE | put_stats (SOURCE_STATS_T *source_stats, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL) |
Template method for receiving statistics. More... |
|
template<class SOURCE_RANGE_T > | |
RDM_RETCODE | put_range (SOURCE_RANGE_T *source_range, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL) |
Template method for receiving ranges. More... |
|
Protected Member Functions |
|
uint32_t | init_tables_to_write_lock (RDM_TABLE_ID *tables) |
IDs of the tables where rows are inserted. More... |
|
uint32_t | init_tables_to_read_lock (RDM_TABLE_ID *tables) |
IDs of the tables where rows are read. More... |
|
void | unput (void) |
Undo a previous put operation. More... |
|
void | unflush (void) |
Undo a previous flush operation. More... |
|
Static Protected Member Functions |
|
constexpr static int | number_of_tables_to_write_lock (void) |
Number of tables where rows are inserted. More... |
|
constexpr static int | number_of_tables_to_read_lock (void) |
Number of tables where rows are read. More... |
|
Friends |
|
template<class ANY_NEXT > | |
class | qa |
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 |
class | dead_end |
template<class ANY_NEXT > | |
class | custom |
Detailed Description
template<class NEXT>
class RDM::TIME_SERIES::custom< NEXT >
Template Class for doing custom operations.
Template class for doing user defined customizations where we have data values, ranges, or statistics received by this class and data values, ranges, or statistics can also be sent to the next class in the chain.
If this class is used as-is, no processing will be performed. Everything received will be forwarded to the next class in the chain.
If customization is needed, create a sub class and implement the methods that need modifications. Where those methods need to send something to the next class in the chain, explicitly call the methods here.
If instead a custom class without a next class is needed, the dead_end class can be sub classed.
Be aware that the time series classes here are friend classes with one another, and certain methods are only available between these classes. Because of that, any custom sub class hereof will need its interface methods to be public.
- Template Parameters
-
NEXT The class in the chain to receive data
- Examples
- time_series_custom.cpp.
Member Function Documentation
flush_range()
|
inline |
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.
Any alternative implementation of this method in a sub class would call this method for a flush operation of the next class.
- 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
flush_stats()
|
inline |
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 statistics 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.
Any alternative implementation of this method in a sub class would call this method for a flush operation of the next class.
- 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
flush_value()
|
inline |
Flush this object.
Calling 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.
Any alternative implementation of this method in a sub class would call this method for a flush operation of the next class.
- 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
init()
|
inline |
Initialize this object.
Call this method before sending it any data values, ranges, or statistics.
Any alternative implementation of this method in a sub class would call this method to initialize the next class.
- 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
init_tables_to_read_lock()
|
inlineprotected |
init_tables_to_write_lock()
|
inlineprotected |
IDs of the tables where rows are inserted.
Use this method to initialize an array of table IDs. This array can then be used to start a transaction where those tables are specified.
Any alternative implementation of this method in a sub class would call this method to initialize the array for the tables used by the next class.
number_of_tables_to_read_lock()
|
inlinestaticconstexprprotected |
number_of_tables_to_write_lock()
|
inlinestaticconstexprprotected |
Number of tables where rows are inserted.
Constant expression method used to statically calculate the size of the array needed for table locking.
Any alternative implementation of this method in a sub class would call this method for getting the number of tables for the next class in the chain.
put_range()
|
inline |
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:
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.
Any alternative implementation of this method in a sub class would call this method for a put operation of the next class.
- Template Parameters
-
SOURCE_RANGE_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
put_stats()
|
inline |
Template method for receiving statistics.
Receive one statistic and process it accordingly.
The type for the value provided is required to have columns for 'time_stamp_first', 'time_stamp_last', 'n', 'value_sum', and 'value_sum2' with appropriate types. Such a type can be generated using rdm-compile with a schema including a table similar to this:
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.
Any alternative implementation of this method in a sub class would call this method for a put operation of the next class.
- Template Parameters
-
SOURCE_STATS_T The actual type of the statistic 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_stats The source statistics sent to this class transactional [IN] Is the put required to be transactional
put_value()
|
inline |
Template method for receiving a data value.
Receive one data value and process it accordingly.
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:
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.
Any alternative implementation of this method in a sub class would call this method for a put operation of the next class.
- 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
reset()
|
inline |
Reset this object.
Calling this method to discard all internally kept data values, ranges, and statistics that have not yet been persisted and start over from scratch.
Any alternative implementation of this method in a sub class would call this method to reset the next class.
unflush()
|
inlineprotected |
unput()
|
inlineprotected |
Friends And Related Function Documentation
collect
|
friend |
custom
dead_end
|
friend |
downsample
fft
|
friend |
mean
|
friend |
qa
|
friend |
scale
split
stats
|
friend |
The documentation for this class was generated from the following files: