Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cmake_minimum_required (VERSION 3.15)

project (TSFLIB)
SET (CMAKE_C_FLAGS "-std=c99")
SET (CMAKE_CXX_FLAGS "-Wall -std=c++17")
SET (CMAKE_CXX_FLAGS "-Wall -std=c++23")
SET (CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-DNO_MYSQL)

Expand All @@ -32,13 +32,13 @@ IF(APPLE)
SET(EXTRA_LIBS ${SECURITY_FRAMEWORK} ${CORE_FRAMEWORK})
ENDIF (APPLE)

find_package(CURL REQUIRED)
find_package(Boost REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(sqlite_modern_cpp REQUIRED)
find_package(oatpp REQUIRED)
find_package(oatpp-openssl REQUIRED)
find_package(httplib REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(glaze REQUIRED)

# the tsf library
include_directories(
Expand Down Expand Up @@ -97,18 +97,18 @@ add_library(tsflib

set_target_properties(
tsflib PROPERTIES
CXX_STANDARD 17
CXX_STANDARD 23
)

target_compile_definitions(tsflib PRIVATE MAXFLOAT=3.40282347e+38F)
set(tsflib_deps
CURL::libcurl
boost::boost
SQLite::SQLite3
sqlite_modern_cpp::sqlite_modern_cpp
oatpp::oatpp
oatpp::oatpp-openssl
httplib::httplib
openssl::openssl
nlohmann_json::nlohmann_json
glaze::glaze
)


Expand All @@ -122,6 +122,7 @@ add_executable(tsflib_test
./test/test_main.cpp
./test/test_units.cpp
./test/test_curve.cpp
./test/test_clock.cpp
./test/test_record.cpp
./test/test_influx.cpp
./test/test_filters.cpp
Expand Down
9 changes: 4 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout

Expand All @@ -14,6 +13,7 @@ class TSFlib(ConanFile):
default_options = {
"shared": False,
"fPIC": True,
"cpp-httplib/*:with_openssl": True,
"boost*:without_container": True,
"boost*:without_context": True,
"boost*:without_contract": True,
Expand Down Expand Up @@ -44,13 +44,12 @@ class TSFlib(ConanFile):
}

def requirements(self):
self.requires("zlib/1.2.13")
self.requires("zlib/1.3.1")
self.requires("openssl/3.1.2")
self.requires("oatpp/1.3.0")
self.requires("oatpp-openssl/1.3.0")
self.requires("cpp-httplib/0.39.0")
self.requires("boost/1.83.0")
self.requires("nlohmann_json/3.10.5")
self.requires("libcurl/7.80.0")
self.requires("glaze/7.2.0")
#self.requires("sqlite3/3.45.3")
self.requires("sqlite_modern_cpp/3.2")

Expand Down
8 changes: 4 additions & 4 deletions src/Clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ std::ostream& TSF::operator<< (std::ostream &out, Clock &clock) {
#pragma mark - Public Methods


std::string Clock::name() {
std::string Clock::name() const {
return _name;
}

Expand Down Expand Up @@ -86,7 +86,7 @@ bool Clock::isValid(time_t time) {
}


int Clock::period() {
int Clock::period() const {
return _period;
}

Expand All @@ -97,7 +97,7 @@ void Clock::setPeriod(int p) {
}
}

time_t Clock::start() {
time_t Clock::start() const {
return _start;
}

Expand Down Expand Up @@ -165,4 +165,4 @@ std::ostream& Clock::toStream(std::ostream &stream) {

time_t Clock::timeOffset(time_t time) {
return ( (time - (start() % period())) % period() );
}
}
18 changes: 15 additions & 3 deletions src/Clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <set>
#include "tsfMacros.h"
#include "TimeRange.h"
#include <glaze/glaze.hpp>

namespace TSF {

Expand Down Expand Up @@ -89,7 +90,7 @@ namespace TSF {

bool isEqual(Clock::_sp other);

std::string name();
std::string name() const;
void setName(std::string name);

virtual bool isCompatibleWith(Clock::_sp clock);
Expand All @@ -99,9 +100,9 @@ namespace TSF {
virtual time_t timeBefore(time_t time);


int period();
int period() const;
void setPeriod(int p);
time_t start();
time_t start() const;
void setStart(time_t startTime);
virtual std::set< time_t > timeValuesInRange(TimeRange range);
virtual std::ostream& toStream(std::ostream &stream);
Expand All @@ -116,6 +117,17 @@ namespace TSF {
};

std::ostream& operator<< (std::ostream &out, Clock &clock);

}

template <>
struct glz::meta<TSF::Clock> {
using T = TSF::Clock;
static constexpr auto value = glz::object(
"name", glz::custom<&T::setName, &T::name>,
"period", glz::custom<&T::setPeriod, &T::period>,
"offset", glz::custom<&T::setStart, &T::start>
);
};

#endif
76 changes: 0 additions & 76 deletions src/Components.hpp

This file was deleted.

Loading