![]() |
Fledge
An open source edge computing platform for industrial users
|
Class to hold an actual reading value. More...
#include <datapoint.h>
Public Types | |
enum | DatapointTag { T_STRING, T_INTEGER, T_FLOAT, T_FLOAT_ARRAY, T_DP_DICT, T_DP_LIST, T_IMAGE, T_DATABUFFER, T_2D_FLOAT_ARRAY } |
typedef enum DatapointValue::DatapointTag | dataTagType |
Public Member Functions | |
DatapointValue (const std::string &value) | |
Construct with a string. | |
DatapointValue (const long value) | |
Construct with an integer value. | |
DatapointValue (const double value) | |
Construct with a floating point value. | |
DatapointValue (const std::vector< double > &values) | |
Construct with an array of floating point values. | |
DatapointValue (std::vector< Datapoint *> *&values, bool isDict) | |
Construct with an array of Datapoints. | |
DatapointValue (const DPImage &value) | |
Construct with an Image. | |
DatapointValue (const DataBuffer &value) | |
Construct with a DataBuffer. | |
DatapointValue (DPImage *value) | |
Construct with an Image Pointer, the image becomes owned by the datapointValue. | |
DatapointValue (DataBuffer *value) | |
Construct with a DataBuffer. | |
DatapointValue (const std::vector< std::vector< double > *> &values) | |
Construct with a 2 dimentional array of floating point values. | |
DatapointValue (const DatapointValue &obj) | |
Copy constructor. | |
DatapointValue & | operator= (const DatapointValue &rhs) |
Assignment Operator. | |
~DatapointValue () | |
Destructor. More... | |
void | setValue (std::string value) |
Set the value of a datapoint, this may also cause the type to be changed. More... | |
void | setValue (long value) |
Set the value of a datapoint, this may also cause the type to be changed. More... | |
void | setValue (double value) |
Set the value of a datapoint, this may also cause the type to be changed. More... | |
void | setValue (const DPImage &value) |
Set the value of a datapoint to be an image. More... | |
std::string | toString () const |
Return the value as a string. More... | |
std::string | toStringValue () const |
Return string value without trailing/leading quotes. | |
long | toInt () const |
Return long value. | |
double | toDouble () const |
Return double value. | |
dataTagType | getType () const |
Return the Tag type. | |
std::string | getTypeStr () const |
std::vector< Datapoint * > *& | getDpVec () |
Return array of datapoints. | |
std::vector< double > *& | getDpArr () |
Return array of float. | |
std::vector< std::vector< double > *> *& | getDp2DArr () |
Return 2D array of float. | |
DPImage * | getImage () |
Return the Image. | |
DataBuffer * | getDataBuffer () |
Return the DataBuffer. | |
Class to hold an actual reading value.
The class is simply a tagged union that also contains methods to return the value as a string for encoding in a JSON document.
DatapointValue::~DatapointValue | ( | ) |
Destructor.
DatapointValue class destructor.
|
inline |
Set the value of a datapoint, this may also cause the type to be changed.
value | An string value to set |
|
inline |
Set the value of a datapoint, this may also cause the type to be changed.
value | An integer value to set |
|
inline |
Set the value of a datapoint, this may also cause the type to be changed.
value | A floating point value to set |
|
inline |
Set the value of a datapoint to be an image.
value | The image to set in the data point |
std::string DatapointValue::toString | ( | ) | const |
Return the value as a string.