memgraph/include/storage/vertex.hpp

38 lines
949 B
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/model/properties/traversers/jsonwriter.hpp"
#include "storage/model/vertex_model.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
{
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;
2015-07-07 22:18:26 +08:00
};
inline std::ostream &operator<<(std::ostream &stream, const Vertex &record)
{
2015-10-14 02:32:54 +08:00
StringBuffer buffer;
JsonWriter<StringBuffer> writer(buffer);
// dump properties in this buffer
2016-09-13 19:14:16 +08:00
record.data.props.handle(writer);
2015-10-14 02:44:14 +08:00
writer.finish();
2015-12-06 23:37:42 +08:00
return stream << "Vertex"
2015-12-08 01:45:44 +08:00
<< "(cre = " << record.tx.cre()
<< ", exp = " << record.tx.exp() << "): " << buffer.str();
}