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/y2018/actors/autonomous_actor.cc b/y2018/actors/autonomous_actor.cc
index ea9daab..ae017b5 100644
--- a/y2018/actors/autonomous_actor.cc
+++ b/y2018/actors/autonomous_actor.cc
@@ -8,8 +8,7 @@
#include "aos/util/phased_loop.h"
#include "y2018/control_loops/drivetrain/drivetrain_base.h"
-namespace y2018 {
-namespace actors {
+namespace y2018::actors {
using ::frc971::ProfileParametersT;
using ::aos::monotonic_clock;
@@ -599,5 +598,4 @@
return false;
}
-} // namespace actors
-} // namespace y2018
+} // namespace y2018::actors
diff --git a/y2018/constants.cc b/y2018/constants.cc
index 189ea5b..41c8f3a 100644
--- a/y2018/constants.cc
+++ b/y2018/constants.cc
@@ -20,8 +20,7 @@
#define M_PI 3.14159265358979323846
#endif
-namespace y2018 {
-namespace constants {
+namespace y2018::constants {
namespace {
const uint16_t kCompTeamNumber = 971;
@@ -163,5 +162,4 @@
return *values[team_number];
}
-} // namespace constants
-} // namespace y2018
+} // namespace y2018::constants
diff --git a/y2018/control_loops/drivetrain/drivetrain_base.cc b/y2018/control_loops/drivetrain/drivetrain_base.cc
index 9168b4b..92f460d 100644
--- a/y2018/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2018/control_loops/drivetrain/drivetrain_base.cc
@@ -13,9 +13,7 @@
namespace chrono = ::std::chrono;
-namespace y2018 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2018::control_loops::drivetrain {
using ::frc971::constants::ShifterHallEffect;
@@ -57,6 +55,4 @@
return kDrivetrainConfig;
};
-} // namespace drivetrain
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::drivetrain
diff --git a/y2018/control_loops/python/arm_bounds.cc b/y2018/control_loops/python/arm_bounds.cc
index 1515192..5338993 100644
--- a/y2018/control_loops/python/arm_bounds.cc
+++ b/y2018/control_loops/python/arm_bounds.cc
@@ -7,8 +7,7 @@
#include <cmath>
#include <iostream>
-namespace y2018 {
-namespace control_loops {
+namespace y2018::control_loops {
static BoundsCheck MakeArbitraryArmSpace(::std::vector<Point> points) {
for (Point &point : points) {
@@ -534,5 +533,4 @@
{1.8577014383575772, -1.7353804562372057}});
}
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops
diff --git a/y2018/control_loops/superstructure/arm/arm.cc b/y2018/control_loops/superstructure/arm/arm.cc
index 0749e3f..4e70022 100644
--- a/y2018/control_loops/superstructure/arm/arm.cc
+++ b/y2018/control_loops/superstructure/arm/arm.cc
@@ -10,10 +10,7 @@
#include "y2018/control_loops/superstructure/arm/arm_constants.h"
#include "y2018/control_loops/superstructure/arm/generated_graph.h"
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
-namespace arm {
+namespace y2018::control_loops::superstructure::arm {
namespace {
@@ -432,7 +429,4 @@
return status_builder.Finish();
}
-} // namespace arm
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure::arm
diff --git a/y2018/control_loops/superstructure/arm/trajectory_plot.cc b/y2018/control_loops/superstructure/arm/trajectory_plot.cc
index 7fdde3f..6739b07 100644
--- a/y2018/control_loops/superstructure/arm/trajectory_plot.cc
+++ b/y2018/control_loops/superstructure/arm/trajectory_plot.cc
@@ -12,10 +12,7 @@
DEFINE_bool(plot, true, "If true, plot");
DEFINE_bool(plot_thetas, true, "If true, plot the angles");
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
-namespace arm {
+namespace y2018::control_loops::superstructure::arm {
void Main() {
frc971::control_loops::arm::Dynamics dynamics(kArmConstants);
@@ -355,10 +352,7 @@
}
}
-} // namespace arm
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure::arm
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2018/control_loops/superstructure/debouncer.cc b/y2018/control_loops/superstructure/debouncer.cc
index 40b730d..98e80f3 100644
--- a/y2018/control_loops/superstructure/debouncer.cc
+++ b/y2018/control_loops/superstructure/debouncer.cc
@@ -1,8 +1,6 @@
#include "y2018/control_loops/superstructure/debouncer.h"
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
+namespace y2018::control_loops::superstructure {
void Debouncer::Update(bool new_state) {
// If the incoming state is different from the one we have stored, increment
@@ -20,6 +18,4 @@
}
}
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure
diff --git a/y2018/control_loops/superstructure/debouncer.h b/y2018/control_loops/superstructure/debouncer.h
index ad46b51..381f2f2 100644
--- a/y2018/control_loops/superstructure/debouncer.h
+++ b/y2018/control_loops/superstructure/debouncer.h
@@ -1,12 +1,10 @@
#ifndef Y2018_CONTROL_LOOPS_SUPERSTRUCTURE_DEBOUNCER_H_
#define Y2018_CONTROL_LOOPS_SUPERSTRUCTURE_DEBOUNCER_H_
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
+namespace y2018::control_loops::superstructure {
-// Ensures that a certain number of states of a certain type are recieved before
-// the actual state is changed.
+// Ensures that a certain number of states of a certain type are recieved
+// before the actual state is changed.
class Debouncer {
public:
// Parameters:
@@ -37,8 +35,6 @@
int consistent_count_ = 0;
};
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure
#endif // Y2018_CONTROL_LOOPS_SUPERSTRUCTURE_DEBOUNCER_H_
diff --git a/y2018/control_loops/superstructure/debouncer_test.cc b/y2018/control_loops/superstructure/debouncer_test.cc
index 2f56d56..ba3bd87 100644
--- a/y2018/control_loops/superstructure/debouncer_test.cc
+++ b/y2018/control_loops/superstructure/debouncer_test.cc
@@ -2,10 +2,7 @@
#include "gtest/gtest.h"
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
-namespace testing {
+namespace y2018::control_loops::superstructure::testing {
// Tests that the debouncer behaves as it should. This tests the following:
// - The debouncer changes its internal state after the desired number of
@@ -53,7 +50,4 @@
EXPECT_EQ(true, bouncer.current_state());
}
-} // namespace testing
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure::testing
diff --git a/y2018/control_loops/superstructure/intake/intake.cc b/y2018/control_loops/superstructure/intake/intake.cc
index edefca4..4c96de0 100644
--- a/y2018/control_loops/superstructure/intake/intake.cc
+++ b/y2018/control_loops/superstructure/intake/intake.cc
@@ -8,10 +8,7 @@
#include "y2018/control_loops/superstructure/intake/intake_delayed_plant.h"
#include "y2018/control_loops/superstructure/intake/intake_plant.h"
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
-namespace intake {
+namespace y2018::control_loops::superstructure::intake {
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -179,7 +176,4 @@
return status_builder.Finish();
}
-} // namespace intake
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure::intake
diff --git a/y2018/control_loops/superstructure/superstructure.cc b/y2018/control_loops/superstructure/superstructure.cc
index fc08280..f0748fa 100644
--- a/y2018/control_loops/superstructure/superstructure.cc
+++ b/y2018/control_loops/superstructure/superstructure.cc
@@ -10,9 +10,7 @@
#include "y2018/status_light_generated.h"
#include "y2018/vision/vision_generated.h"
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
+namespace y2018::control_loops::superstructure {
using ::aos::monotonic_clock;
@@ -350,6 +348,4 @@
}
}
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure
diff --git a/y2018/control_loops/superstructure/superstructure_lib_test.cc b/y2018/control_loops/superstructure/superstructure_lib_test.cc
index b142420..fdd467b 100644
--- a/y2018/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2018/control_loops/superstructure/superstructure_lib_test.cc
@@ -19,10 +19,7 @@
using ::frc971::control_loops::PositionSensorSimulator;
-namespace y2018 {
-namespace control_loops {
-namespace superstructure {
-namespace testing {
+namespace y2018::control_loops::superstructure::testing {
namespace {
constexpr double kNoiseScalar = 0.01;
} // namespace
@@ -786,7 +783,4 @@
// TODO(austin): Test multiple path segments.
// TODO(austin): Disable in the middle and test recovery.
-} // namespace testing
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2018
+} // namespace y2018::control_loops::superstructure::testing
diff --git a/y2018/joystick_reader.cc b/y2018/joystick_reader.cc
index 7e25bb3..351d1f5 100644
--- a/y2018/joystick_reader.cc
+++ b/y2018/joystick_reader.cc
@@ -38,9 +38,7 @@
using ::y2018::control_loops::superstructure::arm::BackPoints;
using ::y2018::control_loops::superstructure::arm::FrontPoints;
-namespace y2018 {
-namespace input {
-namespace joysticks {
+namespace y2018::input::joysticks {
namespace arm = ::y2018::control_loops::superstructure::arm;
@@ -386,9 +384,7 @@
::std::unique_ptr<ProtoTXUdpSocket<VisionControl>> video_tx_;
};
-} // namespace joysticks
-} // namespace input
-} // namespace y2018
+} // namespace y2018::input::joysticks
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2018/vision/vision_status.cc b/y2018/vision/vision_status.cc
index ef3fd5a..ec5ea55 100644
--- a/y2018/vision/vision_status.cc
+++ b/y2018/vision/vision_status.cc
@@ -8,8 +8,7 @@
#include "y2018/vision.pb.h"
#include "y2018/vision/vision_generated.h"
-namespace y2018 {
-namespace vision {
+namespace y2018::vision {
using aos::monotonic_clock;
@@ -43,8 +42,7 @@
}
}
-} // namespace vision
-} // namespace y2018
+} // namespace y2018::vision
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2018/wpilib_interface.cc b/y2018/wpilib_interface.cc
index cf71bdd..32ef7a9 100644
--- a/y2018/wpilib_interface.cc
+++ b/y2018/wpilib_interface.cc
@@ -63,8 +63,7 @@
namespace chrono = ::std::chrono;
namespace superstructure = ::y2018::control_loops::superstructure;
-namespace y2018 {
-namespace wpilib {
+namespace y2018::wpilib {
namespace {
constexpr double kMaxBringupPower = 12.0;
@@ -779,7 +778,6 @@
};
} // namespace
-} // namespace wpilib
-} // namespace y2018
+} // namespace y2018::wpilib
AOS_ROBOT_CLASS(::y2018::wpilib::WPILibRobot);