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

🔧 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( ...@@ -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)
COMMAND ${CMAKE_COMMAND} -E chdir ${nvml_SOURCE_DIR} $(MAKE) install prefix=${THIRD_PARTY_DIR}/nvml 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 ...@@ -28,13 +28,13 @@ option(BUILD_TEST_CASES
#Build google benchmark library #Build google benchmark library
option(BUILD_GOOGLE_BENCH option(BUILD_GOOGLE_BENCH
"build google benchmark" "build google benchmark"
ON OFF
) )
# Build benchmark test # Build benchmark test
option(BUILD_BENCHMARKS option(BUILD_BENCHMARKS
"build benchmarks for PTABLE" "build benchmarks for PTABLE"
ON OFF
) )
# Benchmark test requires benchmark library # Benchmark test requires benchmark library
...@@ -43,7 +43,7 @@ if (BUILD_BENCHMARKS) ...@@ -43,7 +43,7 @@ if (BUILD_BENCHMARKS)
endif() endif()
# C++ compiler flags # 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") if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs -Wno-#pragma-messages") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs -Wno-#pragma-messages")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
...@@ -112,7 +112,8 @@ set(core_sources ...@@ -112,7 +112,8 @@ set(core_sources
${THIRD_PARTY_DIR}/fmt ${THIRD_PARTY_DIR}/fmt
${THIRD_PARTY_DIR}/catch ${THIRD_PARTY_DIR}/catch
${THIRD_PARTY_DIR}/nvml ${THIRD_PARTY_DIR}/nvml
) ${THIRD_PARTY_DIR}/variant
)
if(BUILD_GOOGLE_BENCH) if(BUILD_GOOGLE_BENCH)
set(core_sources set(core_sources
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define PTable_hpp_ #define PTable_hpp_
#include <bitset> #include <bitset>
#include <variant> #include "variant/include/mpark/variant.hpp"
#include "core/BDCCInfo.hpp" #include "core/BDCCInfo.hpp"
#include "core/PTableException.hpp" #include "core/PTableException.hpp"
...@@ -41,7 +41,7 @@ auto const TARGET_INDEX_NODE_SIZE = 4 * 1024; // 4KB ...@@ -41,7 +41,7 @@ auto const TARGET_INDEX_NODE_SIZE = 4 * 1024; // 4KB
const auto NOT_ENOUGH_SPACE = 1; const auto NOT_ENOUGH_SPACE = 1;
/** A variant to support multiple types in ColumnRangeMap*/ /** 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 */ /** A mapping from Column ID to desired Range; used for range scans */
using ColumnRangeMap = std::unordered_map<uint16_t, std::pair<IntDoubleString, IntDoubleString>>; using ColumnRangeMap = std::unordered_map<uint16_t, std::pair<IntDoubleString, IntDoubleString>>;
...@@ -1038,10 +1038,10 @@ class PTable { ...@@ -1038,10 +1038,10 @@ class PTable {
case Int_Type: { case Int_Type: {
const auto &smaMin = reinterpret_cast<const int &>(b.get_ro()[smaPos]); const auto &smaMin = reinterpret_cast<const int &>(b.get_ro()[smaPos]);
const auto &smaMax = reinterpret_cast<const int &>(b.get_ro()[smaPos + sizeof(int)]); const auto &smaMax = reinterpret_cast<const int &>(b.get_ro()[smaPos + sizeof(int)]);
PLOG("predicate range: " << std::get<int>(p.second.first) << '-' PLOG("predicate range: " << mpark::get<int>(p.second.first) << '-'
<< std::get<int>(p.second.second) << mpark::get<int>(p.second.second)
<< ", block range: " << smaMin << '-' << smaMax) << ", 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; inRange = false;
goto marker; goto marker;
} }
...@@ -1050,10 +1050,10 @@ class PTable { ...@@ -1050,10 +1050,10 @@ class PTable {
case Double_Type: { case Double_Type: {
const auto &smaMin = reinterpret_cast<const double &>(b.get_ro()[smaPos]); const auto &smaMin = reinterpret_cast<const double &>(b.get_ro()[smaPos]);
const auto &smaMax = reinterpret_cast<const double &>(b.get_ro()[smaPos + sizeof(double)]); const auto &smaMax = reinterpret_cast<const double &>(b.get_ro()[smaPos + sizeof(double)]);
PLOG("predicate range: " << std::get<double>(p.second.first) << '-' PLOG("predicate range: " << mpark::get<double>(p.second.first) << '-'
<< std::get<double>(p.second.second) << mpark::get<double>(p.second.second)
<< ", block range: " << smaMin << '-' << smaMax) << ", 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; inRange = false;
goto marker; goto marker;
} }
...@@ -1064,10 +1064,10 @@ class PTable { ...@@ -1064,10 +1064,10 @@ class PTable {
const auto &smaMaxPos = (uint16_t &) b.get_ro()[smaPos + gOffsetSize]; const auto &smaMaxPos = (uint16_t &) b.get_ro()[smaPos + gOffsetSize];
const auto smaMin(reinterpret_cast<const char (&)[]>(b.get_ro()[smaMinPos])); const auto smaMin(reinterpret_cast<const char (&)[]>(b.get_ro()[smaMinPos]));
const auto smaMax(reinterpret_cast<const char (&)[]>(b.get_ro()[smaMaxPos])); const auto smaMax(reinterpret_cast<const char (&)[]>(b.get_ro()[smaMaxPos]));
PLOG("predicate range: " << std::get<std::string>(p.second.first) << '-' PLOG("predicate range: " << mpark::get<std::string>(p.second.first) << '-'
<< std::get<std::string>(p.second.second) << mpark::get<std::string>(p.second.second)
<< ", block range: " << smaMin << '-' << smaMax) << ", 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; inRange = false;
goto marker; goto marker;
} }
...@@ -1095,21 +1095,21 @@ class PTable { ...@@ -1095,21 +1095,21 @@ class PTable {
switch (tInfo.columnInfo(p.first).getType()) { switch (tInfo.columnInfo(p.first).getType()) {
case Int_Type: { case Int_Type: {
const auto &value = reinterpret_cast<const int &>(b[offset]); 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; return false;
} }
} }
break; break;
case Double_Type: { case Double_Type: {
const auto &value = reinterpret_cast<const double &>(b[offset]); 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; return false;
} }
} }
break; break;
case String_Type: { case String_Type: {
const std::string value(reinterpret_cast<const char (&)[]>(b[offset])); 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; return false;
} }
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define DataNode_hpp_ #define DataNode_hpp_
#include <array> #include <array>
#include <unordered_map>
#include <libpmemobj++/make_persistent.hpp> #include <libpmemobj++/make_persistent.hpp>
#include <libpmemobj++/persistent_ptr.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