45 lines
981 B
C++
45 lines
981 B
C++
#ifndef INFLUXDB_H
|
|
#define INFLUXDB_H
|
|
|
|
#include <stdio.h>
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <curl/curl.h>
|
|
|
|
class InfluxDB{
|
|
private:
|
|
|
|
CURL * curl;
|
|
CURLcode respond;
|
|
long respondCode;
|
|
|
|
std::string databaseIP;
|
|
std::string dataPoints;
|
|
|
|
static size_t WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp);
|
|
|
|
void Execute();
|
|
|
|
public:
|
|
/// url = https://fsunuc.physics.fsu.edu/InfluxDB/
|
|
InfluxDB(std::string url, bool verbose = false);
|
|
~InfluxDB();
|
|
|
|
/// Query
|
|
std::string ShowDatabases();
|
|
std::string Query(std::string databaseName, std::string query);
|
|
|
|
void CreateDatabase(std::string databaseName);
|
|
|
|
/// for single or batch write,
|
|
/// 1, addDataPoint first, you can add as many as you like
|
|
/// 2, writeData.
|
|
void AddDataPoint(std::string fullString);
|
|
void ClearDataPoints();
|
|
void PrintDataPoints();
|
|
void WriteData(std::string databaseName);
|
|
|
|
};
|
|
|
|
#endif
|