memgraph/include/storage/vertex.hpp
2016-09-13 12:14:16 +01:00

38 lines
949 B
C++

#pragma once
#include "mvcc/record.hpp"
#include "storage/model/properties/traversers/jsonwriter.hpp"
#include "storage/model/vertex_model.hpp"
class Vertex : public mvcc::Record<Vertex>
{
public:
class Accessor;
Vertex() = default;
Vertex(const VertexModel &data) : data(data) {}
Vertex(VertexModel &&data) : data(std::move(data)) {}
Vertex(const Vertex &) = delete;
Vertex(Vertex &&) = delete;
Vertex &operator=(const Vertex &) = delete;
Vertex &operator=(Vertex &&) = delete;
VertexModel data;
};
inline std::ostream &operator<<(std::ostream &stream, const Vertex &record)
{
StringBuffer buffer;
JsonWriter<StringBuffer> writer(buffer);
// dump properties in this buffer
record.data.props.handle(writer);
writer.finish();
return stream << "Vertex"
<< "(cre = " << record.tx.cre()
<< ", exp = " << record.tx.exp() << "): " << buffer.str();
}