Remove 'using namespace' from header files
Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1429
This commit is contained in:
parent
d3bdca5ca3
commit
4f28b4b6fe
@ -11,8 +11,6 @@
|
||||
|
||||
#include "glog/logging.h"
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
// Thread safe queue. Probably doesn't perform very well, but it works.
|
||||
template <typename T>
|
||||
class Queue {
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/flag_validation.hpp"
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
using namespace storage;
|
||||
|
||||
namespace database {
|
||||
|
@ -7,18 +7,18 @@
|
||||
|
||||
namespace durability {
|
||||
|
||||
using namespace communication::bolt;
|
||||
|
||||
template <typename Buffer>
|
||||
class SnapshotDecoder : public Decoder<Buffer> {
|
||||
class SnapshotDecoder : public communication::bolt::Decoder<Buffer> {
|
||||
public:
|
||||
explicit SnapshotDecoder(Buffer &buffer) : Decoder<Buffer>(buffer) {}
|
||||
explicit SnapshotDecoder(Buffer &buffer)
|
||||
: communication::bolt::Decoder<Buffer>(buffer) {}
|
||||
|
||||
std::experimental::optional<DecodedSnapshotVertex> ReadSnapshotVertex() {
|
||||
DecodedValue dv;
|
||||
communication::bolt::DecodedValue dv;
|
||||
DecodedSnapshotVertex vertex;
|
||||
|
||||
if (!Decoder<Buffer>::ReadValue(&dv, DecodedValue::Type::Vertex)) {
|
||||
if (!communication::bolt::Decoder<Buffer>::ReadValue(
|
||||
&dv, communication::bolt::DecodedValue::Type::Vertex)) {
|
||||
DLOG(WARNING) << "Unable to read snapshot vertex";
|
||||
return std::experimental::nullopt;
|
||||
}
|
||||
@ -28,7 +28,8 @@ class SnapshotDecoder : public Decoder<Buffer> {
|
||||
vertex.labels = read_vertex.labels;
|
||||
vertex.properties = read_vertex.properties;
|
||||
|
||||
if (!Decoder<Buffer>::ReadValue(&dv, DecodedValue::Type::Int)) {
|
||||
if (!communication::bolt::Decoder<Buffer>::ReadValue(
|
||||
&dv, communication::bolt::DecodedValue::Type::Int)) {
|
||||
DLOG(WARNING) << "[ReadSnapshotVertex] Couldn't read number of in "
|
||||
"edges in vertex!";
|
||||
return std::experimental::nullopt;
|
||||
@ -40,7 +41,8 @@ class SnapshotDecoder : public Decoder<Buffer> {
|
||||
vertex.in.emplace_back(*edge);
|
||||
}
|
||||
|
||||
if (!Decoder<Buffer>::ReadValue(&dv, DecodedValue::Type::Int)) {
|
||||
if (!communication::bolt::Decoder<Buffer>::ReadValue(
|
||||
&dv, communication::bolt::DecodedValue::Type::Int)) {
|
||||
DLOG(WARNING) << "[ReadSnapshotVertex] Couldn't read number of out "
|
||||
"edges in vertex!";
|
||||
return std::experimental::nullopt;
|
||||
@ -58,27 +60,30 @@ class SnapshotDecoder : public Decoder<Buffer> {
|
||||
|
||||
private:
|
||||
std::experimental::optional<DecodedInlinedVertexEdge> ReadSnapshotEdge() {
|
||||
DecodedValue dv;
|
||||
communication::bolt::DecodedValue dv;
|
||||
DecodedInlinedVertexEdge edge;
|
||||
|
||||
VLOG(20) << "[ReadSnapshotEdge] Start";
|
||||
|
||||
// read ID
|
||||
if (!Decoder<Buffer>::ReadValue(&dv, DecodedValue::Type::Int)) {
|
||||
if (!communication::bolt::Decoder<Buffer>::ReadValue(
|
||||
&dv, communication::bolt::DecodedValue::Type::Int)) {
|
||||
DLOG(WARNING) << "[ReadSnapshotEdge] Couldn't read ID!";
|
||||
return std::experimental::nullopt;
|
||||
}
|
||||
|
||||
edge.address = dv.ValueInt();
|
||||
// read other side
|
||||
if (!Decoder<Buffer>::ReadValue(&dv, DecodedValue::Type::Int)) {
|
||||
if (!communication::bolt::Decoder<Buffer>::ReadValue(
|
||||
&dv, communication::bolt::DecodedValue::Type::Int)) {
|
||||
DLOG(WARNING) << "[ReadSnapshotEdge] Couldn't read from address!";
|
||||
return std::experimental::nullopt;
|
||||
}
|
||||
edge.vertex = dv.ValueInt();
|
||||
|
||||
// read type
|
||||
if (!Decoder<Buffer>::ReadValue(&dv, DecodedValue::Type::String)) {
|
||||
if (!communication::bolt::Decoder<Buffer>::ReadValue(
|
||||
&dv, communication::bolt::DecodedValue::Type::String)) {
|
||||
DLOG(WARNING) << "[ReadSnapshotEdge] Couldn't read type!";
|
||||
return std::experimental::nullopt;
|
||||
}
|
||||
|
@ -4,14 +4,13 @@
|
||||
|
||||
namespace durability {
|
||||
|
||||
using namespace communication::bolt;
|
||||
|
||||
template <typename Buffer>
|
||||
class SnapshotEncoder : public BaseEncoder<Buffer> {
|
||||
class SnapshotEncoder : public communication::bolt::BaseEncoder<Buffer> {
|
||||
public:
|
||||
explicit SnapshotEncoder(Buffer &buffer) : BaseEncoder<Buffer>(buffer) {}
|
||||
explicit SnapshotEncoder(Buffer &buffer)
|
||||
: communication::bolt::BaseEncoder<Buffer>(buffer) {}
|
||||
void WriteSnapshotVertex(const VertexAccessor &vertex) {
|
||||
BaseEncoder<Buffer>::WriteVertex(vertex);
|
||||
communication::bolt::BaseEncoder<Buffer>::WriteVertex(vertex);
|
||||
|
||||
// write in edges without properties
|
||||
this->WriteUInt(vertex.in_degree());
|
||||
|
@ -11,9 +11,6 @@ namespace query {
|
||||
namespace frontend {
|
||||
namespace opencypher {
|
||||
|
||||
using namespace antlropencypher;
|
||||
using namespace antlr4;
|
||||
|
||||
/**
|
||||
* Generates openCypher AST
|
||||
* This thing must me a class since parser.cypher() returns pointer and there is
|
||||
@ -38,8 +35,9 @@ class Parser {
|
||||
|
||||
private:
|
||||
class FirstMessageErrorListener : public antlr4::BaseErrorListener {
|
||||
void syntaxError(IRecognizer *, Token *, size_t line, size_t position,
|
||||
const std::string &message, std::exception_ptr) override {
|
||||
void syntaxError(antlr4::IRecognizer *, antlr4::Token *, size_t line,
|
||||
size_t position, const std::string &message,
|
||||
std::exception_ptr) override {
|
||||
if (error_.empty()) {
|
||||
error_ = "line " + std::to_string(line) + ":" +
|
||||
std::to_string(position + 1) + " " + message;
|
||||
@ -52,13 +50,13 @@ class Parser {
|
||||
|
||||
FirstMessageErrorListener error_listener_;
|
||||
std::string query_;
|
||||
ANTLRInputStream input_{query_.c_str()};
|
||||
CypherLexer lexer_{&input_};
|
||||
CommonTokenStream tokens_{&lexer_};
|
||||
antlr4::ANTLRInputStream input_{query_.c_str()};
|
||||
antlropencypher::CypherLexer lexer_{&input_};
|
||||
antlr4::CommonTokenStream tokens_{&lexer_};
|
||||
|
||||
// generate ast
|
||||
CypherParser parser_{&tokens_};
|
||||
tree::ParseTree *tree_ = nullptr;
|
||||
antlropencypher::CypherParser parser_{&tokens_};
|
||||
antlr4::tree::ParseTree *tree_ = nullptr;
|
||||
};
|
||||
} // namespace opencypher
|
||||
} // namespace frontend
|
||||
|
@ -41,6 +41,7 @@ class DistributedGraphDbTest : public ::testing::Test {
|
||||
|
||||
void Initialize(
|
||||
std::function<database::Config(database::Config config)> modify_config) {
|
||||
using namespace std::literals::chrono_literals;
|
||||
const auto kInitTime = 200ms;
|
||||
|
||||
database::Config master_config;
|
||||
@ -158,6 +159,7 @@ enum class TestType { SINGLE_NODE, DISTRIBUTED };
|
||||
class Cluster {
|
||||
public:
|
||||
Cluster(TestType test_type, int num_workers = 0) : test_type_(test_type) {
|
||||
using namespace std::literals::chrono_literals;
|
||||
switch (test_type) {
|
||||
case TestType::SINGLE_NODE:
|
||||
master_ = std::make_unique<database::SingleNode>(database::Config{});
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "distributed_common.hpp"
|
||||
|
||||
using namespace database;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
TEST_F(DistributedGraphDbTest, RemoteDataGetting) {
|
||||
// Only old data is visible remotely, so create and commit some data.
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
using namespace distributed;
|
||||
using namespace database;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
TEST_F(DistributedGraphDbTest, Coordination) {
|
||||
EXPECT_NE(master().endpoint().port(), 0);
|
||||
|
@ -19,6 +19,7 @@ DECLARE_int32(skiplist_gc_interval);
|
||||
|
||||
using namespace distributed;
|
||||
using namespace database;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
class DistributedInterpretationTest : public DistributedGraphDbTest {
|
||||
protected:
|
||||
|
@ -30,6 +30,7 @@ DECLARE_int32(query_execution_time_sec);
|
||||
|
||||
using namespace distributed;
|
||||
using namespace database;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
TEST_F(DistributedGraphDbTest, PullProduceRpc) {
|
||||
GraphDbAccessor dba{master()};
|
||||
|
@ -27,6 +27,8 @@ DECLARE_int32(wal_rotate_deltas_count);
|
||||
|
||||
DECLARE_string(durability_directory);
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
namespace fs = std::experimental::filesystem;
|
||||
|
||||
// Helper class for performing random CRUD ops on a database.
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "distributed/serialization.hpp"
|
||||
#include "io/network/endpoint.hpp"
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
namespace distributed {
|
||||
|
||||
struct IncrementCounterReq {
|
||||
|
Loading…
Reference in New Issue
Block a user