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
This commit is contained in:
parent
fb90394499
commit
68f57fa47d
@ -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
|
||||
|
@ -1,68 +0,0 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "storage/typed_value_store.hpp"
|
||||
|
||||
template <typename TKey>
|
||||
const TypedValue &TypedValueStore::at(const TKey &key) const {
|
||||
for (const auto &kv : props_)
|
||||
if (kv.first == key) return kv.second;
|
||||
|
||||
return TypedValue::Null;
|
||||
}
|
||||
|
||||
template <typename TKey, typename TValue>
|
||||
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<std::string>(const TKey &key,
|
||||
const std::string &value);
|
||||
template void TypedValueStore::set<bool>(const TKey &key, const bool &value);
|
||||
template void TypedValueStore::set<int>(const TKey &key, const int &value);
|
||||
template void TypedValueStore::set<float>(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<TKey, TypedValue> &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<void(const TypedValueStore::TKey, const TypedValue &)>
|
||||
handler,
|
||||
std::function<void()> finish) const {
|
||||
if (handler)
|
||||
for (const auto &prop : props_) handler(prop.first, prop.second);
|
||||
|
||||
if (finish) finish();
|
||||
}
|
Loading…
Reference in New Issue
Block a user