commit before changing profile.cpp
This commit is contained in:
parent
cdfa0e7106
commit
fc71e9930b
@ -14,6 +14,8 @@ namespace barrier
|
||||
// barrier class defined here.
|
||||
|
||||
// ************ Here should be forward declarations of Sized barrier classes
|
||||
class DbAccessor; // DONE // .cpp
|
||||
|
||||
class VertexAccessor; // DONE // .cpp
|
||||
class EdgeAccessor; // DONE // .cpp
|
||||
|
||||
@ -40,8 +42,7 @@ class BoltSerializer; // DONE // .cpp
|
||||
class Label; // DONE // .cpp
|
||||
class EdgeType; // DONE // .cpp
|
||||
|
||||
class Db;
|
||||
class DbAccessor; // DONE // .cpp
|
||||
class Db; // DONE // .cpp
|
||||
|
||||
class VertexPropertyFamily; // DONE // .cpp
|
||||
class EdgePropertyFamily; // DONE // .cpp
|
||||
|
@ -102,11 +102,8 @@ protected:
|
||||
// with T which it holds where T is original class from memgraph.
|
||||
template <class T>
|
||||
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(alignment_B == alignof(T),
|
||||
"Border class aligment mismatch");
|
||||
@ -117,11 +114,8 @@ protected:
|
||||
// with T which it holds where T is original class from memgraph.
|
||||
template <class T>
|
||||
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(alignment_B == alignof(T),
|
||||
"Border class aligment mismatch");
|
||||
|
@ -3,17 +3,6 @@
|
||||
#include <iostream>
|
||||
#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"
|
||||
|
||||
using namespace std;
|
||||
|
@ -39,10 +39,7 @@ sha::Accessor &sha::Accessor::operator=(sha::Accessor &&other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
int sha::Accessor::get_prop(sha::Name &name)
|
||||
{
|
||||
return as<::Accessor>().data;
|
||||
}
|
||||
int sha::Accessor::get_prop(sha::Name &name) { return as<::Accessor>().data; }
|
||||
|
||||
sha::Accessor sha::Db::access()
|
||||
{
|
||||
|
@ -69,6 +69,32 @@
|
||||
{ \
|
||||
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) \
|
||||
template <> \
|
||||
@ -152,7 +178,8 @@ TRANSFORM_REF(VertexPropertyKey,
|
||||
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
||||
TRANSFORM_REF(EdgePropertyKey,
|
||||
::EdgePropertyFamily::PropertyType::PropertyFamilyKey);
|
||||
TRANSFORM_REF(VertexIterator, IteratorBase<const ::VertexAccessor> *);
|
||||
TRANSFORM_REF(VertexIterator,
|
||||
std::unique_ptr<IteratorBase<const ::VertexAccessor>>);
|
||||
TRANSFORM_REF(EdgeIterator,
|
||||
std::unique_ptr<IteratorBase<const ::EdgeAccessor>>);
|
||||
TRANSFORM_REF(VertexAccessIterator, vertex_access_iterator_t);
|
||||
@ -185,9 +212,19 @@ TRANSFORM_VALUE(EdgePropertyKey,
|
||||
TRANSFORM_VALUE(VertexPropertyKey,
|
||||
::VertexPropertyFamily::PropertyType::PropertyFamilyKey);
|
||||
TRANSFORM_VALUE_ONE(VertexAccessIterator, vertex_access_iterator_t);
|
||||
MOVE_CONSTRUCTOR_FORCED(VertexAccessIterator, vertex_access_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(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>
|
||||
TRANSFORM_VALUE_ONE_RAW(
|
||||
@ -247,12 +284,7 @@ INSTANTIATE_FOR_PROPERTY(FOR_ALL_PROPS_delete_EdgePropertyType)
|
||||
INSTANTIATE_FOR_PROPERTY(FOR_ALL_PROPS_delete_VertexPropertyType)
|
||||
|
||||
// ***************** Label
|
||||
VertexIndex<std::nullptr_t> &Label::index() const
|
||||
{
|
||||
auto &index = HALF_CALL(index());
|
||||
IndexBase<TypeGroupVertex, std::nullptr_t> &ib = index;
|
||||
return trans(ib);
|
||||
}
|
||||
VertexIndex<std::nullptr_t> &Label::index() const { return CALL(index()); }
|
||||
|
||||
// **************** EdgeType
|
||||
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,
|
||||
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)).release());
|
||||
return CALL(for_range(trans(t), std::move(from), std::move(to)));
|
||||
}
|
||||
|
||||
template <class K>
|
||||
@ -299,8 +330,7 @@ Order EdgeIndex<K>::order()
|
||||
}
|
||||
|
||||
// ************************* DbAccessor
|
||||
|
||||
DbAccessor::~DbAccessor() { THIS->~DbAccessor(); }
|
||||
DESTRUCTOR(DbAccessor, DbAccessor);
|
||||
|
||||
VertexAccessIterator DbAccessor::vertex_access()
|
||||
{
|
||||
@ -393,29 +423,12 @@ bool DbAccessor::commit() { return HALF_CALL(commit()); }
|
||||
void DbAccessor::abort() { HALF_CALL(abort()); }
|
||||
|
||||
// ************************** VertexAccessor
|
||||
VertexAccessor::VertexAccessor(const VertexAccessor &other)
|
||||
: Sized(::VertexAccessor(trans(other)))
|
||||
{
|
||||
}
|
||||
VertexAccessor::VertexAccessor(VertexAccessor &&other) : Sized(std::move(other))
|
||||
{
|
||||
}
|
||||
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;
|
||||
}
|
||||
DUP(VertexAccessor, COPY_CONSTRUCTOR);
|
||||
MOVE_CONSTRUCTOR(VertexAccessor);
|
||||
MOVE_CONST_CONSTRUCTOR(VertexAccessor);
|
||||
DESTRUCTOR(VertexAccessor, VertexAccessor);
|
||||
COPY_OPERATOR(VertexAccessor);
|
||||
MOVE_OPERATOR(VertexAccessor);
|
||||
|
||||
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(const EdgeAccessor &other)
|
||||
: Sized(::EdgeAccessor(trans(other)))
|
||||
{
|
||||
}
|
||||
EdgeAccessor::EdgeAccessor(EdgeAccessor &&other) : Sized(std::move(other)) {}
|
||||
EdgeAccessor::EdgeAccessor(EdgeAccessor const &&other) : Sized(std::move(other))
|
||||
{
|
||||
}
|
||||
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;
|
||||
}
|
||||
DUP(EdgeAccessor, COPY_CONSTRUCTOR);
|
||||
MOVE_CONSTRUCTOR(EdgeAccessor);
|
||||
MOVE_CONST_CONSTRUCTOR(EdgeAccessor);
|
||||
DESTRUCTOR(EdgeAccessor, EdgeAccessor);
|
||||
COPY_OPERATOR(EdgeAccessor);
|
||||
MOVE_OPERATOR(EdgeAccessor);
|
||||
|
||||
void EdgeAccessor::edge_type(const EdgeType &edge_type)
|
||||
{
|
||||
@ -623,25 +622,15 @@ bool operator!=(const EdgeAccessor &a, const EdgeAccessor &b)
|
||||
}
|
||||
|
||||
// ************************* VertexIterator
|
||||
VertexIterator::VertexIterator(VertexIterator &&other) : Sized(std::move(other))
|
||||
{
|
||||
trans(other) = nullptr;
|
||||
}
|
||||
|
||||
VertexIterator::~VertexIterator()
|
||||
{
|
||||
if (*THIS != nullptr) delete (*THIS);
|
||||
}
|
||||
DESTRUCTOR(VertexIterator, unique_ptr);
|
||||
|
||||
Option<const VertexAccessor> VertexIterator::next()
|
||||
{
|
||||
return ((*THIS)->next()).map<const VertexAccessor>();
|
||||
return HALF_CALL(get()->next()).map<const VertexAccessor>();
|
||||
}
|
||||
|
||||
// ************************* EdgeIterator
|
||||
EdgeIterator::EdgeIterator(EdgeIterator &&other) : Sized(std::move(other)) {}
|
||||
|
||||
EdgeIterator::~EdgeIterator() { HALF_CALL(~unique_ptr()); }
|
||||
DESTRUCTOR(EdgeIterator, unique_ptr);
|
||||
|
||||
Option<const EdgeAccessor> EdgeIterator::next()
|
||||
{
|
||||
@ -649,12 +638,7 @@ Option<const EdgeAccessor> EdgeIterator::next()
|
||||
}
|
||||
|
||||
// ************************* OutEdgesIterator
|
||||
OutEdgesIterator::OutEdgesIterator(OutEdgesIterator &&other)
|
||||
: Sized(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
OutEdgesIterator::~OutEdgesIterator() { HALF_CALL(~out_edge_iterator_t()); }
|
||||
DESTRUCTOR(OutEdgesIterator, out_edge_iterator_t);
|
||||
|
||||
Option<const EdgeAccessor> OutEdgesIterator::next()
|
||||
{
|
||||
@ -662,12 +646,7 @@ Option<const EdgeAccessor> OutEdgesIterator::next()
|
||||
}
|
||||
|
||||
// ************************* InEdgesIterator
|
||||
InEdgesIterator::InEdgesIterator(InEdgesIterator &&other)
|
||||
: Sized(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
InEdgesIterator::~InEdgesIterator() { HALF_CALL(~in_edge_iterator_t()); }
|
||||
DESTRUCTOR(InEdgesIterator, in_edge_iterator_t);
|
||||
|
||||
Option<const EdgeAccessor> InEdgesIterator::next()
|
||||
{
|
||||
@ -675,15 +654,7 @@ Option<const EdgeAccessor> InEdgesIterator::next()
|
||||
}
|
||||
|
||||
// ************************* VertexAccessIterator
|
||||
VertexAccessIterator::VertexAccessIterator(VertexAccessIterator &&other)
|
||||
: Sized(std::move(other))
|
||||
{
|
||||
}
|
||||
|
||||
VertexAccessIterator::~VertexAccessIterator()
|
||||
{
|
||||
HALF_CALL(~vertex_access_iterator_t());
|
||||
}
|
||||
DESTRUCTOR(VertexAccessIterator, vertex_access_iterator_t);
|
||||
|
||||
Option<const VertexAccessor> VertexAccessIterator::next()
|
||||
{
|
||||
@ -691,10 +662,10 @@ Option<const VertexAccessor> VertexAccessIterator::next()
|
||||
}
|
||||
|
||||
// ************************* VertexPropertyKey
|
||||
VertexPropertyKey::~VertexPropertyKey() { HALF_CALL(~PropertyFamilyKey()); }
|
||||
DESTRUCTOR(VertexPropertyKey, PropertyFamilyKey);
|
||||
|
||||
// ************************* EdgePropertyKey
|
||||
EdgePropertyKey::~EdgePropertyKey() { HALF_CALL(~PropertyFamilyKey()); }
|
||||
DESTRUCTOR(EdgePropertyKey, PropertyFamilyKey);
|
||||
|
||||
// ************************* VertexPropertyFamily
|
||||
OptionPtr<VertexIndex<std::nullptr_t>> VertexPropertyFamily::index()
|
||||
|
Loading…
Reference in New Issue
Block a user