time_series.c File Reference

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"
Include dependency graph for time_series.c:

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...
 

Detailed Description

Time series module implementation file.


Date
Jul 11, 2016

Definition in file time_series.c.

Function Documentation

static void _destroy_value_set ( time_series_value_set_t **  value_set)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

static void _destroy_value_set_value ( time_series_value_t **  value)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]value_setValue set to which parameters are added.
[in]data_point_idId of the data point the value is read from.
[in]valueThe value read.
[in]quality_codeThe quality of the value provided. Must represent a valid number compatible with the standard.
Returns

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.

Here is the call graph for this function:

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.

Parameters
[in]time_seriesvalue_set is added to time_series .
[in]timestampTimestamp of the values in YYYY-MM-DDThh:mm:ss.sssZ format. Ex:2016-04-26T08:06:25.317Z.
[out]value_setContains a timestamp and a list of values at that timestamp.
Returns

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().

Here is the call graph for this function:

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.

Parameters
[out]time_seriesStores 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]versionVersion number of time series event.
[in]configuration_idUnique identifier of the configuration.
[in]routingRouting information in meta description of time_series. This parameter is optional and can be NULL.
[out]time_seriesPointer address of initialized time series data struct.
Returns

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().

Here is the call graph for this function:

Here is the caller graph for this function: