commit before changing profile.cpp
This commit is contained in:
parent
cdfa0e7106
commit
fc71e9930b
@ -14,6 +14,8 @@ namespace barrier
|
|||||||
// barrier class defined here.
|
// barrier class defined here.
|
||||||
|
|
||||||
// ************ Here should be forward declarations of Sized barrier classes
|
// ************ Here should be forward declarations of Sized barrier classes
|
||||||
|
class DbAccessor; // DONE // .cpp
|
||||||
|
|
||||||
class VertexAccessor; // DONE // .cpp
|
class VertexAccessor; // DONE // .cpp
|
||||||
class EdgeAccessor; // DONE // .cpp
|
class EdgeAccessor; // DONE // .cpp
|
||||||
|
|
||||||
@ -40,8 +42,7 @@ class BoltSerializer; // DONE // .cpp
|
|||||||
class Label; // DONE // .cpp
|
class Label; // DONE // .cpp
|
||||||
class EdgeType; // DONE // .cpp
|
class EdgeType; // DONE // .cpp
|
||||||
|
|
||||||
class Db;
|
class Db; // DONE // .cpp
|
||||||
class DbAccessor; // DONE // .cpp
|
|
||||||
|
|
||||||
class VertexPropertyFamily; // DONE // .cpp
|
class VertexPropertyFamily; // DONE // .cpp
|
||||||
class EdgePropertyFamily; // DONE // .cpp
|
class EdgePropertyFamily; // DONE // .cpp
|
||||||
|
@ -102,11 +102,8 @@ protected:
|
|||||||
// with T which it holds where T is original class from memgraph.
|
// with T which it holds where T is original class from memgraph.
|
||||||
template <class T>
|
template <class T>
|
||||||
Sized(T &&d)
|
Sized(T &&d)
|
||||||
: data(value_as<
|
|
||||||
typename std::aligned_storage<size_B, alignment_B>::type>(
|
|
||||||
std::move(d)))
|
|
||||||
{
|
{
|
||||||
|
new (ptr_as<T>(&data)) T(std::move(d));
|
||||||
static_assert(size_B == sizeof(T), "Border class size mismatch");
|
static_assert(size_B == sizeof(T), "Border class size mismatch");
|
||||||
static_assert(alignment_B == alignof(T),
|
static_assert(alignment_B == alignof(T),
|
||||||
"Border class aligment mismatch");
|
"Border class aligment mismatch");
|
||||||
@ -117,11 +114,8 @@ protected:
|
|||||||
// with T which it holds where T is original class from memgraph.
|
// with T which it holds where T is original class from memgraph.
|
||||||
template <class T>
|
template <class T>
|
||||||
Sized(const T &&d)
|
Sized(const T &&d)
|
||||||
: data(value_as<
|
|
||||||
const typename std::aligned_storage<size_B, alignment_B>::type>(
|
|
||||||
std::move(d)))
|
|
||||||
{
|
{
|
||||||
|
new (ptr_as<T>(&data)) T(std::move(d));
|
||||||
static_assert(size_B == sizeof(T), "Border class size mismatch");
|
static_assert(size_B == sizeof(T), "Border class size mismatch");
|
||||||
static_assert(alignment_B == alignof(T),
|
static_assert(alignment_B == alignof(T),
|
||||||
"Border class aligment mismatch");
|
"Border class aligment mismatch");
|
||||||
|
@ -3,17 +3,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
// #include "database/db.hpp"
|
|
||||||
// #include "database/db_accessor.cpp"
|
|
||||||
// #include "database/db_accessor.hpp"
|
|
||||||
// #include "query_engine/query_stripper.hpp"
|
|
||||||
// #include "query_engine/util.hpp"
|
|
||||||
// #include "storage/indexes/impl/nonunique_unordered_index.cpp"
|
|
||||||
// #include "storage/model/properties/property.hpp"
|
|
||||||
// #include "storage/model/properties/property_family.hpp"
|
|
||||||
// #include "utils/command_line/arguments.hpp"
|
|
||||||
// #include "utils/iterator/iterator.hpp"
|
|
||||||
|
|
||||||
#include "barrier/barrier.hpp"
|
#include "barrier/barrier.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -39,10 +39,7 @@ sha::Accessor &sha::Accessor::operator=(sha::Accessor &&other)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sha::Accessor::get_prop(sha::Name &name)
|
int sha::Accessor::get_prop(sha::Name &name) { return as<::Accessor>().data; }
|
||||||
{
|
|
||||||
return as<::Accessor>().data;
|
|
||||||
}
|
|
||||||
|
|
||||||
sha::Accessor sha::Db::access()
|
sha::Accessor sha::Db::access()
|
||||||
{
|
{
|
||||||
|
@ -69,6 +69,32 @@
|
|||||||
{ \
|
{ \
|
||||||
return ptr_as<const y>(l); \
|
return ptr_as<const y>(l); \
|
||||||
}
|
}
|
||||||
|
#define DESTRUCTOR(x, y) \
|
||||||
|
x::~x() { HALF_CALL(~y()); }
|
||||||
|
#define COPY_CONSTRUCTOR(x, y) \
|
||||||
|
x::x(const x &other) : Sized(y(trans(other))) {}
|
||||||
|
#define MOVE_CONSTRUCTOR(x) \
|
||||||
|
x::x(x &&other) : Sized(trans(std::move(other))) {}
|
||||||
|
#define MOVE_CONST_CONSTRUCTOR(x) \
|
||||||
|
x::x(x const &&other) : Sized(trans(std::move(other))) {}
|
||||||
|
|
||||||
|
// For certain classes trans evaluates into ref which doesnt work for Sized
|
||||||
|
// constructor. This Move forces type.
|
||||||
|
#define MOVE_CONSTRUCTOR_FORCED(x, y) \
|
||||||
|
x::x(x &&other) : Sized(value_as<y>(std::move(other))) {}
|
||||||
|
|
||||||
|
#define COPY_OPERATOR(x) \
|
||||||
|
x &x::operator=(const x &other) \
|
||||||
|
{ \
|
||||||
|
HALF_CALL(operator=(trans(other))); \
|
||||||
|
return *this; \
|
||||||
|
}
|
||||||
|
#define MOVE_OPERATOR(x) \
|
||||||
|
x &x::operator=(x &&other) \
|
||||||
|
{ \
|
||||||
|
HALF_CALL(operator=(trans(std::move(other)))); \
|
||||||
|
return *this; \
|
||||||
|
}
|
||||||
|
|
||||||
#define VALID_CONSTRUCTION(x, y) \
|
#define VALID_CONSTRUCTION(x, y) \
|
||||||
template <> \
|
template <> \
|
||||||
@ -152,7 +178,8 @@ TRANSFORM_REF(VertexPropertyKey,
|
|||||||
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
||||||
TRANSFORM_REF(EdgePropertyKey,
|
TRANSFORM_REF(EdgePropertyKey,
|
||||||
::EdgePropertyFamily::PropertyType::PropertyFamilyKey);
|
::EdgePropertyFamily::PropertyType::PropertyFamilyKey);
|
||||||
TRANSFORM_REF(VertexIterator, IteratorBase<const ::VertexAccessor> *);
|
TRANSFORM_REF(VertexIterator,
|
||||||
|
std::unique_ptr<IteratorBase<const ::VertexAccessor>>);
|
||||||
TRANSFORM_REF(EdgeIterator,
|
TRANSFORM_REF(EdgeIterator,
|
||||||
std::unique_ptr<IteratorBase<const ::EdgeAccessor>>);
|
std::unique_ptr<IteratorBase<const ::EdgeAccessor>>);
|
||||||
TRANSFORM_REF(VertexAccessIterator, vertex_access_iterator_t);
|
TRANSFORM_REF(VertexAccessIterator, vertex_access_iterator_t);
|
||||||
@ -185,9 +212,19 @@ TRANSFORM_VALUE(EdgePropertyKey,
|
|||||||
TRANSFORM_VALUE(VertexPropertyKey,
|
TRANSFORM_VALUE(VertexPropertyKey,
|
||||||
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
||||||
TRANSFORM_VALUE_ONE(VertexAccessIterator, vertex_access_iterator_t);
|
TRANSFORM_VALUE_ONE(VertexAccessIterator, vertex_access_iterator_t);
|
||||||
|
MOVE_CONSTRUCTOR_FORCED(VertexAccessIterator, vertex_access_iterator_t);
|
||||||
TRANSFORM_VALUE_ONE(OutEdgesIterator, out_edge_iterator_t);
|
TRANSFORM_VALUE_ONE(OutEdgesIterator, out_edge_iterator_t);
|
||||||
|
MOVE_CONSTRUCTOR_FORCED(OutEdgesIterator, out_edge_iterator_t);
|
||||||
TRANSFORM_VALUE_ONE(InEdgesIterator, in_edge_iterator_t);
|
TRANSFORM_VALUE_ONE(InEdgesIterator, in_edge_iterator_t);
|
||||||
TRANSFORM_VALUE_ONE(VertexIterator, IteratorBase<const ::VertexAccessor> *);
|
MOVE_CONSTRUCTOR_FORCED(InEdgesIterator, in_edge_iterator_t);
|
||||||
|
TRANSFORM_VALUE_ONE(VertexIterator,
|
||||||
|
std::unique_ptr<IteratorBase<const ::VertexAccessor>>);
|
||||||
|
MOVE_CONSTRUCTOR_FORCED(VertexIterator,
|
||||||
|
std::unique_ptr<IteratorBase<const ::VertexAccessor>>);
|
||||||
|
TRANSFORM_VALUE_ONE(EdgeIterator,
|
||||||
|
std::unique_ptr<IteratorBase<const ::EdgeAccessor>>);
|
||||||
|
MOVE_CONSTRUCTOR_FORCED(EdgeIterator,
|
||||||
|
std::unique_ptr<IteratorBase<const ::EdgeAccessor>>);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
TRANSFORM_VALUE_ONE_RAW(
|
TRANSFORM_VALUE_ONE_RAW(
|
||||||
@ -247,12 +284,7 @@ INSTANTIATE_FOR_PROPERTY(FOR_ALL_PROPS_delete_EdgePropertyType)
|
|||||||
INSTANTIATE_FOR_PROPERTY(FOR_ALL_PROPS_delete_VertexPropertyType)
|
INSTANTIATE_FOR_PROPERTY(FOR_ALL_PROPS_delete_VertexPropertyType)
|
||||||
|
|
||||||
// ***************** Label
|
// ***************** Label
|
||||||
VertexIndex<std::nullptr_t> &Label::index() const
|
VertexIndex<std::nullptr_t> &Label::index() const { return CALL(index()); }
|
||||||
{
|
|
||||||
auto &index = HALF_CALL(index());
|
|
||||||
IndexBase<TypeGroupVertex, std::nullptr_t> &ib = index;
|
|
||||||
return trans(ib);
|
|
||||||
}
|
|
||||||
|
|
||||||
// **************** EdgeType
|
// **************** EdgeType
|
||||||
EdgeIndex<std::nullptr_t> &EdgeType::index() const { return CALL(index()); }
|
EdgeIndex<std::nullptr_t> &EdgeType::index() const { return CALL(index()); }
|
||||||
@ -262,8 +294,7 @@ template <class K>
|
|||||||
VertexIterator VertexIndex<K>::for_range(DbAccessor &t, Border<K> from,
|
VertexIterator VertexIndex<K>::for_range(DbAccessor &t, Border<K> from,
|
||||||
Border<K> to)
|
Border<K> to)
|
||||||
{
|
{
|
||||||
// auto ret = THIS->for_range(trans(t), std::move(from), std::move(to));
|
return CALL(for_range(trans(t), std::move(from), std::move(to)));
|
||||||
return CALL(for_range(trans(t), std::move(from), std::move(to)).release());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
@ -299,8 +330,7 @@ Order EdgeIndex<K>::order()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ************************* DbAccessor
|
// ************************* DbAccessor
|
||||||
|
DESTRUCTOR(DbAccessor, DbAccessor);
|
||||||
DbAccessor::~DbAccessor() { THIS->~DbAccessor(); }
|
|
||||||
|
|
||||||
VertexAccessIterator DbAccessor::vertex_access()
|
VertexAccessIterator DbAccessor::vertex_access()
|
||||||
{
|
{
|
||||||
@ -393,29 +423,12 @@ bool DbAccessor::commit() { return HALF_CALL(commit()); }
|
|||||||
void DbAccessor::abort() { HALF_CALL(abort()); }
|
void DbAccessor::abort() { HALF_CALL(abort()); }
|
||||||
|
|
||||||
// ************************** VertexAccessor
|
// ************************** VertexAccessor
|
||||||
VertexAccessor::VertexAccessor(const VertexAccessor &other)
|
DUP(VertexAccessor, COPY_CONSTRUCTOR);
|
||||||
: Sized(::VertexAccessor(trans(other)))
|
MOVE_CONSTRUCTOR(VertexAccessor);
|
||||||
{
|
MOVE_CONST_CONSTRUCTOR(VertexAccessor);
|
||||||
}
|
DESTRUCTOR(VertexAccessor, VertexAccessor);
|
||||||
VertexAccessor::VertexAccessor(VertexAccessor &&other) : Sized(std::move(other))
|
COPY_OPERATOR(VertexAccessor);
|
||||||
{
|
MOVE_OPERATOR(VertexAccessor);
|
||||||
}
|
|
||||||
VertexAccessor::VertexAccessor(VertexAccessor const &&other)
|
|
||||||
: Sized(std::move(other))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
VertexAccessor::~VertexAccessor() { HALF_CALL(~VertexAccessor()); }
|
|
||||||
|
|
||||||
VertexAccessor &VertexAccessor::operator=(const VertexAccessor &other)
|
|
||||||
{
|
|
||||||
HALF_CALL(operator=(trans(other)));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
VertexAccessor &VertexAccessor::operator=(VertexAccessor &&other)
|
|
||||||
{
|
|
||||||
HALF_CALL(operator=(trans(std::move(other))));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t VertexAccessor::out_degree() const { return HALF_CALL(out_degree()); }
|
size_t VertexAccessor::out_degree() const { return HALF_CALL(out_degree()); }
|
||||||
|
|
||||||
@ -523,26 +536,12 @@ bool operator!=(const VertexAccessor &a, const VertexAccessor &b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ************************** EdgeAccessor
|
// ************************** EdgeAccessor
|
||||||
EdgeAccessor::EdgeAccessor(const EdgeAccessor &other)
|
DUP(EdgeAccessor, COPY_CONSTRUCTOR);
|
||||||
: Sized(::EdgeAccessor(trans(other)))
|
MOVE_CONSTRUCTOR(EdgeAccessor);
|
||||||
{
|
MOVE_CONST_CONSTRUCTOR(EdgeAccessor);
|
||||||
}
|
DESTRUCTOR(EdgeAccessor, EdgeAccessor);
|
||||||
EdgeAccessor::EdgeAccessor(EdgeAccessor &&other) : Sized(std::move(other)) {}
|
COPY_OPERATOR(EdgeAccessor);
|
||||||
EdgeAccessor::EdgeAccessor(EdgeAccessor const &&other) : Sized(std::move(other))
|
MOVE_OPERATOR(EdgeAccessor);
|
||||||
{
|
|
||||||
}
|
|
||||||
EdgeAccessor::~EdgeAccessor() { HALF_CALL(~EdgeAccessor()); }
|
|
||||||
|
|
||||||
EdgeAccessor &EdgeAccessor::operator=(const EdgeAccessor &other)
|
|
||||||
{
|
|
||||||
HALF_CALL(operator=(trans(other)));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
EdgeAccessor &EdgeAccessor::operator=(EdgeAccessor &&other)
|
|
||||||
{
|
|
||||||
HALF_CALL(operator=(trans(std::move(other))));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EdgeAccessor::edge_type(const EdgeType &edge_type)
|
void EdgeAccessor::edge_type(const EdgeType &edge_type)
|
||||||
{
|
{
|
||||||
@ -623,25 +622,15 @@ bool operator!=(const EdgeAccessor &a, const EdgeAccessor &b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ************************* VertexIterator
|
// ************************* VertexIterator
|
||||||
VertexIterator::VertexIterator(VertexIterator &&other) : Sized(std::move(other))
|
DESTRUCTOR(VertexIterator, unique_ptr);
|
||||||
{
|
|
||||||
trans(other) = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexIterator::~VertexIterator()
|
|
||||||
{
|
|
||||||
if (*THIS != nullptr) delete (*THIS);
|
|
||||||
}
|
|
||||||
|
|
||||||
Option<const VertexAccessor> VertexIterator::next()
|
Option<const VertexAccessor> VertexIterator::next()
|
||||||
{
|
{
|
||||||
return ((*THIS)->next()).map<const VertexAccessor>();
|
return HALF_CALL(get()->next()).map<const VertexAccessor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************* EdgeIterator
|
// ************************* EdgeIterator
|
||||||
EdgeIterator::EdgeIterator(EdgeIterator &&other) : Sized(std::move(other)) {}
|
DESTRUCTOR(EdgeIterator, unique_ptr);
|
||||||
|
|
||||||
EdgeIterator::~EdgeIterator() { HALF_CALL(~unique_ptr()); }
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> EdgeIterator::next()
|
Option<const EdgeAccessor> EdgeIterator::next()
|
||||||
{
|
{
|
||||||
@ -649,12 +638,7 @@ Option<const EdgeAccessor> EdgeIterator::next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ************************* OutEdgesIterator
|
// ************************* OutEdgesIterator
|
||||||
OutEdgesIterator::OutEdgesIterator(OutEdgesIterator &&other)
|
DESTRUCTOR(OutEdgesIterator, out_edge_iterator_t);
|
||||||
: Sized(std::move(other))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
OutEdgesIterator::~OutEdgesIterator() { HALF_CALL(~out_edge_iterator_t()); }
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> OutEdgesIterator::next()
|
Option<const EdgeAccessor> OutEdgesIterator::next()
|
||||||
{
|
{
|
||||||
@ -662,12 +646,7 @@ Option<const EdgeAccessor> OutEdgesIterator::next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ************************* InEdgesIterator
|
// ************************* InEdgesIterator
|
||||||
InEdgesIterator::InEdgesIterator(InEdgesIterator &&other)
|
DESTRUCTOR(InEdgesIterator, in_edge_iterator_t);
|
||||||
: Sized(std::move(other))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
InEdgesIterator::~InEdgesIterator() { HALF_CALL(~in_edge_iterator_t()); }
|
|
||||||
|
|
||||||
Option<const EdgeAccessor> InEdgesIterator::next()
|
Option<const EdgeAccessor> InEdgesIterator::next()
|
||||||
{
|
{
|
||||||
@ -675,15 +654,7 @@ Option<const EdgeAccessor> InEdgesIterator::next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ************************* VertexAccessIterator
|
// ************************* VertexAccessIterator
|
||||||
VertexAccessIterator::VertexAccessIterator(VertexAccessIterator &&other)
|
DESTRUCTOR(VertexAccessIterator, vertex_access_iterator_t);
|
||||||
: Sized(std::move(other))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexAccessIterator::~VertexAccessIterator()
|
|
||||||
{
|
|
||||||
HALF_CALL(~vertex_access_iterator_t());
|
|
||||||
}
|
|
||||||
|
|
||||||
Option<const VertexAccessor> VertexAccessIterator::next()
|
Option<const VertexAccessor> VertexAccessIterator::next()
|
||||||
{
|
{
|
||||||
@ -691,10 +662,10 @@ Option<const VertexAccessor> VertexAccessIterator::next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ************************* VertexPropertyKey
|
// ************************* VertexPropertyKey
|
||||||
VertexPropertyKey::~VertexPropertyKey() { HALF_CALL(~PropertyFamilyKey()); }
|
DESTRUCTOR(VertexPropertyKey, PropertyFamilyKey);
|
||||||
|
|
||||||
// ************************* EdgePropertyKey
|
// ************************* EdgePropertyKey
|
||||||
EdgePropertyKey::~EdgePropertyKey() { HALF_CALL(~PropertyFamilyKey()); }
|
DESTRUCTOR(EdgePropertyKey, PropertyFamilyKey);
|
||||||
|
|
||||||
// ************************* VertexPropertyFamily
|
// ************************* VertexPropertyFamily
|
||||||
OptionPtr<VertexIndex<std::nullptr_t>> VertexPropertyFamily::index()
|
OptionPtr<VertexIndex<std::nullptr_t>> VertexPropertyFamily::index()
|
||||||
|
Loading…
Reference in New Issue
Block a user