Make (Edge|Vertex)Accessor methods const as appropriate

Reviewers: mtomic, mferencevic

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2232
This commit is contained in:
Teon Banek 2019-07-23 13:03:22 +02:00
parent 867f30d9b3
commit adc4ebacff
4 changed files with 20 additions and 20 deletions

View File

@ -7,11 +7,11 @@
namespace storage {
VertexAccessor EdgeAccessor::FromVertex() {
VertexAccessor EdgeAccessor::FromVertex() const {
return VertexAccessor{from_vertex_, transaction_};
}
VertexAccessor EdgeAccessor::ToVertex() {
VertexAccessor EdgeAccessor::ToVertex() const {
return VertexAccessor{to_vertex_, transaction_};
}
@ -48,7 +48,7 @@ Result<bool> EdgeAccessor::SetProperty(PropertyId property,
}
Result<PropertyValue> EdgeAccessor::GetProperty(PropertyId property,
View view) {
View view) const {
bool deleted = false;
PropertyValue value;
Delta *delta = nullptr;
@ -92,7 +92,7 @@ Result<PropertyValue> EdgeAccessor::GetProperty(PropertyId property,
}
Result<std::map<PropertyId, PropertyValue>> EdgeAccessor::Properties(
View view) {
View view) const {
std::map<PropertyId, PropertyValue> properties;
bool deleted = false;
Delta *delta = nullptr;

View File

@ -27,17 +27,17 @@ class EdgeAccessor final {
to_vertex_(to_vertex),
transaction_(transaction) {}
VertexAccessor FromVertex();
VertexAccessor FromVertex() const;
VertexAccessor ToVertex();
VertexAccessor ToVertex() const;
EdgeTypeId EdgeType() const { return edge_type_; }
Result<bool> SetProperty(PropertyId property, const PropertyValue &value);
Result<PropertyValue> GetProperty(PropertyId property, View view);
Result<PropertyValue> GetProperty(PropertyId property, View view) const;
Result<std::map<PropertyId, PropertyValue>> Properties(View view);
Result<std::map<PropertyId, PropertyValue>> Properties(View view) const;
Gid Gid() const { return edge_->gid; }

View File

@ -78,7 +78,7 @@ Result<bool> VertexAccessor::RemoveLabel(LabelId label) {
return Result<bool>{true};
}
Result<bool> VertexAccessor::HasLabel(LabelId label, View view) {
Result<bool> VertexAccessor::HasLabel(LabelId label, View view) const {
bool deleted = false;
bool has_label = false;
Delta *delta = nullptr;
@ -126,7 +126,7 @@ Result<bool> VertexAccessor::HasLabel(LabelId label, View view) {
return Result<bool>{has_label};
}
Result<std::vector<LabelId>> VertexAccessor::Labels(View view) {
Result<std::vector<LabelId>> VertexAccessor::Labels(View view) const {
bool deleted = false;
std::vector<LabelId> labels;
Delta *delta = nullptr;
@ -207,7 +207,7 @@ Result<bool> VertexAccessor::SetProperty(PropertyId property,
}
Result<PropertyValue> VertexAccessor::GetProperty(PropertyId property,
View view) {
View view) const {
bool deleted = false;
PropertyValue value;
Delta *delta = nullptr;
@ -251,7 +251,7 @@ Result<PropertyValue> VertexAccessor::GetProperty(PropertyId property,
}
Result<std::map<PropertyId, PropertyValue>> VertexAccessor::Properties(
View view) {
View view) const {
std::map<PropertyId, PropertyValue> properties;
bool deleted = false;
Delta *delta = nullptr;
@ -303,7 +303,7 @@ Result<std::map<PropertyId, PropertyValue>> VertexAccessor::Properties(
}
Result<std::vector<EdgeAccessor>> VertexAccessor::InEdges(
const std::vector<EdgeTypeId> &edge_types, View view) {
const std::vector<EdgeTypeId> &edge_types, View view) const {
std::vector<std::tuple<EdgeTypeId, Vertex *, Edge *>> in_edges;
bool deleted = false;
Delta *delta = nullptr;
@ -369,7 +369,7 @@ Result<std::vector<EdgeAccessor>> VertexAccessor::InEdges(
}
Result<std::vector<EdgeAccessor>> VertexAccessor::OutEdges(
const std::vector<EdgeTypeId> &edge_types, View view) {
const std::vector<EdgeTypeId> &edge_types, View view) const {
std::vector<std::tuple<EdgeTypeId, Vertex *, Edge *>> out_edges;
bool deleted = false;
Delta *delta = nullptr;

View File

@ -29,21 +29,21 @@ class VertexAccessor final {
Result<bool> RemoveLabel(LabelId label);
Result<bool> HasLabel(LabelId label, View view);
Result<bool> HasLabel(LabelId label, View view) const;
Result<std::vector<LabelId>> Labels(View view);
Result<std::vector<LabelId>> Labels(View view) const;
Result<bool> SetProperty(PropertyId property, const PropertyValue &value);
Result<PropertyValue> GetProperty(PropertyId property, View view);
Result<PropertyValue> GetProperty(PropertyId property, View view) const;
Result<std::map<PropertyId, PropertyValue>> Properties(View view);
Result<std::map<PropertyId, PropertyValue>> Properties(View view) const;
Result<std::vector<EdgeAccessor>> InEdges(
const std::vector<EdgeTypeId> &edge_types, View view);
const std::vector<EdgeTypeId> &edge_types, View view) const;
Result<std::vector<EdgeAccessor>> OutEdges(
const std::vector<EdgeTypeId> &edge_types, View view);
const std::vector<EdgeTypeId> &edge_types, View view) const;
Gid Gid() const { return vertex_->gid; }