2016-08-15 07:09:58 +08:00
|
|
|
#include "storage/edge_accessor.hpp"
|
|
|
|
|
2016-09-09 23:14:20 +08:00
|
|
|
#include <cassert>
|
|
|
|
|
2016-12-20 01:32:44 +08:00
|
|
|
#include "utils/assert.hpp"
|
2016-08-30 13:16:04 +08:00
|
|
|
#include "storage/vertex_record.hpp"
|
2016-11-29 11:08:08 +08:00
|
|
|
#include "storage/edge_type/edge_type.hpp"
|
2016-08-30 13:16:04 +08:00
|
|
|
|
2016-08-30 15:53:02 +08:00
|
|
|
void EdgeAccessor::remove() const
|
2016-08-30 13:16:04 +08:00
|
|
|
{
|
2016-08-30 15:53:02 +08:00
|
|
|
RecordAccessor::remove();
|
2016-09-19 06:22:36 +08:00
|
|
|
|
2016-11-29 11:08:08 +08:00
|
|
|
auto from_va = from();
|
2016-12-20 01:32:44 +08:00
|
|
|
auto from_va_is_full = from_va.fill();
|
|
|
|
runtime_assert(from_va_is_full, "From Vertex Accessor is empty");
|
2016-08-30 15:53:02 +08:00
|
|
|
|
2016-11-29 11:08:08 +08:00
|
|
|
auto to_va = to();
|
2016-12-20 01:32:44 +08:00
|
|
|
auto to_va_is_full = to_va.fill();
|
|
|
|
permanent_assert(to_va_is_full, "To Vertex Accessor is empty");
|
2016-08-30 15:53:02 +08:00
|
|
|
|
2016-11-29 11:08:08 +08:00
|
|
|
from_va.update().record->data.out.remove(vlist);
|
|
|
|
to_va.update().record->data.in.remove(vlist);
|
2016-08-30 13:16:04 +08:00
|
|
|
}
|
|
|
|
|
2016-08-28 22:47:13 +08:00
|
|
|
void EdgeAccessor::edge_type(const EdgeType &edge_type)
|
2016-08-15 07:09:58 +08:00
|
|
|
{
|
2016-08-28 22:47:13 +08:00
|
|
|
this->record->data.edge_type = &edge_type;
|
2016-08-15 07:09:58 +08:00
|
|
|
}
|
|
|
|
|
2016-08-28 22:47:13 +08:00
|
|
|
const EdgeType &EdgeAccessor::edge_type() const
|
2016-08-15 07:09:58 +08:00
|
|
|
{
|
2016-09-09 23:14:20 +08:00
|
|
|
assert(this->record->data.edge_type != nullptr);
|
2016-08-15 07:09:58 +08:00
|
|
|
runtime_assert(this->record->data.edge_type != nullptr, "EdgeType is null");
|
2016-08-28 22:47:13 +08:00
|
|
|
return *this->record->data.edge_type;
|
2016-08-15 07:09:58 +08:00
|
|
|
}
|
2016-08-29 21:51:31 +08:00
|
|
|
|
|
|
|
VertexAccessor EdgeAccessor::from() const
|
|
|
|
{
|
|
|
|
return VertexAccessor(this->vlist->from(), this->db);
|
|
|
|
}
|
|
|
|
|
|
|
|
VertexAccessor EdgeAccessor::to() const
|
|
|
|
{
|
|
|
|
return VertexAccessor(this->vlist->to(), this->db);
|
|
|
|
}
|