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/y2023/vision/april_generator.cc b/y2023/vision/april_generator.cc
index 4ac389a..3746474 100644
--- a/y2023/vision/april_generator.cc
+++ b/y2023/vision/april_generator.cc
@@ -14,8 +14,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.
@@ -147,8 +146,7 @@
}
};
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
// TODO(austin): Combine the functions and optimize for device/host and all that
// jazz.
diff --git a/y2023/vision/aprilrobotics.cc b/y2023/vision/aprilrobotics.cc
index f2e2592..0605eb2 100644
--- a/y2023/vision/aprilrobotics.cc
+++ b/y2023/vision/aprilrobotics.cc
@@ -20,8 +20,7 @@
DEFINE_uint64(pose_estimation_iterations, 50,
"Number of iterations for apriltag pose estimation.");
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
namespace chrono = std::chrono;
@@ -374,5 +373,4 @@
return {.detections = results, .rejections = rejections_};
}
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
diff --git a/y2023/vision/calibrate_extrinsics.cc b/y2023/vision/calibrate_extrinsics.cc
index 91bdefd..f0a0d71 100644
--- a/y2023/vision/calibrate_extrinsics.cc
+++ b/y2023/vision/calibrate_extrinsics.cc
@@ -31,8 +31,7 @@
"Output json file to use for the resulting calibration "
"(intrinsics and extrinsics).");
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
namespace chrono = std::chrono;
using aos::distributed_clock;
using aos::monotonic_clock;
@@ -306,8 +305,7 @@
}
} // namespace vision
-} // namespace vision
-} // namespace frc971
+} // namespace frc971::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/calibrate_multi_cameras.cc b/y2023/vision/calibrate_multi_cameras.cc
index d3cfa6f..48dffb9 100644
--- a/y2023/vision/calibrate_multi_cameras.cc
+++ b/y2023/vision/calibrate_multi_cameras.cc
@@ -67,8 +67,7 @@
// estimation, and probably also include camera->imu extrinsics from all
// cameras, not just pi1
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
using frc971::vision::DataAdapter;
using frc971::vision::ImageCallback;
using frc971::vision::PoseUtils;
@@ -699,8 +698,7 @@
delete image_callbacks[i];
}
}
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/camera_reader.cc b/y2023/vision/camera_reader.cc
index d5f39a0..abffac0 100644
--- a/y2023/vision/camera_reader.cc
+++ b/y2023/vision/camera_reader.cc
@@ -22,8 +22,7 @@
DEFINE_bool(send_downsized_images, false,
"Whether to send downsized image for driver cam streaming.");
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
namespace {
using namespace frc971::vision;
@@ -202,8 +201,7 @@
}
} // namespace
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/ccm.cc b/y2023/vision/ccm.cc
index 7f35ae5..d32cc2f 100644
--- a/y2023/vision/ccm.cc
+++ b/y2023/vision/ccm.cc
@@ -8,8 +8,7 @@
#include "aos/init.h"
#include "aos/time/time.h"
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
namespace {
// Adapted from the opencv example code for color calibration.
@@ -73,8 +72,7 @@
}
} // namespace
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/game_pieces.cc b/y2023/vision/game_pieces.cc
index 8a0621d..68ff160 100644
--- a/y2023/vision/game_pieces.cc
+++ b/y2023/vision/game_pieces.cc
@@ -7,8 +7,7 @@
#include "frc971/vision/vision_generated.h"
#include "y2023/vision/yolov5.h"
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
using aos::monotonic_clock;
GamePiecesDetector::GamePiecesDetector(aos::EventLoop *event_loop)
: game_pieces_sender_(event_loop->MakeSender<GamePieces>("/camera")) {
@@ -73,5 +72,4 @@
builder.CheckOk(builder.Send(game_pieces_builder.Finish()));
}
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
diff --git a/y2023/vision/game_pieces_main.cc b/y2023/vision/game_pieces_main.cc
index 97940b6..b4ceff5 100644
--- a/y2023/vision/game_pieces_main.cc
+++ b/y2023/vision/game_pieces_main.cc
@@ -4,8 +4,7 @@
DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
namespace {
void GamePiecesDetectorMain() {
@@ -16,8 +15,7 @@
event_loop.Run();
}
} // namespace
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/target_mapping.cc b/y2023/vision/target_mapping.cc
index 83705b9..af4c36c 100644
--- a/y2023/vision/target_mapping.cc
+++ b/y2023/vision/target_mapping.cc
@@ -58,8 +58,7 @@
DECLARE_int32(max_target_id);
DECLARE_bool(visualize_solver);
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
using frc971::vision::DataAdapter;
using frc971::vision::ImageCallback;
using frc971::vision::PoseUtils;
@@ -430,8 +429,7 @@
mapper_replay.MaybeSolve();
}
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/viewer.cc b/y2023/vision/viewer.cc
index e03680c..78731e5 100644
--- a/y2023/vision/viewer.cc
+++ b/y2023/vision/viewer.cc
@@ -18,8 +18,7 @@
DEFINE_int32(rate, 100, "Time in milliseconds to wait between images");
DEFINE_double(scale, 1.0, "Scale factor for images being displayed");
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
namespace {
using frc971::vision::CameraImage;
@@ -108,8 +107,7 @@
}
} // namespace
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision
int main(int argc, char **argv) {
aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/yolov5.cc b/y2023/vision/yolov5.cc
index ba2a9f7..e62b106 100644
--- a/y2023/vision/yolov5.cc
+++ b/y2023/vision/yolov5.cc
@@ -30,8 +30,7 @@
DEFINE_bool(visualize_detections, false, "Display inference output");
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
class YOLOV5Impl : public YOLOV5 {
public:
@@ -303,5 +302,4 @@
return filtered_detections;
};
-} // namespace vision
-} // namespace y2023
+} // namespace y2023::vision