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/y2017/actors/autonomous_actor.cc b/y2017/actors/autonomous_actor.cc
index 19aa329..f67f0d7 100644
--- a/y2017/actors/autonomous_actor.cc
+++ b/y2017/actors/autonomous_actor.cc
@@ -8,8 +8,7 @@
#include "aos/util/phased_loop.h"
#include "y2017/control_loops/drivetrain/drivetrain_base.h"
-namespace y2017 {
-namespace actors {
+namespace y2017::actors {
using ::aos::monotonic_clock;
using ::frc971::ProfileParametersT;
namespace chrono = ::std::chrono;
@@ -321,5 +320,4 @@
return true;
}
-} // namespace actors
-} // namespace y2017
+} // namespace y2017::actors
diff --git a/y2017/constants.cc b/y2017/constants.cc
index b27c3b7..d599772 100644
--- a/y2017/constants.cc
+++ b/y2017/constants.cc
@@ -21,8 +21,7 @@
#define M_PI 3.14159265358979323846
#endif
-namespace y2017 {
-namespace constants {
+namespace y2017::constants {
const int Values::kZeroingSampleSize;
@@ -194,5 +193,4 @@
Blend(coefficient, a1.indexer_velocity, a2.indexer_velocity)};
}
-} // namespace constants
-} // namespace y2017
+} // namespace y2017::constants
diff --git a/y2017/control_loops/drivetrain/drivetrain_base.cc b/y2017/control_loops/drivetrain/drivetrain_base.cc
index ea985d7..1569e34 100644
--- a/y2017/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2017/control_loops/drivetrain/drivetrain_base.cc
@@ -14,9 +14,7 @@
namespace chrono = ::std::chrono;
-namespace y2017 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2017::control_loops::drivetrain {
using ::frc971::constants::ShifterHallEffect;
@@ -56,6 +54,4 @@
return kDrivetrainConfig;
};
-} // namespace drivetrain
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::drivetrain
diff --git a/y2017/control_loops/superstructure/column/column.cc b/y2017/control_loops/superstructure/column/column.cc
index b8a12f7..6583357 100644
--- a/y2017/control_loops/superstructure/column/column.cc
+++ b/y2017/control_loops/superstructure/column/column.cc
@@ -15,10 +15,7 @@
#include "y2017/control_loops/superstructure/column/column_integral_plant.h"
#include "y2017/control_loops/superstructure/column/stuck_column_integral_plant.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
-namespace column {
+namespace y2017::control_loops::superstructure::column {
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -692,7 +689,4 @@
return std::make_pair(indexer_status_offset, turret_status_offset);
}
-} // namespace column
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure::column
diff --git a/y2017/control_loops/superstructure/column/column_zeroing.cc b/y2017/control_loops/superstructure/column/column_zeroing.cc
index 53bec5f..68cdd61 100644
--- a/y2017/control_loops/superstructure/column/column_zeroing.cc
+++ b/y2017/control_loops/superstructure/column/column_zeroing.cc
@@ -2,10 +2,7 @@
#include "frc971/zeroing/wrap.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
-namespace column {
+namespace y2017::control_loops::superstructure::column {
ColumnZeroingEstimator::ColumnZeroingEstimator(
const ZeroingConstants &column_constants)
@@ -82,7 +79,4 @@
return state_builder.Finish();
}
-} // namespace column
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure::column
diff --git a/y2017/control_loops/superstructure/column/column_zeroing_test.cc b/y2017/control_loops/superstructure/column/column_zeroing_test.cc
index ef32beb..2edcab2 100644
--- a/y2017/control_loops/superstructure/column/column_zeroing_test.cc
+++ b/y2017/control_loops/superstructure/column/column_zeroing_test.cc
@@ -16,10 +16,7 @@
#include "frc971/zeroing/zeroing.h"
#include "y2017/constants.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
-namespace column {
+namespace y2017::control_loops::superstructure::column {
using ::frc971::HallEffectAndPosition;
using ::frc971::control_loops::PositionSensorSimulator;
@@ -136,7 +133,4 @@
EXPECT_TRUE(column_zeroing_estimator_.zeroed());
}
-} // namespace column
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure::column
diff --git a/y2017/control_loops/superstructure/hood/hood.cc b/y2017/control_loops/superstructure/hood/hood.cc
index 4f1a4eb..a8c1aa6 100644
--- a/y2017/control_loops/superstructure/hood/hood.cc
+++ b/y2017/control_loops/superstructure/hood/hood.cc
@@ -3,10 +3,7 @@
#include "y2017/constants.h"
#include "y2017/control_loops/superstructure/hood/hood_integral_plant.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
-namespace hood {
+namespace y2017::control_loops::superstructure::hood {
namespace chrono = ::std::chrono;
@@ -215,7 +212,4 @@
return status_builder.Finish();
}
-} // namespace hood
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure::hood
diff --git a/y2017/control_loops/superstructure/intake/intake.cc b/y2017/control_loops/superstructure/intake/intake.cc
index ee631d7..dfcaf31 100644
--- a/y2017/control_loops/superstructure/intake/intake.cc
+++ b/y2017/control_loops/superstructure/intake/intake.cc
@@ -3,10 +3,7 @@
#include "y2017/constants.h"
#include "y2017/control_loops/superstructure/intake/intake_integral_plant.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
-namespace intake {
+namespace y2017::control_loops::superstructure::intake {
constexpr double Intake::kZeroingVoltage;
constexpr double Intake::kOperatingVoltage;
@@ -146,7 +143,4 @@
return status_builder.Finish();
}
-} // namespace intake
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure::intake
diff --git a/y2017/control_loops/superstructure/shooter/shooter.cc b/y2017/control_loops/superstructure/shooter/shooter.cc
index 8a2dcb9..135b089 100644
--- a/y2017/control_loops/superstructure/shooter/shooter.cc
+++ b/y2017/control_loops/superstructure/shooter/shooter.cc
@@ -4,10 +4,7 @@
#include "aos/logging/logging.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
-namespace shooter {
+namespace y2017::control_loops::superstructure::shooter {
namespace chrono = ::std::chrono;
using ::aos::monotonic_clock;
@@ -156,7 +153,4 @@
return status_offset;
}
-} // namespace shooter
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure::shooter
diff --git a/y2017/control_loops/superstructure/superstructure.cc b/y2017/control_loops/superstructure/superstructure.cc
index 84da59c..5cf3f9f 100644
--- a/y2017/control_loops/superstructure/superstructure.cc
+++ b/y2017/control_loops/superstructure/superstructure.cc
@@ -9,9 +9,7 @@
#include "y2017/control_loops/superstructure/shooter/shooter.h"
#include "y2017/vision/vision_generated.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
+namespace y2017::control_loops::superstructure {
namespace {
// The maximum voltage the intake roller will be allowed to use.
@@ -266,6 +264,4 @@
(void)status->Send(status_builder.Finish());
}
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure
diff --git a/y2017/control_loops/superstructure/superstructure_lib_test.cc b/y2017/control_loops/superstructure/superstructure_lib_test.cc
index e7fd0ff..60f4612 100644
--- a/y2017/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2017/control_loops/superstructure/superstructure_lib_test.cc
@@ -17,10 +17,7 @@
using ::frc971::control_loops::PositionSensorSimulator;
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
-namespace testing {
+namespace y2017::control_loops::superstructure::testing {
namespace {
constexpr double kNoiseScalar = 0.01;
} // namespace
@@ -1738,7 +1735,4 @@
// TODO(austin): Indexer zeroing error detection.
// TODO(austin): Detect detached turret encoder
-} // namespace testing
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure::testing
diff --git a/y2017/control_loops/superstructure/vision_distance_average_test.cc b/y2017/control_loops/superstructure/vision_distance_average_test.cc
index e1a406b..93c1063 100644
--- a/y2017/control_loops/superstructure/vision_distance_average_test.cc
+++ b/y2017/control_loops/superstructure/vision_distance_average_test.cc
@@ -4,9 +4,7 @@
#include "aos/flatbuffers.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
+namespace y2017::control_loops::superstructure {
class VisionDistanceAverageTest : public ::testing::Test {
public:
@@ -73,6 +71,4 @@
EXPECT_FALSE(average()->Valid());
}
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure
diff --git a/y2017/control_loops/superstructure/vision_time_adjuster.cc b/y2017/control_loops/superstructure/vision_time_adjuster.cc
index 6684546..2fb646c 100644
--- a/y2017/control_loops/superstructure/vision_time_adjuster.cc
+++ b/y2017/control_loops/superstructure/vision_time_adjuster.cc
@@ -5,9 +5,7 @@
#include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
#include "y2017/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
+namespace y2017::control_loops::superstructure {
using ::aos::monotonic_clock;
namespace chrono = ::std::chrono;
@@ -162,6 +160,4 @@
}
}
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure
diff --git a/y2017/control_loops/superstructure/vision_time_adjuster_test.cc b/y2017/control_loops/superstructure/vision_time_adjuster_test.cc
index 125a960..4811c97 100644
--- a/y2017/control_loops/superstructure/vision_time_adjuster_test.cc
+++ b/y2017/control_loops/superstructure/vision_time_adjuster_test.cc
@@ -10,9 +10,7 @@
#include "y2017/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
#include "y2017/vision/vision_generated.h"
-namespace y2017 {
-namespace control_loops {
-namespace superstructure {
+namespace y2017::control_loops::superstructure {
class VisionTimeAdjusterTest : public ::testing::Test {
public:
@@ -223,6 +221,4 @@
}
}
-} // namespace superstructure
-} // namespace control_loops
-} // namespace y2017
+} // namespace y2017::control_loops::superstructure
diff --git a/y2017/joystick_reader.cc b/y2017/joystick_reader.cc
index 7cd2aaf..78f81c7 100644
--- a/y2017/joystick_reader.cc
+++ b/y2017/joystick_reader.cc
@@ -24,9 +24,7 @@
using ::frc971::input::driver_station::JoystickAxis;
using ::frc971::input::driver_station::POVLocation;
-namespace y2017 {
-namespace input {
-namespace joysticks {
+namespace y2017::input::joysticks {
namespace superstructure = control_loops::superstructure;
@@ -317,9 +315,7 @@
bool fire_ = false;
};
-} // namespace joysticks
-} // namespace input
-} // namespace y2017
+} // namespace y2017::input::joysticks
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2017/vision/debug_viewer.cc b/y2017/vision/debug_viewer.cc
index 79b9800..073f8e5 100644
--- a/y2017/vision/debug_viewer.cc
+++ b/y2017/vision/debug_viewer.cc
@@ -14,8 +14,7 @@
using aos::vision::ImageRange;
using aos::vision::RangeImage;
-namespace y2017 {
-namespace vision {
+namespace y2017::vision {
BlobList RenderTargetListShifted(const std::vector<TargetComponent> &list) {
BlobList out;
@@ -120,8 +119,7 @@
std::vector<aos::vision::OverlayBase *> overlays_;
};
-} // namespace vision
-} // namespace y2017
+} // namespace y2017::vision
int main(int argc, char **argv) {
y2017::vision::FilterHarnessExample filter_harness;
diff --git a/y2017/vision/target_finder.cc b/y2017/vision/target_finder.cc
index e917b2e..640c7fe 100644
--- a/y2017/vision/target_finder.cc
+++ b/y2017/vision/target_finder.cc
@@ -2,8 +2,7 @@
#include <cmath>
-namespace y2017 {
-namespace vision {
+namespace y2017::vision {
// Blobs now come in three types:
// 0) normal blob.
@@ -276,5 +275,4 @@
*angle = -std::atan2(px, pz);
}
-} // namespace vision
-} // namespace y2017
+} // namespace y2017::vision
diff --git a/y2017/vision/target_receiver.cc b/y2017/vision/target_receiver.cc
index f21fe4e..fd9f7d8 100644
--- a/y2017/vision/target_receiver.cc
+++ b/y2017/vision/target_receiver.cc
@@ -9,8 +9,7 @@
#include "y2017/vision/vision_generated.h"
#include "y2017/vision/vision_result.pb.h"
-namespace y2017 {
-namespace vision {
+namespace y2017::vision {
using aos::monotonic_clock;
@@ -70,8 +69,7 @@
}
}
-} // namespace vision
-} // namespace y2017
+} // namespace y2017::vision
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
diff --git a/y2017/vision/target_sender.cc b/y2017/vision/target_sender.cc
index a198cd2..1e6e049 100644
--- a/y2017/vision/target_sender.cc
+++ b/y2017/vision/target_sender.cc
@@ -27,8 +27,7 @@
#include "y2017/vision/vision_config.pb.h"
#include "y2017/vision/vision_result.pb.h"
-namespace y2017 {
-namespace vision {
+namespace y2017::vision {
using aos::events::DataSocket;
using aos::events::TCPServer;
@@ -215,8 +214,7 @@
return true;
}
-} // namespace vision
-} // namespace y2017
+} // namespace y2017::vision
int main(int, char **) {
using namespace y2017::vision;
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index 822c3f4..f1205f3 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/wpilib_interface.cc
@@ -67,8 +67,7 @@
using namespace frc;
using std::make_unique;
-namespace y2017 {
-namespace wpilib {
+namespace y2017::wpilib {
namespace {
constexpr double kMaxBringupPower = 12.0;
@@ -549,7 +548,6 @@
};
} // namespace
-} // namespace wpilib
-} // namespace y2017
+} // namespace y2017::wpilib
AOS_ROBOT_CLASS(::y2017::wpilib::WPILibRobot);