Skip to content

Commit 94f2a37

Browse files
authored
Remove namespace directives from util headers (#520)
- drop `using namespace ppc::task` from func/perf test headers - drop `using namespace ppc::performance` from perf test header - qualify names in util helpers with their namespaces
1 parent e76dfeb commit 94f2a37

File tree

2 files changed

+21
-24
lines changed

2 files changed

+21
-24
lines changed

modules/util/include/func_test_util.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
#include "task/include/task.hpp"
1717
#include "util/include/util.hpp"
1818

19-
using namespace ppc::task;
20-
2119
namespace ppc::util {
2220

2321
template <typename InType, typename OutType, typename TestType = void>
24-
using FuncTestParam = std::tuple<std::function<TaskPtr<InType, OutType>(InType)>, std::string, TestType>;
22+
using FuncTestParam = std::tuple<std::function<ppc::task::TaskPtr<InType, OutType>(InType)>, std::string, TestType>;
2523

2624
template <typename InType, typename OutType, typename TestType = void>
2725
using GTestFuncParam = ::testing::TestParamInfo<FuncTestParam<InType, OutType, TestType>>;
@@ -98,7 +96,7 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
9896
}
9997

10098
private:
101-
TaskPtr<InType, OutType> task_;
99+
ppc::task::TaskPtr<InType, OutType> task_;
102100
};
103101

104102
template <typename Tuple, std::size_t... Is>
@@ -115,10 +113,10 @@ auto ExpandToValues(const Tuple& t) {
115113
template <typename Task, typename InType, typename SizesContainer, std::size_t... Is>
116114
auto GenTaskTuplesImpl(const SizesContainer& sizes, const std::string& settings_path,
117115
std::index_sequence<Is...> /*unused*/) {
118-
return std::make_tuple(std::make_tuple(
119-
TaskGetter<Task, InType>,
120-
std::string(GetNamespace<Task>()) + "_" + GetStringTaskType(Task::GetStaticTypeOfTask(), settings_path),
121-
sizes[Is])...);
116+
return std::make_tuple(std::make_tuple(ppc::task::TaskGetter<Task, InType>,
117+
std::string(GetNamespace<Task>()) + "_" +
118+
ppc::task::GetStringTaskType(Task::GetStaticTypeOfTask(), settings_path),
119+
sizes[Is])...);
122120
}
123121

124122
template <typename Task, typename InType, typename SizesContainer>

modules/util/include/perf_test_util.hpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@
1818
#include "task/include/task.hpp"
1919
#include "util/include/util.hpp"
2020

21-
using namespace ppc::task;
22-
using namespace ppc::performance;
23-
2421
namespace ppc::util {
2522

2623
double GetTimeMPI();
2724
int GetMPIRank();
2825

2926
template <typename InType, typename OutType>
30-
using PerfTestParam =
31-
std::tuple<std::function<TaskPtr<InType, OutType>(InType)>, std::string, PerfResults::TypeOfRunning>;
27+
using PerfTestParam = std::tuple<std::function<ppc::task::TaskPtr<InType, OutType>(InType)>, std::string,
28+
ppc::performance::PerfResults::TypeOfRunning>;
3229

3330
template <typename InType, typename OutType>
3431
/// @brief Base class for performance testing of parallel tasks.
@@ -38,7 +35,7 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
3835
public:
3936
/// @brief Generates a readable name for the performance test case.
4037
static std::string CustomPerfTestName(const ::testing::TestParamInfo<PerfTestParam<InType, OutType>>& info) {
41-
return GetStringParamName(std::get<GTestParamIndex::kTestParams>(info.param)) + "_" +
38+
return ppc::performance::GetStringParamName(std::get<GTestParamIndex::kTestParams>(info.param)) + "_" +
4239
std::get<GTestParamIndex::kNameTest>(info.param);
4340
}
4441

@@ -47,7 +44,7 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
4744
/// @brief Supplies input data for performance testing.
4845
virtual InType GetTestInputData() = 0;
4946

50-
virtual void SetPerfAttributes(PerfAttr& perf_attrs) {
47+
virtual void SetPerfAttributes(ppc::performance::PerfAttr& perf_attrs) {
5148
if (task_->GetDynamicTypeOfTask() == ppc::task::TypeOfTask::kMPI ||
5249
task_->GetDynamicTypeOfTask() == ppc::task::TypeOfTask::kALL) {
5350
const double t0 = GetTimeMPI();
@@ -80,13 +77,13 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
8077
}
8178

8279
task_ = task_getter(GetTestInputData());
83-
Perf perf(task_);
84-
PerfAttr perf_attr;
80+
ppc::performance::Perf perf(task_);
81+
ppc::performance::PerfAttr perf_attr;
8582
SetPerfAttributes(perf_attr);
8683

87-
if (mode == PerfResults::TypeOfRunning::kPipeline) {
84+
if (mode == ppc::performance::PerfResults::TypeOfRunning::kPipeline) {
8885
perf.PipelineRun(perf_attr);
89-
} else if (mode == PerfResults::TypeOfRunning::kTaskRun) {
86+
} else if (mode == ppc::performance::PerfResults::TypeOfRunning::kTaskRun) {
9087
perf.TaskRun(perf_attr);
9188
} else {
9289
std::stringstream err_msg;
@@ -103,16 +100,18 @@ class BaseRunPerfTests : public ::testing::TestWithParam<PerfTestParam<InType, O
103100
}
104101

105102
private:
106-
TaskPtr<InType, OutType> task_;
103+
ppc::task::TaskPtr<InType, OutType> task_;
107104
};
108105

109106
template <typename TaskType, typename InputType>
110107
auto MakePerfTaskTuples(const std::string& settings_path) {
111-
const auto name =
112-
std::string(GetNamespace<TaskType>()) + "_" + GetStringTaskType(TaskType::GetStaticTypeOfTask(), settings_path);
108+
const auto name = std::string(GetNamespace<TaskType>()) + "_" +
109+
ppc::task::GetStringTaskType(TaskType::GetStaticTypeOfTask(), settings_path);
113110

114-
return std::make_tuple(std::make_tuple(TaskGetter<TaskType, InputType>, name, PerfResults::TypeOfRunning::kPipeline),
115-
std::make_tuple(TaskGetter<TaskType, InputType>, name, PerfResults::TypeOfRunning::kTaskRun));
111+
return std::make_tuple(std::make_tuple(ppc::task::TaskGetter<TaskType, InputType>, name,
112+
ppc::performance::PerfResults::TypeOfRunning::kPipeline),
113+
std::make_tuple(ppc::task::TaskGetter<TaskType, InputType>, name,
114+
ppc::performance::PerfResults::TypeOfRunning::kTaskRun));
116115
}
117116

118117
template <typename Tuple, std::size_t... I>

0 commit comments

Comments
 (0)