PropertyValueStore - remove Accept function (never used, never will be)
Reviewers: buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D781
This commit is contained in:
parent
00723d34c3
commit
36fb7f9554
@ -127,20 +127,6 @@ class PropertyValueStore {
|
|||||||
*/
|
*/
|
||||||
auto end() const { return props_.end(); }
|
auto end() const { return props_.end(); }
|
||||||
|
|
||||||
/**
|
|
||||||
* Accepts two functions.
|
|
||||||
*
|
|
||||||
* @param handler Called for each PropertyValue in this collection.
|
|
||||||
* @param finish Called once in the end.
|
|
||||||
*/
|
|
||||||
void Accept(std::function<void(const TKey, const PropertyValue &)> handler,
|
|
||||||
std::function<void()> finish = {}) const {
|
|
||||||
if (handler)
|
|
||||||
for (const auto &prop : props_) handler(prop.first, prop.second);
|
|
||||||
|
|
||||||
if (finish) finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::pair<TKey, PropertyValue>> props_;
|
std::vector<std::pair<TKey, PropertyValue>> props_;
|
||||||
};
|
};
|
||||||
|
@ -33,15 +33,6 @@ const PropertyValueStore<GraphDbTypes::Property>
|
|||||||
return current().properties_;
|
return current().properties_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TRecord>
|
|
||||||
void RecordAccessor<TRecord>::PropertiesAccept(
|
|
||||||
std::function<void(const GraphDbTypes::Property key,
|
|
||||||
const PropertyValue &prop)>
|
|
||||||
handler,
|
|
||||||
std::function<void()> finish) const {
|
|
||||||
current().properties_.Accept(handler, finish);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename TRecord>
|
template <typename TRecord>
|
||||||
GraphDbAccessor &RecordAccessor<TRecord>::db_accessor() const {
|
GraphDbAccessor &RecordAccessor<TRecord>::db_accessor() const {
|
||||||
return *db_accessor_;
|
return *db_accessor_;
|
||||||
|
@ -104,32 +104,6 @@ TEST(PropertyValueStore, Size) {
|
|||||||
EXPECT_EQ(props.size(), 100);
|
EXPECT_EQ(props.size(), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PropertyValueStore, Accept) {
|
|
||||||
int count_props = 0;
|
|
||||||
int count_finish = 0;
|
|
||||||
|
|
||||||
auto handler = [&](const uint32_t, const PropertyValue &) {
|
|
||||||
count_props += 1;
|
|
||||||
};
|
|
||||||
auto finish = [&]() { count_finish += 1; };
|
|
||||||
|
|
||||||
PropertyValueStore<uint32_t> props;
|
|
||||||
props.Accept(handler, finish);
|
|
||||||
EXPECT_EQ(count_props, 0);
|
|
||||||
EXPECT_EQ(count_finish, 1);
|
|
||||||
|
|
||||||
props.Accept(handler);
|
|
||||||
EXPECT_EQ(count_props, 0);
|
|
||||||
EXPECT_EQ(count_finish, 1);
|
|
||||||
|
|
||||||
props.set(0, 20);
|
|
||||||
props.set(1, "bla");
|
|
||||||
|
|
||||||
props.Accept(handler, finish);
|
|
||||||
EXPECT_EQ(count_props, 2);
|
|
||||||
EXPECT_EQ(count_finish, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(PropertyValueStore, InsertRetrieveList) {
|
TEST(PropertyValueStore, InsertRetrieveList) {
|
||||||
PropertyValueStore<> props;
|
PropertyValueStore<> props;
|
||||||
props.set(0, std::vector<PropertyValue>{1, true, 2.5, "something",
|
props.set(0, std::vector<PropertyValue>{1, true, 2.5, "something",
|
||||||
|
Loading…
Reference in New Issue
Block a user