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/y2019/vision/constants.cc b/y2019/vision/constants.cc
index 3fa99a7..504af1e 100644
--- a/y2019/vision/constants.cc
+++ b/y2019/vision/constants.cc
@@ -1,7 +1,6 @@
#include "y2019/vision/constants.h"
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
static constexpr double kInchesToMeters = 0.0254;
@@ -320,5 +319,4 @@
}
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
diff --git a/y2019/vision/constants_formatting.cc b/y2019/vision/constants_formatting.cc
index ebda53f..52db9d5 100644
--- a/y2019/vision/constants_formatting.cc
+++ b/y2019/vision/constants_formatting.cc
@@ -3,8 +3,7 @@
#include "y2019/vision/constants.h"
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
namespace {
// 64 should be enough for any mortal.
@@ -57,8 +56,7 @@
std::ofstream o(fname);
o << R"(#include "y2019/vision/constants.h"
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
static constexpr double kInchesToMeters = 0.0254;
)";
@@ -90,11 +88,9 @@
}
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
)";
o.close();
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
diff --git a/y2019/vision/debug_serial.cc b/y2019/vision/debug_serial.cc
index 9b88260..79849b9 100644
--- a/y2019/vision/debug_serial.cc
+++ b/y2019/vision/debug_serial.cc
@@ -13,8 +13,7 @@
#include "y2019/jevois/structures.h"
#include "y2019/jevois/uart.h"
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
void main(int argc, char **argv) {
(void)argc;
@@ -85,7 +84,6 @@
}
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
int main(int argc, char **argv) { y2019::vision::main(argc, argv); }
diff --git a/y2019/vision/debug_viewer.cc b/y2019/vision/debug_viewer.cc
index b2ad1be..1a93f87 100644
--- a/y2019/vision/debug_viewer.cc
+++ b/y2019/vision/debug_viewer.cc
@@ -21,8 +21,7 @@
DEFINE_int32(camera, 10, "The camera to use the intrinsics for");
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
std::vector<PixelRef> GetNColors(size_t num_colors) {
std::vector<PixelRef> colors;
@@ -358,8 +357,7 @@
bool draw_results_ = true;
};
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
int main(int argc, char **argv) {
::gflags::ParseCommandLineFlags(&argc, &argv, true);
diff --git a/y2019/vision/global_calibration.cc b/y2019/vision/global_calibration.cc
index b8f5b3c..bb3259e 100644
--- a/y2019/vision/global_calibration.cc
+++ b/y2019/vision/global_calibration.cc
@@ -52,8 +52,7 @@
using ceres::Solve;
using ceres::Solver;
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
namespace {
constexpr double kInchesToMeters = 0.0254;
@@ -293,7 +292,6 @@
DumpCameraConstants(FLAGS_constants.c_str(), info.camera_id, results);
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
int main(int argc, char **argv) { y2019::vision::main(argc, argv); }
diff --git a/y2019/vision/image_writer.cc b/y2019/vision/image_writer.cc
index 4ca9b96..9b73a81 100644
--- a/y2019/vision/image_writer.cc
+++ b/y2019/vision/image_writer.cc
@@ -6,8 +6,7 @@
#include "glog/logging.h"
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
ImageWriter::ImageWriter() {
LOG(INFO) << "Initializing image writer";
@@ -38,5 +37,4 @@
}
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
diff --git a/y2019/vision/server/server.cc b/y2019/vision/server/server.cc
index c9e7091..309a90c 100644
--- a/y2019/vision/server/server.cc
+++ b/y2019/vision/server/server.cc
@@ -28,8 +28,7 @@
#include "y2019/control_loops/superstructure/superstructure_status_generated.h"
#include "y2019/vision/server/server_data.pb.h"
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
namespace chrono = ::std::chrono;
@@ -279,8 +278,7 @@
event_loop.Run();
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
int main(int argc, char **argv) {
// Make sure to reference this to force the linker to include it.
diff --git a/y2019/vision/server/www/generate_camera.cc b/y2019/vision/server/www/generate_camera.cc
index 455b0a9..c673aec 100644
--- a/y2019/vision/server/www/generate_camera.cc
+++ b/y2019/vision/server/www/generate_camera.cc
@@ -4,8 +4,7 @@
#include "y2019/constants.h"
#include "y2019/vision/constants.h"
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
void DumpPose(std::basic_ostream<char> *o, const vision::CameraGeometry &pose) {
*o << "{x: " << pose.location[0] << ", y: " << pose.location[1]
<< ", theta: " << pose.heading << "}";
@@ -23,8 +22,7 @@
}
out_file << "];\n";
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
int main(int argc, char *argv[]) {
if (argc != 2) {
diff --git a/y2019/vision/target_finder.cc b/y2019/vision/target_finder.cc
index b59792c..7efc38a 100644
--- a/y2019/vision/target_finder.cc
+++ b/y2019/vision/target_finder.cc
@@ -6,8 +6,7 @@
using namespace aos::vision;
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
TargetFinder::TargetFinder()
: target_template_(Target::MakeTemplate()),
@@ -632,5 +631,4 @@
return needs_update;
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision
diff --git a/y2019/vision/target_geometry.cc b/y2019/vision/target_geometry.cc
index e562f49..52d9b8d 100644
--- a/y2019/vision/target_geometry.cc
+++ b/y2019/vision/target_geometry.cc
@@ -11,8 +11,7 @@
using ceres::Solve;
using ceres::Solver;
-namespace y2019 {
-namespace vision {
+namespace y2019::vision {
static constexpr double kInchesToMeters = 0.0254;
@@ -349,5 +348,4 @@
return IR;
}
-} // namespace vision
-} // namespace y2019
+} // namespace y2019::vision