Fledge
An open source edge computing platform for industrial users
DatapointValue Class Reference

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.
 
DatapointValueoperator= (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.
 
DPImagegetImage ()
 Return the Image.
 
DataBuffergetDataBuffer ()
 Return the DataBuffer.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~DatapointValue()

DatapointValue::~DatapointValue ( )

Destructor.

DatapointValue class destructor.

Member Function Documentation

◆ setValue() [1/4]

void DatapointValue::setValue ( std::string  value)
inline

Set the value of a datapoint, this may also cause the type to be changed.

Parameters
valueAn string value to set

◆ setValue() [2/4]

void DatapointValue::setValue ( long  value)
inline

Set the value of a datapoint, this may also cause the type to be changed.

Parameters
valueAn integer value to set

◆ setValue() [3/4]

void DatapointValue::setValue ( double  value)
inline

Set the value of a datapoint, this may also cause the type to be changed.

Parameters
valueA floating point value to set

◆ setValue() [4/4]

void DatapointValue::setValue ( const DPImage value)
inline

Set the value of a datapoint to be an image.

Parameters
valueThe image to set in the data point

◆ toString()

std::string DatapointValue::toString ( ) const

Return the value as a string.

Returns
String representing the DatapointValue object

The documentation for this class was generated from the following files: