Time series module implementation file. More...
#include "time_series.h"
#include "definitions.h"
#include "memory.h"
#include "log_util.h"
#include "mcl/mcl_time_series.h"
#include "time_util.h"
Go to the source code of this file.
Functions | |
static E_MCL_ERROR_CODE | _initialize_meta (const char *version, const char *configuration_id, const char *routing, time_series_t *time_series) |
static void | _destroy_value_set_value (time_series_value_t **value) |
static void | _destroy_value_set (time_series_value_set_t **value_set) |
E_MCL_ERROR_CODE | time_series_initialize (const char *version, const char *configuration_id, const char *routing, time_series_t **time_series) |
This function creates and initializes a data struct of time_series_t. More... | |
E_MCL_ERROR_CODE | mcl_time_series_new_value_set (mcl_time_series_t *time_series, const char *timestamp, mcl_time_series_value_set_t **value_set) |
This function creates new value set to be added to mcl_time_series_t. More... | |
E_MCL_ERROR_CODE | mcl_time_series_add_value (mcl_time_series_value_set_t *value_set, const char *data_point_id, const char *value, const char *quality_code) |
This function adds data_point_id , value and quality_code to mcl_time_series_value_set_t. More... | |
void | time_series_destroy (time_series_t **time_series) |
To destroy the time_series_t data struct. More... | |
Time series module implementation file.
Definition in file time_series.c.
|
static |
Definition at line 195 of file time_series.c.
References _destroy_value_set_value(), DEBUG_ENTRY, DEBUG_LEAVE, list_destroy_with_content(), MCL_FREE, and string_destroy().
Referenced by mcl_time_series_new_value_set(), and time_series_destroy().
|
static |
Definition at line 183 of file time_series.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_FREE, and string_destroy().
Referenced by _destroy_value_set(), and mcl_time_series_add_value().
|
static |
Definition at line 144 of file time_series.c.
References ASSERT_CODE_MESSAGE, item_meta_payload_details_time_series_t::configuration_id, DEBUG_ENTRY, DEBUG_LEAVE, item_meta_payload_t::details, item_meta_t::details, MCL_NULL, MCL_OK, time_series_t::meta, META_FIELD_PAYLOAD_TYPE_TIME_SERIES, META_FIELD_TYPE_ITEM, meta_field_values, META_FIELD_VERSION_CURRENT, item_meta_t::payload, item_meta_details_t::routing, string_initialize_new(), string_initialize_static(), item_meta_payload_details_union_t::time_series_details, item_meta_payload_t::type, item_meta_t::type, item_meta_payload_t::version, and item_meta_t::version.
Referenced by time_series_initialize().
E_MCL_ERROR_CODE mcl_time_series_add_value | ( | mcl_time_series_value_set_t * | value_set, |
const char * | data_point_id, | ||
const char * | value, | ||
const char * | quality_code | ||
) |
This function adds data_point_id
, value
and quality_code
to mcl_time_series_value_set_t.
[in] | value_set | Value set to which parameters are added. |
[in] | data_point_id | Id of the data point the value is read from. |
[in] | value | The value read. |
[in] | quality_code | The quality of the value provided. Must represent a valid number compatible with the standard. |
Definition at line 90 of file time_series.c.
References _destroy_value_set_value(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, time_series_value_t::data_point_id, DEBUG_ENTRY, DEBUG_LEAVE, list_add(), MCL_DEBUG, MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, time_series_value_t::quality_code, string_initialize_new(), and time_series_value_t::value.
E_MCL_ERROR_CODE mcl_time_series_new_value_set | ( | mcl_time_series_t * | time_series, |
const char * | timestamp, | ||
mcl_time_series_value_set_t ** | value_set | ||
) |
This function creates new value set to be added to mcl_time_series_t.
[in] | time_series | value_set is added to time_series . |
[in] | timestamp | Timestamp of the values in YYYY-MM-DDThh:mm:ss.sssZ format. Ex:2016-04-26T08:06:25.317Z. |
[out] | value_set | Contains a timestamp and a list of values at that timestamp. |
Definition at line 55 of file time_series.c.
References _destroy_value_set(), ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, list_add(), list_initialize(), MCL_DEBUG, MCL_INVALID_PARAMETER, MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, string_initialize_new(), and time_util_validate_timestamp().
void time_series_destroy | ( | time_series_t ** | time_series | ) |
To destroy the time_series_t
data struct.
Will release the time_series_t data struct. After destroy() operation, the data struct shouldn't be used.
[out] | time_series | Stores all field members of time series json string. |
Definition at line 123 of file time_series.c.
References _destroy_value_set(), DEBUG_ENTRY, DEBUG_LEAVE, list_destroy_with_content(), MCL_FREE, MCL_NULL, and string_destroy().
Referenced by _store_list_destroy_callback(), mcl_store_new_time_series(), and time_series_initialize().
E_MCL_ERROR_CODE time_series_initialize | ( | const char * | version, |
const char * | configuration_id, | ||
const char * | routing, | ||
time_series_t ** | time_series | ||
) |
This function creates and initializes a data struct of time_series_t.
Initialized meta fields: type, version, payload_type, payload_version and payload_details_configuration_id.
[in] | version | Version number of time series event. |
[in] | configuration_id | Unique identifier of the configuration. |
[in] | routing | Routing information in meta description of time_series . This parameter is optional and can be NULL. |
[out] | time_series | Pointer address of initialized time series data struct. |
Definition at line 26 of file time_series.c.
References _initialize_meta(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, list_initialize(), MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, and time_series_destroy().
Referenced by mcl_store_new_time_series().