Nest some more namespaces
Did someone previously suggest that all namespace had been
nested? Silly.
Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: I22278c1caaeba8b47dc46fb2ed3078c20a11e190
diff --git a/frc971/wpilib/ADIS16448.h b/frc971/wpilib/ADIS16448.h
index 6d5eb28..ed8e091 100644
--- a/frc971/wpilib/ADIS16448.h
+++ b/frc971/wpilib/ADIS16448.h
@@ -17,8 +17,7 @@
#include "frc971/wpilib/imu_generated.h"
#include "frc971/wpilib/spi_rx_clearer.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Handles interfacing with an Analog Devices ADIS16448 Inertial Sensor over
// SPI and sending values out on a queue.
@@ -100,7 +99,6 @@
FpgaTimeConverter time_converter_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_ADIS16448_H_
diff --git a/frc971/wpilib/ADIS16470.h b/frc971/wpilib/ADIS16470.h
index 35bcb06..c15ca5b 100644
--- a/frc971/wpilib/ADIS16470.h
+++ b/frc971/wpilib/ADIS16470.h
@@ -12,8 +12,7 @@
#include "frc971/wpilib/imu_batch_generated.h"
#include "frc971/wpilib/imu_generated.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Handles interfacing with an Analog Devices ADIS16470 over SPI and sending the
// resulting values out on a channel.
@@ -93,7 +92,6 @@
FpgaTimeConverter time_converter_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_ADIS16470_H_
diff --git a/frc971/wpilib/buffered_pcm.h b/frc971/wpilib/buffered_pcm.h
index f743371..4933c25 100644
--- a/frc971/wpilib/buffered_pcm.h
+++ b/frc971/wpilib/buffered_pcm.h
@@ -7,8 +7,7 @@
#include "frc971/wpilib/buffered_solenoid.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Manages setting values for all solenoids for a single PCM in a single CAN
// message.
@@ -43,7 +42,6 @@
friend class BufferedSolenoid;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_BUFFERED_PCM_H_
diff --git a/frc971/wpilib/can_drivetrain_writer.h b/frc971/wpilib/can_drivetrain_writer.h
index 1c0ba95..987605d 100644
--- a/frc971/wpilib/can_drivetrain_writer.h
+++ b/frc971/wpilib/can_drivetrain_writer.h
@@ -3,8 +3,7 @@
#include "frc971/wpilib/loop_output_handler.h"
#include "frc971/wpilib/talonfx.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class CANDrivetrainWriter : public ::frc971::wpilib::LoopOutputHandler<
::frc971::control_loops::drivetrain::Output> {
@@ -30,5 +29,4 @@
std::vector<std::shared_ptr<TalonFX>> left_talonfxs_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
diff --git a/frc971/wpilib/can_sensor_reader.h b/frc971/wpilib/can_sensor_reader.h
index 8ef5fd1..8eddfca 100644
--- a/frc971/wpilib/can_sensor_reader.h
+++ b/frc971/wpilib/can_sensor_reader.h
@@ -9,8 +9,7 @@
#include "aos/realtime.h"
#include "frc971/wpilib/talonfx.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class CANSensorReader {
public:
CANSensorReader(
@@ -37,6 +36,5 @@
// Callback used to send the CANPosition flatbuffer
std::function<void(ctre::phoenix::StatusCode status)> flatbuffer_callback_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_CAN_SENSOR_READER_H_
diff --git a/frc971/wpilib/dma_edge_counting.h b/frc971/wpilib/dma_edge_counting.h
index f51318d..eda77f0 100644
--- a/frc971/wpilib/dma_edge_counting.h
+++ b/frc971/wpilib/dma_edge_counting.h
@@ -14,8 +14,7 @@
#include "frc971/wpilib/dma.h"
#undef ERROR
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Generic interface for classes that do something with DMA samples and also
// poll current sensor values.
@@ -280,7 +279,6 @@
DISALLOW_COPY_AND_ASSIGN(DMASynchronizer);
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_DMA_EDGE_COUNTING_H_
diff --git a/frc971/wpilib/drivetrain_writer.h b/frc971/wpilib/drivetrain_writer.h
index 195b5a3..e83585e 100644
--- a/frc971/wpilib/drivetrain_writer.h
+++ b/frc971/wpilib/drivetrain_writer.h
@@ -6,8 +6,7 @@
#include "frc971/wpilib/ahal/PWM.h"
#include "frc971/wpilib/loop_output_handler.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class DrivetrainWriter : public ::frc971::wpilib::LoopOutputHandler<
::frc971::control_loops::drivetrain::Output> {
@@ -56,7 +55,6 @@
bool reversed_right0_, reversed_left0_, reversed_right1_, reversed_left1_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_DRIVETRAIN_WRITER_H_
diff --git a/frc971/wpilib/encoder_and_potentiometer.h b/frc971/wpilib/encoder_and_potentiometer.h
index 7ee85e1..a5eac24 100644
--- a/frc971/wpilib/encoder_and_potentiometer.h
+++ b/frc971/wpilib/encoder_and_potentiometer.h
@@ -14,8 +14,7 @@
#include "frc971/wpilib/dma.h"
#include "frc971/wpilib/dma_edge_counting.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Latches values from an encoder on positive edges from another input using
// DMA.
@@ -244,7 +243,6 @@
::std::unique_ptr<frc::Encoder> encoder_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_ENCODER_AND_POTENTIOMETER_H_
diff --git a/frc971/wpilib/fpga_time_conversion.h b/frc971/wpilib/fpga_time_conversion.h
index 51cc7a9..c279089 100644
--- a/frc971/wpilib/fpga_time_conversion.h
+++ b/frc971/wpilib/fpga_time_conversion.h
@@ -9,8 +9,7 @@
#include "aos/time/time.h"
#include "hal/cpp/fpga_clock.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Returns the offset from the monotonic clock to the FPGA time. This is defined
// as `fpga_time - monotonic_time`.
@@ -51,7 +50,6 @@
std::chrono::nanoseconds offset_ = std::chrono::nanoseconds::min();
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_FPGA_TIME_CONVERSION_H_
diff --git a/frc971/wpilib/generic_can_writer.h b/frc971/wpilib/generic_can_writer.h
index 7d6dd1a..d339324 100644
--- a/frc971/wpilib/generic_can_writer.h
+++ b/frc971/wpilib/generic_can_writer.h
@@ -5,8 +5,7 @@
#include "frc971/wpilib/loop_output_handler.h"
#include "frc971/wpilib/talonfx.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
/// This class uses a callback whenever it writes so that the caller can use any
/// flatbuffer to write to the talonfx motor.
@@ -70,5 +69,4 @@
write_callback_;
};
-} // namespace wpilib
-} // namespace frc971
\ No newline at end of file
+} // namespace frc971::wpilib
diff --git a/frc971/wpilib/gyro_interface.h b/frc971/wpilib/gyro_interface.h
index 3568a47..0c6b519 100644
--- a/frc971/wpilib/gyro_interface.h
+++ b/frc971/wpilib/gyro_interface.h
@@ -6,8 +6,7 @@
#include "frc971/wpilib/ahal/SPI.h"
#undef ERROR
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class GyroInterface {
public:
@@ -50,7 +49,6 @@
::std::unique_ptr<frc::SPI> gyro_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_GYRO_INTERFACE_H_
diff --git a/frc971/wpilib/gyro_sender.h b/frc971/wpilib/gyro_sender.h
index 4abfeaa..1c3f5d6 100644
--- a/frc971/wpilib/gyro_sender.h
+++ b/frc971/wpilib/gyro_sender.h
@@ -12,8 +12,7 @@
#include "frc971/wpilib/gyro_interface.h"
#include "frc971/zeroing/averager.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Handles reading the gyro over SPI and sending out angles on a queue.
//
@@ -56,7 +55,6 @@
bool zeroed_ = false;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_GYRO_H_
diff --git a/frc971/wpilib/interrupt_edge_counting.h b/frc971/wpilib/interrupt_edge_counting.h
index 5ea8df5..5d64582 100644
--- a/frc971/wpilib/interrupt_edge_counting.h
+++ b/frc971/wpilib/interrupt_edge_counting.h
@@ -12,8 +12,7 @@
#include "frc971/wpilib/ahal/DigitalInput.h"
#include "frc971/wpilib/ahal/Encoder.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class InterruptSynchronizer;
@@ -226,7 +225,6 @@
DISALLOW_COPY_AND_ASSIGN(InterruptSynchronizer);
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_INTERRUPT_EDGE_COUNTING_H_
diff --git a/frc971/wpilib/joystick_sender.h b/frc971/wpilib/joystick_sender.h
index c9eb4cd..0591a8e 100644
--- a/frc971/wpilib/joystick_sender.h
+++ b/frc971/wpilib/joystick_sender.h
@@ -6,8 +6,7 @@
#include "aos/events/shm_event_loop.h"
#include "frc971/input/joystick_state_generated.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class JoystickSender {
public:
@@ -19,7 +18,6 @@
const uint16_t team_id_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_JOYSTICK_SENDER_H_
diff --git a/frc971/wpilib/loop_output_handler.h b/frc971/wpilib/loop_output_handler.h
index 5f66a4c..1fb46b2 100644
--- a/frc971/wpilib/loop_output_handler.h
+++ b/frc971/wpilib/loop_output_handler.h
@@ -9,8 +9,7 @@
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Handles sending the output from a single control loop to the hardware.
//
@@ -64,7 +63,6 @@
::aos::TimerHandler *timer_handler_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_LOOP_OUTPUT_HANDLER_H_
diff --git a/frc971/wpilib/pdp_fetcher.h b/frc971/wpilib/pdp_fetcher.h
index 72f6745..38c4a5b 100644
--- a/frc971/wpilib/pdp_fetcher.h
+++ b/frc971/wpilib/pdp_fetcher.h
@@ -12,8 +12,7 @@
class PowerDistributionPanel;
} // namespace frc
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Handles fetching values from the PDP.
class PDPFetcher {
@@ -32,7 +31,6 @@
::std::unique_ptr<::frc::PowerDistributionPanel> pdp_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_PDP_FETCHER_H_
diff --git a/frc971/wpilib/sensor_reader.h b/frc971/wpilib/sensor_reader.h
index bf8c96a..455ed0e 100644
--- a/frc971/wpilib/sensor_reader.h
+++ b/frc971/wpilib/sensor_reader.h
@@ -21,8 +21,7 @@
using ::aos::monotonic_clock;
namespace chrono = ::std::chrono;
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class SensorReader {
public:
@@ -264,7 +263,6 @@
chrono::microseconds period_ = chrono::microseconds(5000);
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_SENSOR_READER_H_
diff --git a/frc971/wpilib/spi_rx_clearer.h b/frc971/wpilib/spi_rx_clearer.h
index e385d21..733cf6f 100644
--- a/frc971/wpilib/spi_rx_clearer.h
+++ b/frc971/wpilib/spi_rx_clearer.h
@@ -3,8 +3,7 @@
#include <cstdint>
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Allows clearing the RX FIFO of the roboRIO's SPI peripheral on demand. This
// is necessary to work around a driver bug. See
@@ -35,7 +34,6 @@
bool RxFifoIsEmpty() { return !(ReadRegister(4) & (1 << 4)); }
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_SPI_RX_CLEARER_H_
diff --git a/frc971/wpilib/swerve/swerve_drivetrain_writer.h b/frc971/wpilib/swerve/swerve_drivetrain_writer.h
index d02d4dc..8e9e616 100644
--- a/frc971/wpilib/swerve/swerve_drivetrain_writer.h
+++ b/frc971/wpilib/swerve/swerve_drivetrain_writer.h
@@ -9,9 +9,7 @@
#include "frc971/wpilib/swerve/swerve_module.h"
#include "frc971/wpilib/talonfx.h"
-namespace frc971 {
-namespace wpilib {
-namespace swerve {
+namespace frc971::wpilib::swerve {
// Reads from the swerve output flatbuffer and uses wpilib to set the current
// for each motor.
@@ -45,8 +43,6 @@
double max_voltage_;
};
-} // namespace swerve
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib::swerve
#endif // FRC971_WPILIB_SWERVE_DRIVETRAIN_WRITER_H_
diff --git a/frc971/wpilib/swerve/swerve_module.h b/frc971/wpilib/swerve/swerve_module.h
index d65547a..c373a31 100644
--- a/frc971/wpilib/swerve/swerve_module.h
+++ b/frc971/wpilib/swerve/swerve_module.h
@@ -3,9 +3,7 @@
#include "frc971/wpilib/talonfx.h"
-namespace frc971 {
-namespace wpilib {
-namespace swerve {
+namespace frc971::wpilib::swerve {
struct SwerveModule {
SwerveModule(TalonFXParams rotation_params, TalonFXParams translation_params,
@@ -39,7 +37,5 @@
std::shared_ptr<TalonFX> translation;
};
-} // namespace swerve
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib::swerve
#endif // FRC971_WPILIB_SWERVE_SWERVE_MODULE_H_
diff --git a/frc971/wpilib/talonfx.h b/frc971/wpilib/talonfx.h
index c25fa81..a3e3066 100644
--- a/frc971/wpilib/talonfx.h
+++ b/frc971/wpilib/talonfx.h
@@ -15,8 +15,7 @@
namespace control_loops = ::frc971::control_loops;
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
struct TalonFXParams {
int device_id;
@@ -100,6 +99,5 @@
double stator_current_limit_;
double supply_current_limit_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_TALONFX_MOTOR_H_
diff --git a/frc971/wpilib/wpilib_interface.h b/frc971/wpilib/wpilib_interface.h
index b992aa3..1d64d2c 100644
--- a/frc971/wpilib/wpilib_interface.h
+++ b/frc971/wpilib/wpilib_interface.h
@@ -6,14 +6,12 @@
#include "aos/events/event_loop.h"
#include "frc971/input/robot_state_generated.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Sends out a message on ::aos::robot_state.
flatbuffers::Offset<aos::RobotState> PopulateRobotState(
aos::Sender<::aos::RobotState>::Builder *builder, int32_t my_pid);
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_WPILIB_INTERFACE_H_
diff --git a/frc971/wpilib/wpilib_robot_base.h b/frc971/wpilib/wpilib_robot_base.h
index 6b9e5c5..27c1bcd 100644
--- a/frc971/wpilib/wpilib_robot_base.h
+++ b/frc971/wpilib/wpilib_robot_base.h
@@ -6,8 +6,7 @@
#include "aos/logging/logging.h"
#include "frc971/wpilib/ahal/RobotBase.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
class WPILibRobotBase {
public:
@@ -81,7 +80,6 @@
T robot_;
};
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_NEWROBOTBASE_H_
diff --git a/frc971/wpilib/wpilib_utils.h b/frc971/wpilib/wpilib_utils.h
index 78dd262..0600f66 100644
--- a/frc971/wpilib/wpilib_utils.h
+++ b/frc971/wpilib/wpilib_utils.h
@@ -5,8 +5,7 @@
#include "frc971/constants.h"
-namespace frc971 {
-namespace wpilib {
+namespace frc971::wpilib {
// Convert min and max angle positions from range to voltage and compare to
// min and max potentiometer voltage to check if in range.
@@ -22,7 +21,6 @@
::std::function<double(double)> pot_translate_inverse,
bool reverse, double limit_buffer = 0.05);
-} // namespace wpilib
-} // namespace frc971
+} // namespace frc971::wpilib
#endif // FRC971_WPILIB_WPILIB_UTILS_H_
\ No newline at end of file