Commit 17634357 authored by Philipp Götze's avatar Philipp Götze

🔧 Switched to c++14 because of PFarbic dependencies not ready for...

🔧 Switched to c++14 because of PFarbic dependencies not ready for C++17. Used mpark/variant instead of c++17 feature std::variant
parent bd237439
......@@ -76,3 +76,17 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E chdir ${nvml_SOURCE_DIR} $(MAKE)
COMMAND ${CMAKE_COMMAND} -E chdir ${nvml_SOURCE_DIR} $(MAKE) install prefix=${THIRD_PARTY_DIR}/nvml
)
#--------------------------------------------------------------------------------
# std::variant for C++ standard less c++17
download_project(PROJ variant
GIT_REPOSITORY https://github.com/mpark/variant.git
GIT_TAG master
UPDATE_DISCONNECTED 1
QUIET
)
add_custom_command(
OUTPUT ${THIRD_PARTY_DIR}/variant
COMMAND ${CMAKE_COMMAND} -E chdir ${variant_SOURCE_DIR} cmake . -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_DIR}/variant
COMMAND ${CMAKE_COMMAND} -E chdir ${variant_SOURCE_DIR} cmake --build . --target install
)
......@@ -28,13 +28,13 @@ option(BUILD_TEST_CASES
#Build google benchmark library
option(BUILD_GOOGLE_BENCH
"build google benchmark"
ON
OFF
)
# Build benchmark test
option(BUILD_BENCHMARKS
"build benchmarks for PTABLE"
ON
OFF
)
# Benchmark test requires benchmark library
......@@ -43,7 +43,7 @@ if (BUILD_BENCHMARKS)
endif()
# C++ compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-deprecated -g -O2 -Wsign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wno-deprecated -g -O2 -Wsign-compare")
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs -Wno-#pragma-messages")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
......@@ -112,7 +112,8 @@ set(core_sources
${THIRD_PARTY_DIR}/fmt
${THIRD_PARTY_DIR}/catch
${THIRD_PARTY_DIR}/nvml
)
${THIRD_PARTY_DIR}/variant
)
if(BUILD_GOOGLE_BENCH)
set(core_sources
......
......@@ -21,7 +21,7 @@
#define PTable_hpp_
#include <bitset>
#include <variant>
#include "variant/include/mpark/variant.hpp"
#include "core/BDCCInfo.hpp"
#include "core/PTableException.hpp"
......@@ -41,7 +41,7 @@ auto const TARGET_INDEX_NODE_SIZE = 4 * 1024; // 4KB
const auto NOT_ENOUGH_SPACE = 1;
/** A variant to support multiple types in ColumnRangeMap*/
using IntDoubleString = std::variant<int, double, std::string>;
using IntDoubleString = mpark::variant<int, double, std::string>;
/** A mapping from Column ID to desired Range; used for range scans */
using ColumnRangeMap = std::unordered_map<uint16_t, std::pair<IntDoubleString, IntDoubleString>>;
......@@ -1038,10 +1038,10 @@ class PTable {
case Int_Type: {
const auto &smaMin = reinterpret_cast<const int &>(b.get_ro()[smaPos]);
const auto &smaMax = reinterpret_cast<const int &>(b.get_ro()[smaPos + sizeof(int)]);
PLOG("predicate range: " << std::get<int>(p.second.first) << '-'
<< std::get<int>(p.second.second)
PLOG("predicate range: " << mpark::get<int>(p.second.first) << '-'
<< mpark::get<int>(p.second.second)
<< ", block range: " << smaMin << '-' << smaMax)
if (std::get<int>(p.second.second) < smaMin || std::get<int>(p.second.first) > smaMax) {
if (mpark::get<int>(p.second.second) < smaMin || mpark::get<int>(p.second.first) > smaMax) {
inRange = false;
goto marker;
}
......@@ -1050,10 +1050,10 @@ class PTable {
case Double_Type: {
const auto &smaMin = reinterpret_cast<const double &>(b.get_ro()[smaPos]);
const auto &smaMax = reinterpret_cast<const double &>(b.get_ro()[smaPos + sizeof(double)]);
PLOG("predicate range: " << std::get<double>(p.second.first) << '-'
<< std::get<double>(p.second.second)
PLOG("predicate range: " << mpark::get<double>(p.second.first) << '-'
<< mpark::get<double>(p.second.second)
<< ", block range: " << smaMin << '-' << smaMax)
if (std::get<double>(p.second.second) < smaMin || std::get<double>(p.second.first) > smaMax) {
if (mpark::get<double>(p.second.second) < smaMin || mpark::get<double>(p.second.first) > smaMax) {
inRange = false;
goto marker;
}
......@@ -1064,10 +1064,10 @@ class PTable {
const auto &smaMaxPos = (uint16_t &) b.get_ro()[smaPos + gOffsetSize];
const auto smaMin(reinterpret_cast<const char (&)[]>(b.get_ro()[smaMinPos]));
const auto smaMax(reinterpret_cast<const char (&)[]>(b.get_ro()[smaMaxPos]));
PLOG("predicate range: " << std::get<std::string>(p.second.first) << '-'
<< std::get<std::string>(p.second.second)
PLOG("predicate range: " << mpark::get<std::string>(p.second.first) << '-'
<< mpark::get<std::string>(p.second.second)
<< ", block range: " << smaMin << '-' << smaMax)
if (std::get<std::string>(p.second.second) < smaMin || std::get<std::string>(p.second.first) > smaMax) {
if (mpark::get<std::string>(p.second.second) < smaMin || mpark::get<std::string>(p.second.first) > smaMax) {
inRange = false;
goto marker;
}
......@@ -1095,21 +1095,21 @@ class PTable {
switch (tInfo.columnInfo(p.first).getType()) {
case Int_Type: {
const auto &value = reinterpret_cast<const int &>(b[offset]);
if (std::get<int>(p.second.second) < value || std::get<int>(p.second.first) > value) {
if (mpark::get<int>(p.second.second) < value || mpark::get<int>(p.second.first) > value) {
return false;
}
}
break;
case Double_Type: {
const auto &value = reinterpret_cast<const double &>(b[offset]);
if (std::get<double>(p.second.second) < value || std::get<double>(p.second.first) > value) {
if (mpark::get<double>(p.second.second) < value || mpark::get<double>(p.second.first) > value) {
return false;
}
}
break;
case String_Type: {
const std::string value(reinterpret_cast<const char (&)[]>(b[offset]));
if (std::get<std::string>(p.second.second) < value || std::get<std::string>(p.second.first) > value) {
if (mpark::get<std::string>(p.second.second) < value || mpark::get<std::string>(p.second.first) > value) {
return false;
}
}
......
......@@ -21,6 +21,7 @@
#define DataNode_hpp_
#include <array>
#include <unordered_map>
#include <libpmemobj++/make_persistent.hpp>
#include <libpmemobj++/persistent_ptr.hpp>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment