Nest all namespaces
The compiler supports this now. We can type less going forward.
No functional changes.
Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: I29d6fa4f9aacc0e381f1a7637294db0392466995
diff --git a/y2020/vision/camera_reader.cc b/y2020/vision/camera_reader.cc
index a63becd..251f988 100644
--- a/y2020/vision/camera_reader.cc
+++ b/y2020/vision/camera_reader.cc
@@ -23,8 +23,7 @@
DEFINE_bool(use_prev_pose, true,
"If true, use previous pose estimate as seed for next estimate.");
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
const sift::CameraCalibration *CameraReader::FindCameraCalibration() const {
const std::string_view node_name = event_loop_->node()->name()->string_view();
@@ -541,5 +540,4 @@
return fbb->CreateVector(features_vector);
}
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
diff --git a/y2020/vision/camera_reader_main.cc b/y2020/vision/camera_reader_main.cc
index b54cf4e..1995151 100644
--- a/y2020/vision/camera_reader_main.cc
+++ b/y2020/vision/camera_reader_main.cc
@@ -6,8 +6,8 @@
// bazel run //y2020/vision:camera_reader -- --config y2020/aos_config.json
// --override_hostname pi-7971-1 --ignore_timestamps true
DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
-namespace frc971 {
-namespace vision {
+
+namespace frc971::vision {
namespace {
void CameraReaderMain() {
@@ -43,8 +43,7 @@
}
} // namespace
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2020/vision/extrinsics_calibration.cc b/y2020/vision/extrinsics_calibration.cc
index 334de0b..deda8c3 100644
--- a/y2020/vision/extrinsics_calibration.cc
+++ b/y2020/vision/extrinsics_calibration.cc
@@ -21,8 +21,7 @@
DEFINE_string(base_intrinsics, "",
"Intrinsics to use for extrinsics calibration.");
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace chrono = std::chrono;
using aos::distributed_clock;
using aos::monotonic_clock;
@@ -146,8 +145,7 @@
}
}
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2020/vision/sift/fast_gaussian.cc b/y2020/vision/sift/fast_gaussian.cc
index 22549ac..69432b4 100644
--- a/y2020/vision/sift/fast_gaussian.cc
+++ b/y2020/vision/sift/fast_gaussian.cc
@@ -6,8 +6,7 @@
#include "y2020/vision/sift/fast_gaussian_all.h"
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace {
void CheckNonOverlapping(const cv::Mat &a, const cv::Mat &b) {
@@ -122,5 +121,4 @@
cv::subtract(*blurred, source, *difference);
}
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
diff --git a/y2020/vision/sift/fast_gaussian_generator.cc b/y2020/vision/sift/fast_gaussian_generator.cc
index aefb3d9..9b3ca9a 100644
--- a/y2020/vision/sift/fast_gaussian_generator.cc
+++ b/y2020/vision/sift/fast_gaussian_generator.cc
@@ -15,8 +15,7 @@
// https://halide-lang.org/tutorials/tutorial_lesson_15_generators.html has an
// introduction to much of the magic in this file.
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace {
// Returns a function implementating a 1-dimensional gaussian blur convolution.
@@ -206,8 +205,7 @@
}
};
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
HALIDE_REGISTER_GENERATOR(frc971::vision::GaussianGenerator, gaussian_generator)
HALIDE_REGISTER_GENERATOR(frc971::vision::SubtractGenerator, subtract_generator)
diff --git a/y2020/vision/sift/fast_gaussian_test.cc b/y2020/vision/sift/fast_gaussian_test.cc
index 0ed9e20..27bab54 100644
--- a/y2020/vision/sift/fast_gaussian_test.cc
+++ b/y2020/vision/sift/fast_gaussian_test.cc
@@ -5,9 +5,7 @@
#include "y2020/vision/sift/fast_gaussian_all.h"
-namespace frc971 {
-namespace vision {
-namespace testing {
+namespace frc971::vision::testing {
class FastGaussianTest : public ::testing::Test {
public:
@@ -70,6 +68,4 @@
ExpectEqual(fast, fast_direct, 0);
}
-} // namespace testing
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision::testing
diff --git a/y2020/vision/sift/get_gaussian_kernel_test.cc b/y2020/vision/sift/get_gaussian_kernel_test.cc
index e35f06e..3d2674f 100644
--- a/y2020/vision/sift/get_gaussian_kernel_test.cc
+++ b/y2020/vision/sift/get_gaussian_kernel_test.cc
@@ -8,9 +8,7 @@
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
-namespace frc971 {
-namespace vision {
-namespace testing {
+namespace frc971::vision::testing {
class GetGaussianKernelTest
: public ::testing::TestWithParam<std::tuple<int, double>> {
@@ -33,6 +31,4 @@
::testing::Values(0.01f, 0.1f,
0.9f)));
-} // namespace testing
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision::testing
diff --git a/y2020/vision/sift/sift971.cc b/y2020/vision/sift/sift971.cc
index afab9b4..21f9a97 100644
--- a/y2020/vision/sift/sift971.cc
+++ b/y2020/vision/sift/sift971.cc
@@ -118,8 +118,7 @@
using namespace cv;
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace {
#define USE_AVX2 0
@@ -1288,5 +1287,4 @@
}
}
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
diff --git a/y2020/vision/tools/python_code/camera_param_test.cc b/y2020/vision/tools/python_code/camera_param_test.cc
index 30616b0..f47c327 100644
--- a/y2020/vision/tools/python_code/camera_param_test.cc
+++ b/y2020/vision/tools/python_code/camera_param_test.cc
@@ -16,8 +16,7 @@
#include "y2020/vision/sift/sift_generated.h"
#include "y2020/vision/sift/sift_training_generated.h"
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace {
class Feature {
@@ -275,5 +274,4 @@
}
} // namespace
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
diff --git a/y2020/vision/viewer.cc b/y2020/vision/viewer.cc
index ff08f01..8ba2955 100644
--- a/y2020/vision/viewer.cc
+++ b/y2020/vision/viewer.cc
@@ -20,8 +20,7 @@
DEFINE_string(capture, "",
"If set, capture a single image and save it to this filename.");
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace {
aos::Fetcher<CameraImage> image_fetcher;
@@ -170,8 +169,7 @@
}
} // namespace
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
// Quick and lightweight grayscale viewer for images
int main(int argc, char **argv) {
diff --git a/y2020/vision/viewer_replay.cc b/y2020/vision/viewer_replay.cc
index 03777bc..ee1c8d5 100644
--- a/y2020/vision/viewer_replay.cc
+++ b/y2020/vision/viewer_replay.cc
@@ -12,8 +12,7 @@
DEFINE_string(image_save_prefix, "/tmp/img",
"Prefix to use for saving images from the logfile.");
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace {
void ViewerMain(int argc, char *argv[]) {
@@ -50,8 +49,7 @@
}
} // namespace
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
// Quick and lightweight grayscale viewer for images
int main(int argc, char **argv) {