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/y2016/actors/autonomous_actor.cc b/y2016/actors/autonomous_actor.cc
index ffba99b..d784d51 100644
--- a/y2016/actors/autonomous_actor.cc
+++ b/y2016/actors/autonomous_actor.cc
@@ -14,8 +14,7 @@
#include "y2016/queues/ball_detector_generated.h"
#include "y2016/vision/vision_generated.h"
-namespace y2016 {
-namespace actors {
+namespace y2016::actors {
using ::aos::monotonic_clock;
using ::frc971::ProfileParametersT;
namespace superstructure = y2016::control_loops::superstructure;
@@ -985,5 +984,4 @@
return true;
}
-} // namespace actors
-} // namespace y2016
+} // namespace y2016::actors
diff --git a/y2016/actors/superstructure_actor.cc b/y2016/actors/superstructure_actor.cc
index d33b125..734512a 100644
--- a/y2016/actors/superstructure_actor.cc
+++ b/y2016/actors/superstructure_actor.cc
@@ -8,8 +8,7 @@
#include "y2016/control_loops/superstructure/superstructure_goal_generated.h"
#include "y2016/control_loops/superstructure/superstructure_status_generated.h"
-namespace y2016 {
-namespace actors {
+namespace y2016::actors {
namespace chrono = ::std::chrono;
@@ -112,5 +111,4 @@
WaitUntil(::std::bind(&SuperstructureActor::SuperstructureDone, this));
}
-} // namespace actors
-} // namespace y2016
+} // namespace y2016::actors
diff --git a/y2016/actors/vision_align_actor.cc b/y2016/actors/vision_align_actor.cc
index a31ac5d..f636ddf 100644
--- a/y2016/actors/vision_align_actor.cc
+++ b/y2016/actors/vision_align_actor.cc
@@ -16,8 +16,7 @@
#include "y2016/control_loops/drivetrain/drivetrain_base.h"
#include "y2016/vision/vision_generated.h"
-namespace y2016 {
-namespace actors {
+namespace y2016::actors {
VisionAlignActor::VisionAlignActor(::aos::EventLoop *event_loop)
: aos::common::actions::ActorBase<vision_align_action::Goal>(
@@ -88,5 +87,4 @@
return true;
}
-} // namespace actors
-} // namespace y2016
+} // namespace y2016::actors
diff --git a/y2016/constants.cc b/y2016/constants.cc
index 707fa9c..0c65b11 100644
--- a/y2016/constants.cc
+++ b/y2016/constants.cc
@@ -21,8 +21,7 @@
#define M_PI 3.14159265358979323846
#endif
-namespace y2016 {
-namespace constants {
+namespace y2016::constants {
// ///// Mutual constants between robots. /////
const int Values::kZeroingSampleSize;
@@ -210,5 +209,4 @@
return *values[team_number];
}
-} // namespace constants
-} // namespace y2016
+} // namespace y2016::constants
diff --git a/y2016/control_loops/drivetrain/drivetrain_base.cc b/y2016/control_loops/drivetrain/drivetrain_base.cc
index 1be12ca..208c843 100644
--- a/y2016/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2016/control_loops/drivetrain/drivetrain_base.cc
@@ -14,9 +14,7 @@
namespace chrono = ::std::chrono;
-namespace y2016 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2016::control_loops::drivetrain {
using ::frc971::constants::ShifterHallEffect;
@@ -56,6 +54,4 @@
return kDrivetrainConfig;
};
-} // namespace drivetrain
-} // namespace control_loops
-} // namespace y2016
+} // namespace y2016::control_loops::drivetrain
diff --git a/y2016/control_loops/shooter/shooter.cc b/y2016/control_loops/shooter/shooter.cc
index d317d4f..aeac5a4 100644
--- a/y2016/control_loops/shooter/shooter.cc
+++ b/y2016/control_loops/shooter/shooter.cc
@@ -5,9 +5,7 @@
#include "aos/logging/logging.h"
#include "y2016/control_loops/shooter/shooter_plant.h"
-namespace y2016 {
-namespace control_loops {
-namespace shooter {
+namespace y2016::control_loops::shooter {
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -194,6 +192,4 @@
(void)status->Send(status_builder.Finish());
}
-} // namespace shooter
-} // namespace control_loops
-} // namespace y2016
+} // namespace y2016::control_loops::shooter
diff --git a/y2016/control_loops/shooter/shooter_lib_test.cc b/y2016/control_loops/shooter/shooter_lib_test.cc
index 1a82b9b..a984d26 100644
--- a/y2016/control_loops/shooter/shooter_lib_test.cc
+++ b/y2016/control_loops/shooter/shooter_lib_test.cc
@@ -16,10 +16,7 @@
using ::frc971::control_loops::testing::kTeamNumber;
-namespace y2016 {
-namespace control_loops {
-namespace shooter {
-namespace testing {
+namespace y2016::control_loops::shooter::testing {
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -282,7 +279,4 @@
VerifyNearGoal();
}
-} // namespace testing
-} // namespace shooter
-} // namespace control_loops
-} // namespace y2016
+} // namespace y2016::control_loops::shooter::testing
diff --git a/y2016/control_loops/superstructure/superstructure.cc b/y2016/control_loops/superstructure/superstructure.cc
index 88dfd93..7b69534 100644
--- a/y2016/control_loops/superstructure/superstructure.cc
+++ b/y2016/control_loops/superstructure/superstructure.cc
@@ -8,9 +8,7 @@
#include "y2016/control_loops/superstructure/superstructure_controls.h"
#include "y2016/queues/ball_detector_generated.h"
-namespace y2016 {
-namespace control_loops {
-namespace superstructure {
+namespace y2016::control_loops::superstructure {
namespace {
// The maximum voltage the intake roller will be allowed to use.
@@ -846,6 +844,4 @@
constexpr double Superstructure::kShoulderWristClearAngle;
constexpr double Superstructure::kShoulderTransitionToLanded;
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2016
+} // namespace y2016::control_loops::superstructure
diff --git a/y2016/control_loops/superstructure/superstructure_controls.cc b/y2016/control_loops/superstructure/superstructure_controls.cc
index ee2020e..32c8b17 100644
--- a/y2016/control_loops/superstructure/superstructure_controls.cc
+++ b/y2016/control_loops/superstructure/superstructure_controls.cc
@@ -5,9 +5,7 @@
#include "y2016/control_loops/superstructure/integral_arm_plant.h"
#include "y2016/control_loops/superstructure/integral_intake_plant.h"
-namespace y2016 {
-namespace control_loops {
-namespace superstructure {
+namespace y2016::control_loops::superstructure {
using ::frc971::PotAndIndexPosition;
@@ -254,6 +252,4 @@
}
}
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2016
+} // namespace y2016::control_loops::superstructure
diff --git a/y2016/control_loops/superstructure/superstructure_lib_test.cc b/y2016/control_loops/superstructure/superstructure_lib_test.cc
index 9609cd0..ed2f210 100644
--- a/y2016/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2016/control_loops/superstructure/superstructure_lib_test.cc
@@ -21,10 +21,7 @@
using ::frc971::control_loops::PositionSensorSimulator;
-namespace y2016 {
-namespace control_loops {
-namespace superstructure {
-namespace testing {
+namespace y2016::control_loops::superstructure::testing {
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -1496,7 +1493,4 @@
EXPECT_GE(superstructure_plant_.shoulder_angular_velocity(), 0.55);
}
-} // namespace testing
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2016
+} // namespace y2016::control_loops::superstructure::testing
diff --git a/y2016/dashboard/dashboard.cc b/y2016/dashboard/dashboard.cc
index 0b12b14..319eaa5 100644
--- a/y2016/dashboard/dashboard.cc
+++ b/y2016/dashboard/dashboard.cc
@@ -25,8 +25,7 @@
namespace chrono = ::std::chrono;
-namespace y2016 {
-namespace dashboard {
+namespace y2016::dashboard {
namespace big_indicator {
constexpr int kBlack = 0;
constexpr int kBallIntaked = 1;
@@ -275,8 +274,7 @@
data_collector_thread_.join();
}
-} // namespace dashboard
-} // namespace y2016
+} // namespace y2016::dashboard
int main(int argc, char **argv) {
// Make sure to reference this to force the linker to include it.
diff --git a/y2016/joystick_reader.cc b/y2016/joystick_reader.cc
index 3daecce..2eb2ed1 100644
--- a/y2016/joystick_reader.cc
+++ b/y2016/joystick_reader.cc
@@ -31,9 +31,7 @@
using ::frc971::input::driver_station::JoystickAxis;
using ::frc971::input::driver_station::POVLocation;
-namespace y2016 {
-namespace input {
-namespace joysticks {
+namespace y2016::input::joysticks {
namespace {
@@ -458,9 +456,7 @@
"no drivetrain status");
};
-} // namespace joysticks
-} // namespace input
-} // namespace y2016
+} // namespace y2016::input::joysticks
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2016/vision/blob_filters.cc b/y2016/vision/blob_filters.cc
index 0193ef6..c9cd04d 100644
--- a/y2016/vision/blob_filters.cc
+++ b/y2016/vision/blob_filters.cc
@@ -2,8 +2,7 @@
#include <unistd.h>
-namespace aos {
-namespace vision {
+namespace aos::vision {
double CornerFinder::LineScore(Vector<2> A, Vector<2> B, FittedLine line) {
Vector<2> st(line.st.x, line.st.y);
@@ -390,5 +389,4 @@
}
}
-} // namespace vision
-} // namespace aos
+} // namespace aos::vision
diff --git a/y2016/vision/stereo_geometry.cc b/y2016/vision/stereo_geometry.cc
index a58675c..673834c 100644
--- a/y2016/vision/stereo_geometry.cc
+++ b/y2016/vision/stereo_geometry.cc
@@ -1,7 +1,6 @@
#include "y2016/vision/stereo_geometry.h"
-namespace y2016 {
-namespace vision {
+namespace y2016::vision {
Calibration FindCalibrationForRobotOrDie(
const ::std::string &robot_name, const CalibrationFile &calibration_file) {
@@ -14,5 +13,4 @@
calibration_file.ShortDebugString().c_str());
}
-} // namespace vision
-} // namespace y2016
+} // namespace y2016::vision
diff --git a/y2016/vision/target_receiver.cc b/y2016/vision/target_receiver.cc
index 701f7e8..5aa854e 100644
--- a/y2016/vision/target_receiver.cc
+++ b/y2016/vision/target_receiver.cc
@@ -22,8 +22,7 @@
#include "y2016/vision/vision_data.pb.h"
#include "y2016/vision/vision_generated.h"
-namespace y2016 {
-namespace vision {
+namespace y2016::vision {
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -428,8 +427,7 @@
}
}
-} // namespace vision
-} // namespace y2016
+} // namespace y2016::vision
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2016/vision/target_sender.cc b/y2016/vision/target_sender.cc
index a0a0dc7..5a842b7 100644
--- a/y2016/vision/target_sender.cc
+++ b/y2016/vision/target_sender.cc
@@ -18,8 +18,7 @@
#include "y2016/vision/stereo_geometry.h"
#include "y2016/vision/vision_data.pb.h"
-namespace y2016 {
-namespace vision {
+namespace y2016::vision {
using aos::events::DataSocket;
using aos::events::TCPServer;
using aos::events::TXUdpSocket;
@@ -218,8 +217,7 @@
loop.Run();
}
-} // namespace vision
-} // namespace y2016
+} // namespace y2016::vision
int main(int, char **) {
using namespace y2016::vision;
diff --git a/y2016/vision/tools/blob_stream_replay.cc b/y2016/vision/tools/blob_stream_replay.cc
index 847f654..1c15259 100644
--- a/y2016/vision/tools/blob_stream_replay.cc
+++ b/y2016/vision/tools/blob_stream_replay.cc
@@ -18,8 +18,7 @@
#include "y2016/vision/blob_filters.h"
// #include "y2016/vision/process_targets.h"
-namespace y2016 {
-namespace vision {
+namespace y2016::vision {
using namespace aos::vision;
::aos::vision::Vector<2> CreateCenterFromTarget(double lx, double ly, double rx,
@@ -573,8 +572,7 @@
// count how many frames we miss in a row.
int missed_count_ = 16;
};
-} // namespace vision
-} // namespace y2016
+} // namespace y2016::vision
int main(int argc, char *argv[]) {
using namespace y2016::vision;
diff --git a/y2016/wpilib_interface.cc b/y2016/wpilib_interface.cc
index 0e98085..3466b82 100644
--- a/y2016/wpilib_interface.cc
+++ b/y2016/wpilib_interface.cc
@@ -58,8 +58,7 @@
namespace shooter = ::y2016::control_loops::shooter;
namespace superstructure = ::y2016::control_loops::superstructure;
-namespace y2016 {
-namespace wpilib {
+namespace y2016::wpilib {
namespace {
constexpr double kMaxBringupPower = 12.0;
} // namespace
@@ -698,7 +697,6 @@
}
};
-} // namespace wpilib
-} // namespace y2016
+} // namespace y2016::wpilib
AOS_ROBOT_CLASS(::y2016::wpilib::WPILibRobot);