memgraph/include/storage/vertex.hpp

43 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
2015-07-07 22:18:26 +08:00
2015-12-06 23:37:42 +08:00
#include "mvcc/record.hpp"
#include "storage/label/labels_writer.hpp"
#include "storage/model/properties/json_writer.hpp"
#include "storage/model/vertex_model.hpp"
#include "utils/handle_write.hpp"
#include "utils/string_buffer.hpp"
2015-07-07 22:18:26 +08:00
2015-12-06 23:37:42 +08:00
class Vertex : public mvcc::Record<Vertex>
2015-07-07 22:18:26 +08:00
{
using buffer_t = utils::StringBuffer;
using props_writer_t = JsonWriter<buffer_t>;
using labels_writer_t = LabelsWriter<buffer_t>;
2015-12-06 23:37:42 +08:00
public:
2016-01-02 19:20:51 +08:00
class Accessor;
2015-12-06 23:37:42 +08:00
Vertex() = default;
Vertex(const VertexModel &data) : data(data) {}
Vertex(VertexModel &&data) : data(std::move(data)) {}
2015-12-06 23:37:42 +08:00
Vertex(const Vertex &) = delete;
Vertex(Vertex &&) = delete;
2015-12-06 23:37:42 +08:00
Vertex &operator=(const Vertex &) = delete;
Vertex &operator=(Vertex &&) = delete;
2015-12-06 23:37:42 +08:00
VertexModel data;
template <typename Stream>
void stream_repr(Stream &stream) const
{
auto props = handle_write<buffer_t, props_writer_t>(data.props);
auto labels = handle_write<buffer_t, labels_writer_t>(data.labels);
stream << "Vertex(cre = " << tx.cre() << ", "
<< "exp = " << tx.exp() << ", "
<< "props = " << props.str() << ", "
<< "labels = " << labels.str() << ")";
}
};