From 68f57fa47d487056b8cea670e14a477475ca329d Mon Sep 17 00:00:00 2001 From: florijan Date: Mon, 20 Feb 2017 09:37:48 +0100 Subject: [PATCH] CMakeLists cleanup w.r.t. Antlr linking. Removed the unused typed_value_store.cpp Summary: See above. Test Plan: Building tested. Reviewers: buda Reviewed By: buda Subscribers: pullbot, buda Differential Revision: https://phabricator.memgraph.io/D50 --- CMakeLists.txt | 6 +-- src/storage/typed_value_store.cpp | 68 ------------------------------- 2 files changed, 2 insertions(+), 72 deletions(-) delete mode 100644 src/storage/typed_value_store.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f098de56..44ef4ed12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,8 +81,6 @@ set(fmt_static_lib ${fmt_source_dir}/fmt/libfmt.a) set(yaml_source_dir ${libs_dir}/yaml-cpp) set(yaml_include_dir ${yaml_source_dir}/include) set(yaml_static_lib ${yaml_source_dir}/libyaml-cpp.a) -# antlr -set(antlr_static_lib ${CMAKE_SOURCE_DIR}/dist/libantlr4-runtime.a) # prepare template and destination folders for query engine (tests) # and memgraph server binary @@ -219,7 +217,7 @@ endif() option(MEMGRAPH "Build memgraph binary" ON) message(STATUS "MEMGRAPH binary: ${MEMGRAPH}") # proof of concept -option(POC "Build proof of concept binaries" ON) +option(POC "Build proof of concept binaries" OFF) message(STATUS "POC binaries: ${POC}") # tests option(ALL_TESTS "Add all test binaries" ON) @@ -279,7 +277,7 @@ include_directories( ) add_library(antlr_opencypher_parser_lib STATIC ${antlr_opencypher_generated_src}) -target_link_libraries(antlr_opencypher_parser_lib ${antlr_static_lib}) +target_link_libraries(antlr_opencypher_parser_lib antlr4_static) # ----------------------------------------------------------------------------- # all memgraph src files diff --git a/src/storage/typed_value_store.cpp b/src/storage/typed_value_store.cpp deleted file mode 100644 index 0899cd911..000000000 --- a/src/storage/typed_value_store.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include - -#include "storage/typed_value_store.hpp" - -template -const TypedValue &TypedValueStore::at(const TKey &key) const { - for (const auto &kv : props_) - if (kv.first == key) return kv.second; - - return TypedValue::Null; -} - -template -void TypedValueStore::set(const TKey &key, const TValue &value) { - for (auto &kv : props_) - if (kv.first == key) { - kv.second = TypedValue(value); - return; - } - - // there is no value for the given key, add new - // TODO consider vector size increment optimization - props_.push_back(std::move(std::make_pair(key, value))); -} - -// instantiations of the TypedValueStore::set function -// instances must be made for all of the supported C++ types -template void TypedValueStore::set(const TKey &key, - const std::string &value); -template void TypedValueStore::set(const TKey &key, const bool &value); -template void TypedValueStore::set(const TKey &key, const int &value); -template void TypedValueStore::set(const TKey &key, const float &value); - -/** - * Set overriding for character constants. Forces conversion - * to std::string, otherwise templating might cast the pointer - * to something else (bool) and mess things up. - * - * @param key The key for which the property is set. The previous - * value at the same key (if there was one) is replaced. - * @param value The value to set. - */ -void TypedValueStore::set(const TKey &key, const char *value) { - set(key, std::string(value)); -} - -size_t TypedValueStore::erase(const TKey &key) const { - auto found = std::find_if( - props_.begin(), props_.end(), - [&key](std::pair &kv) { return kv.first == key; }); - if (found != props_.end()) { - props_.erase(found); - return 1; - } - return 0; -} - -size_t TypedValueStore::size() { return props_.size(); } - -void TypedValueStore::Accept( - std::function - handler, - std::function finish) const { - if (handler) - for (const auto &prop : props_) handler(prop.first, prop.second); - - if (finish) finish(); -}