Xively Official / mbed-libxively-5d6fdd4

Dependents:   xively-jumpstart-demo

Embed: (wiki syntax)

« Back to documentation index

data_layer_t Struct Reference

data_layer_t Struct Reference

_The data layer interface_ - contains function pointers, that's what we expose to the layers above and below More...

#include <data_layer.h>

Data Fields

const char *(* encode_datapoint )(const xi_datapoint_t *dp)
 This function converts `xi_datapoint_t` into an implementation-specific format for a datapoint.
int(* encode_datapoint_in_place )(char *buffer, size_t buffer_size, const xi_datapoint_t *dp)
 This function converts `xi_datapoint_t` into an implementation-specific format for a datapoint with output buffer given as an argument.
const char *(* encode_create_datastream )(const char *data, const xi_datapoint_t *dp)
 This function converts `xi_datapoint_t` and a given datastream ID string into an implementation-specific format for creating datastreams.
xi_feed_t *(* decode_feed )(const char *data, xi_feed_t *feed)
 This function converts from an implementation-specific format for a feed into `xi_feed_t` that is given as an argument.
xi_datapoint_t *(* decode_datapoint )(const char *data, xi_datapoint_t *dp)
 This function converts from an implementation-specific format for a datapoint into `xi_datapoint_t` that is given as an argument.

Detailed Description

_The data layer interface_ - contains function pointers, that's what we expose to the layers above and below

It is effectively a class that holds declarations of pure virtual functions. * All encoders take a given data type (e.g. `xi_feed_t`, `xi_datapoint_t`) and produce an encoded string in a buffer, which can be wrapped as payload to _transport layer_ or any other layer, such as _gzip_. * All decoders take a given data buffer and convert to an appropriate data type.

Note:
The encoders and decoders do not have to be paired, e.g. `encode_feed` is actually implemented using `encode_datapoint_in_place` in a loop (see `http_encode_update_feed`), so we only need `decode_feed`. However, this presumption had been made with CSV _data_ _layer_ implementation and the interface may need to change if other data formats are to be implemented, but it is currently more important to have it the way it is. The layering model should allow for simple way of integrating anything, even if there might seem to be some inconsistency right now.

Definition at line 35 of file data_layer.h.


Field Documentation

xi_datapoint_t*( * decode_datapoint)(const char *data, xi_datapoint_t *dp)

This function converts from an implementation-specific format for a datapoint into `xi_datapoint_t` that is given as an argument.

Returns:
Pointer to datastream structure or null if an error occurred.

Definition at line 79 of file data_layer.h.

xi_feed_t*( * decode_feed)(const char *data, xi_feed_t *feed)

This function converts from an implementation-specific format for a feed into `xi_feed_t` that is given as an argument.

Returns:
Pointer to feed structure or null if an error occurred.

Definition at line 70 of file data_layer.h.

const char*( * encode_create_datastream)(const char *data, const xi_datapoint_t *dp)

This function converts `xi_datapoint_t` and a given datastream ID string into an implementation-specific format for creating datastreams.

Returns:
Pointer to the buffer where encoded string resides.

Definition at line 60 of file data_layer.h.

const char*( * encode_datapoint)(const xi_datapoint_t *dp)

This function converts `xi_datapoint_t` into an implementation-specific format for a datapoint.

Returns:
Pointer to the buffer where encoded string resides.

Definition at line 42 of file data_layer.h.

int( * encode_datapoint_in_place)(char *buffer, size_t buffer_size, const xi_datapoint_t *dp)

This function converts `xi_datapoint_t` into an implementation-specific format for a datapoint with output buffer given as an argument.

Returns:
Offset or -1 if an error occurred.

Definition at line 50 of file data_layer.h.