#pragma once #ifndef TSDB_CPP_HPP #define TSDB_CPP_HPP #include #include #include #include #include #ifdef _WIN32 #define TSDB_EXPORT __declspec(dllexport) #else #define TSDB_EXPORT #endif TSDB_EXPORT void tsdb(); TSDB_EXPORT void tsdb_print_vector(const std::vector& strings); namespace tsdb_cpp { /// @brief A point in time series database. struct point { const std::string& name_; double value_; long long nanoseconds_; point(const std::string& name, double value, long long nanoseconds) : name_(name), value_(value), nanoseconds_(nanoseconds) {} }; struct tsdb_entry_impl; /// @brief A time series database. struct tsdb_entry { tsdb_entry(std::string_view remote, uint16_t port = 9000); ~tsdb_entry(); tsdb_entry(tsdb_entry&& other); void close(); void create_table(); void create_memory_table(); void drop_table(); void drop_memory_table(); void set_active_table(std::string_view table_name); void set_metric_name(std::string_view metric_name); void insert_point(const point& p); void insert_points(const std::vector& points); private: std::unique_ptr impl_; }; } // namespace tsdb_cpp #endif // TSDB_CPP_HPP