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/y2014_bot3/actors/autonomous_actor.cc b/y2014_bot3/actors/autonomous_actor.cc
index 8f281d4..1166524 100644
--- a/y2014_bot3/actors/autonomous_actor.cc
+++ b/y2014_bot3/actors/autonomous_actor.cc
@@ -9,8 +9,7 @@
#include "aos/util/phased_loop.h"
#include "y2014_bot3/control_loops/drivetrain/drivetrain_base.h"
-namespace y2014_bot3 {
-namespace actors {
+namespace y2014_bot3::actors {
using ::frc971::ProfileParametersT;
using ::aos::monotonic_clock;
@@ -58,5 +57,4 @@
return true;
}
-} // namespace actors
-} // namespace y2014_bot3
+} // namespace y2014_bot3::actors
diff --git a/y2014_bot3/control_loops/drivetrain/drivetrain_base.cc b/y2014_bot3/control_loops/drivetrain/drivetrain_base.cc
index 6a6ed31..ea6806f 100644
--- a/y2014_bot3/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2014_bot3/control_loops/drivetrain/drivetrain_base.cc
@@ -13,9 +13,7 @@
namespace chrono = ::std::chrono;
-namespace y2014_bot3 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2014_bot3::control_loops::drivetrain {
using ::frc971::constants::ShifterHallEffect;
@@ -57,6 +55,4 @@
return kDrivetrainConfig;
};
-} // namespace drivetrain
-} // namespace control_loops
-} // namespace y2014_bot3
+} // namespace y2014_bot3::control_loops::drivetrain
diff --git a/y2014_bot3/control_loops/rollers/rollers.cc b/y2014_bot3/control_loops/rollers/rollers.cc
index 8cf7ba6..ea77357 100644
--- a/y2014_bot3/control_loops/rollers/rollers.cc
+++ b/y2014_bot3/control_loops/rollers/rollers.cc
@@ -6,9 +6,7 @@
#include "y2014_bot3/control_loops/rollers/rollers_position_generated.h"
#include "y2014_bot3/control_loops/rollers/rollers_status_generated.h"
-namespace y2014_bot3 {
-namespace control_loops {
-namespace rollers {
+namespace y2014_bot3::control_loops::rollers {
Rollers::Rollers(::aos::EventLoop *event_loop, const ::std::string &name)
: frc971::controls::ControlLoop<Goal, Position, Status, Output>(event_loop,
@@ -83,6 +81,4 @@
output->CheckOk(output->Send(Output::Pack(*output->fbb(), &output_struct)));
}
-} // namespace rollers
-} // namespace control_loops
-} // namespace y2014_bot3
+} // namespace y2014_bot3::control_loops::rollers
diff --git a/y2014_bot3/joystick_reader.cc b/y2014_bot3/joystick_reader.cc
index 0c48552..98ade64 100644
--- a/y2014_bot3/joystick_reader.cc
+++ b/y2014_bot3/joystick_reader.cc
@@ -22,9 +22,7 @@
using ::frc971::input::driver_station::JoystickAxis;
using ::frc971::input::driver_station::POVLocation;
-namespace y2014_bot3 {
-namespace input {
-namespace joysticks {
+namespace y2014_bot3::input::joysticks {
// Joystick & button addresses.
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
@@ -133,9 +131,7 @@
::frc971::autonomous::BaseAutonomousActor::Factory autonomous_action_factory_;
};
-} // namespace joysticks
-} // namespace input
-} // namespace y2014_bot3
+} // namespace y2014_bot3::input::joysticks
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2014_bot3/output/motor_writer.cc b/y2014_bot3/output/motor_writer.cc
index 0b0e17b..87b41dc 100644
--- a/y2014_bot3/output/motor_writer.cc
+++ b/y2014_bot3/output/motor_writer.cc
@@ -15,8 +15,7 @@
using ::aos::util::SimpleLogInterval;
-namespace bot3 {
-namespace output {
+namespace bot3::output {
class MotorWriter : public ::aos::MotorOutput {
// Maximum age of an output packet before the motors get zeroed instead.
@@ -111,8 +110,7 @@
constexpr chrono::milliseconds MotorWriter::kOldLogInterval;
-} // namespace output
-} // namespace bot3
+} // namespace bot3::output
int main() {
::aos::Init();
diff --git a/y2014_bot3/shifter_hall_effect.h b/y2014_bot3/shifter_hall_effect.h
index a4bdeb8..0a65360 100644
--- a/y2014_bot3/shifter_hall_effect.h
+++ b/y2014_bot3/shifter_hall_effect.h
@@ -1,8 +1,7 @@
#ifndef BOT3_SHIFTER_HALL_EFFECT_H_
#define BOT3_SHIFTER_HALL_EFFECT_H_
-namespace bot3 {
-namespace constants {
+namespace bot3::constants {
// Contains the voltages for an analog hall effect sensor on a shifter.
struct ShifterHallEffect {
@@ -13,7 +12,6 @@
double clear_high, clear_low;
};
-} // namespace constants
-} // namespace bot3
+} // namespace bot3::constants
#endif
diff --git a/y2014_bot3/wpilib_interface.cc b/y2014_bot3/wpilib_interface.cc
index 22d372e..5640e50 100644
--- a/y2014_bot3/wpilib_interface.cc
+++ b/y2014_bot3/wpilib_interface.cc
@@ -57,8 +57,7 @@
using ::frc971::wpilib::LoopOutputHandler;
using std::make_unique;
-namespace y2014_bot3 {
-namespace wpilib {
+namespace y2014_bot3::wpilib {
double drivetrain_translate(int32_t in) {
return static_cast<double>(in) / (256.0 /*cpr*/ * 4.0 /*4x*/) *
@@ -357,7 +356,6 @@
}
};
-} // namespace wpilib
-} // namespace y2014_bot3
+} // namespace y2014_bot3::wpilib
AOS_ROBOT_CLASS(::y2014_bot3::wpilib::WPILibRobot);