Make GraphDbTypes const

Reviewers: florijan

Reviewed By: florijan

Differential Revision: https://phabricator.memgraph.io/D456
This commit is contained in:
Mislav Bradac 2017-06-12 15:19:04 +02:00
parent 28173eaa3e
commit d46945f259
3 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,5 @@
#include "database/graph_db_accessor.hpp"
#include "database/creation_exception.hpp" #include "database/creation_exception.hpp"
#include "database/graph_db_accessor.hpp"
#include "storage/edge.hpp" #include "storage/edge.hpp"
#include "storage/edge_accessor.hpp" #include "storage/edge_accessor.hpp"
@ -169,7 +169,7 @@ GraphDbTypes::Label GraphDbAccessor::label(const std::string &label_name) {
return &(*db_.labels_.access().insert(label_name).first); return &(*db_.labels_.access().insert(label_name).first);
} }
std::string &GraphDbAccessor::label_name( const std::string &GraphDbAccessor::label_name(
const GraphDbTypes::Label label) const { const GraphDbTypes::Label label) const {
return *label; return *label;
} }
@ -179,7 +179,7 @@ GraphDbTypes::EdgeType GraphDbAccessor::edge_type(
return &(*db_.edge_types_.access().insert(edge_type_name).first); return &(*db_.edge_types_.access().insert(edge_type_name).first);
} }
std::string &GraphDbAccessor::edge_type_name( const std::string &GraphDbAccessor::edge_type_name(
const GraphDbTypes::EdgeType edge_type) const { const GraphDbTypes::EdgeType edge_type) const {
return *edge_type; return *edge_type;
} }
@ -189,7 +189,7 @@ GraphDbTypes::Property GraphDbAccessor::property(
return &(*db_.properties_.access().insert(property_name).first); return &(*db_.properties_.access().insert(property_name).first);
} }
std::string &GraphDbAccessor::property_name( const std::string &GraphDbAccessor::property_name(
const GraphDbTypes::Property property) const { const GraphDbTypes::Property property) const {
return *property; return *property;
} }

View File

@ -353,7 +353,7 @@ class GraphDbAccessor {
* @param label a Label. * @param label a Label.
* @return See above. * @return See above.
*/ */
std::string &label_name(const GraphDbTypes::Label label) const; const std::string &label_name(const GraphDbTypes::Label label) const;
/** /**
* Obtains the EdgeType for it's name. * Obtains the EdgeType for it's name.
@ -367,7 +367,8 @@ class GraphDbAccessor {
* @param edge_type an EdgeType. * @param edge_type an EdgeType.
* @return See above. * @return See above.
*/ */
std::string &edge_type_name(const GraphDbTypes::EdgeType edge_type) const; const std::string &edge_type_name(
const GraphDbTypes::EdgeType edge_type) const;
/** /**
* Obtains the Property for it's name. * Obtains the Property for it's name.
@ -381,7 +382,7 @@ class GraphDbAccessor {
* @param property a Property. * @param property a Property.
* @return See above. * @return See above.
*/ */
std::string &property_name(const GraphDbTypes::Property property) const; const std::string &property_name(const GraphDbTypes::Property property) const;
/** /**
* Advances transaction's command id by 1. * Advances transaction's command id by 1.

View File

@ -4,7 +4,8 @@
namespace GraphDbTypes { namespace GraphDbTypes {
// definitions for what data types are used for a Label, Property, EdgeType // definitions for what data types are used for a Label, Property, EdgeType
using Label = std::string *; // TODO: Typedefing pointers is terrible astractions, get rid of it.
using EdgeType = std::string *; using Label = const std::string *;
using Property = std::string *; using EdgeType = const std::string *;
using Property = const std::string *;
}; };