memgraph/include/storage/edge_accessor.hpp

56 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include "storage/edge.hpp"
2016-08-11 22:32:58 +08:00
#include "storage/edge_record.hpp"
#include "storage/record_accessor.hpp"
2016-08-29 21:51:31 +08:00
#include "storage/vertex_accessor.hpp"
2016-07-07 00:37:05 +08:00
#include "utils/assert.hpp"
#include "utils/reference_wrapper.hpp"
class EdgeType;
using edge_type_ref_t = ReferenceWrapper<const EdgeType>;
class Edges;
// There exists circular dependecy with VertexAccessor.
class EdgeAccessor : public RecordAccessor<TypeGroupEdge, EdgeAccessor>
{
2016-08-30 15:53:02 +08:00
friend VertexAccessor;
public:
using RecordAccessor::RecordAccessor;
using record_t = Edge;
using record_list_t = EdgeRecord;
2016-03-13 03:16:19 +08:00
// Removes self and disconects vertices from it.
2016-08-30 15:53:02 +08:00
void remove() const;
2016-08-28 22:47:13 +08:00
void edge_type(EdgeType const &edge_type);
2016-03-13 03:16:19 +08:00
2016-08-28 22:47:13 +08:00
const EdgeType &edge_type() const;
2016-03-20 15:56:13 +08:00
2016-08-30 15:53:02 +08:00
// EdgeAccessor doesnt need to be filled
2016-08-29 21:51:31 +08:00
VertexAccessor from() const;
2016-08-30 15:53:02 +08:00
// EdgeAccessor doesnt need to be filled
2016-08-29 21:51:31 +08:00
VertexAccessor to() const;
template <typename Stream>
void stream_repr(Stream& stream) const
{
auto from_va = from();
auto to_va = to();
from_va.fill();
to_va.fill();
from_va.stream_repr(stream);
stream << '-';
this->record->stream_repr(stream);
stream << "->";
to_va.stream_repr(stream);
stream << '\n';
}
};