Fledge
An open source edge computing platform for industrial users
datapoint_utility.h
1 #ifndef INCLUDE_DATAPOINT_UTILITY_H_
2 #define INCLUDE_DATAPOINT_UTILITY_H_
3 /*
4  * Fledge
5  *
6  * Copyright (c) 2021 Dianomic Systems
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Yannick Marchetaux
11  *
12  */
13 
14 #include <vector>
15 #include <string>
16 #include "datapoint.h"
17 #include "reading.h"
18 
19 namespace DatapointUtility {
20  // Define type
21  using Datapoints = std::vector<Datapoint*>;
22  using Readings = std::vector<Reading*>;
23 
24  // Function for search value
25  Datapoints *findDictElement (Datapoints* dict, const std::string& key);
26  DatapointValue *findValueElement (Datapoints* dict, const std::string& key);
27  Datapoint *findDatapointElement (Datapoints* dict, const std::string& key);
28  Datapoints *findDictOrListElement (Datapoints *dict, const std::string& key, DatapointValue::dataTagType type);
29  Datapoints *findListElement (Datapoints *dict, const std::string& key);
30  std::string findStringElement (Datapoints* dict, const std::string& key);
31 
32  // delete
33  void deleteValue(Datapoints *dps, const std::string& key);
34 
35  // Function for create element
36  Datapoint *createStringElement (Datapoints *dps, const std::string& key, const std::string& valueDefault);
37  Datapoint *createIntegerElement (Datapoints *dps, const std::string& key, long valueDefault);
38  Datapoint *createDictElement (Datapoints *dps, const std::string& key);
39  Datapoint *createListElement (Datapoints *dps, const std::string& key);
40  Datapoint *createDictOrListElement (Datapoints* dps, const std::string& key, bool dict);
41 };
42 
43 #endif // INCLUDE_DATAPOINT_UTILITY_H_
Name and value pair used to represent a data value within an asset reading.
Definition: datapoint.h:310
Definition: datapoint_utility.h:19
Class to hold an actual reading value.
Definition: datapoint.h:30