Squashed messages from 9 commits:
9.
Properties now uses PropertyFamily and contained classes.
Fetching,seting,clearing properties can be done with PropertyFamilyKey or PropertyTypeKey.
Hierarchy of newly added clases is:
Vertices -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}
Edges -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}
PropertyFamilyKey -> PropertyType
PropertyTypeKey -> PropertyType
PropertyType t0,t1;
let t0!=t1 be true
let t0.family==t1.family be true
then next is true
PropertyTypeKey{&t0}!=PropertyTypeKey{&t1}
PropertyFamilyKey{&t0}==PropertyFamilyKey{&t1}
PropertyFamilyKey{&t0}==PropertyTypeKey{&t1}
PropertyTypeKey{&t0}==PropertyFamilyKey{&t1}
8.
Intermedate commit.
Noticed that integration queries throw SEGFAULT.
7.
Defined interface for indexes.
Fixed three memory leaks.
Fixed integration_queries test which now passes.
6.
Commit which return Xorshift128plus to valid shape.
5.
Tmp commit.
4.
Label Index is compiling.
3.
tmp
2.
Vertex::Accessor now updates Label index.
1.
Applied changes for code review.
36 lines
963 B
C++
36 lines
963 B
C++
#pragma once
|
|
|
|
#include "utils/iterator/range_iterator.hpp"
|
|
#include "utils/option.hpp"
|
|
|
|
namespace iter
|
|
{
|
|
// Class which turns ranged iterator with next() into accessor.
|
|
// T - type of return value
|
|
// I - iterator type
|
|
template <class T, class I>
|
|
class OneTimeAccessor
|
|
{
|
|
public:
|
|
OneTimeAccessor() : it(Option<RangeIterator<T, I>>()) {}
|
|
OneTimeAccessor(I &&it) : it(RangeIterator<T, I>(std::move(it))) {}
|
|
|
|
RangeIterator<T, I> begin() { return it.take(); }
|
|
|
|
RangeIterator<T, I> end() { return RangeIterator<T, I>(); }
|
|
|
|
private:
|
|
Option<RangeIterator<T, I>> it;
|
|
};
|
|
|
|
template <class I>
|
|
auto make_one_time_accessor(I &&iter)
|
|
{
|
|
// Because function isn't receving or in any way using type T from
|
|
// OneTimeAccessor compiler can't deduce it thats way there is decltype in
|
|
// construction of OneTimeAccessor. Resoulting type of iter.next().take() is
|
|
// T.
|
|
return OneTimeAccessor<decltype(iter.next().take()), I>(std::move(iter));
|
|
}
|
|
}
|