5a42e15c4a
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.
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "data_structures/concurrent/common.hpp"
|
|
#include "data_structures/concurrent/skiplist.hpp"
|
|
|
|
template <class T>
|
|
class ConcurrentSet
|
|
{
|
|
typedef SkipList<T> list;
|
|
typedef typename SkipList<T>::Iterator list_it;
|
|
typedef typename SkipList<T>::ConstIterator list_it_con;
|
|
|
|
public:
|
|
ConcurrentSet() {}
|
|
|
|
class Accessor : public AccessorBase<T>
|
|
{
|
|
friend class ConcurrentSet;
|
|
|
|
using AccessorBase<T>::AccessorBase;
|
|
|
|
private:
|
|
using AccessorBase<T>::accessor;
|
|
|
|
public:
|
|
std::pair<list_it, bool> insert(const T &item)
|
|
{
|
|
return accessor.insert(item);
|
|
}
|
|
|
|
std::pair<list_it, bool> insert(T &&item)
|
|
{
|
|
return accessor.insert(std::move(item));
|
|
}
|
|
|
|
list_it_con find(const T &item) const { return accessor.find(item); }
|
|
|
|
list_it find(const T &item) { return accessor.find(item); }
|
|
|
|
bool contains(const T &item) const
|
|
{
|
|
return this->find(item) != this->end();
|
|
}
|
|
|
|
bool remove(const T &item) { return accessor.remove(item); }
|
|
};
|
|
|
|
Accessor access() { return Accessor(&skiplist); }
|
|
|
|
const Accessor access() const { return Accessor(&skiplist); }
|
|
|
|
private:
|
|
list skiplist;
|
|
};
|