Removal of aos::make_unique and its usages
Signed-off-by: Vinay Siva <100024232@mvla.net>
Change-Id: I2aca0e9e20f84d3c4944e1360a8a25c265264dbb
Signed-off-by: Vinay Siva <100024232@mvla.net>
diff --git a/aos/make_unique.h b/aos/make_unique.h
deleted file mode 100644
index 8031f45..0000000
--- a/aos/make_unique.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef AOS_MAKE_UNIQUE_H_
-#define AOS_MAKE_UNIQUE_H_
-
-// TODO(brian): Replace this file with ::std::make_unique once all our
-// toolchains have support.
-
-namespace aos {
-
-/// Constructs a `new T()` with the given args and returns a
-/// `unique_ptr<T>` which owns the object.
-///
-/// Example:
-///
-/// auto p = make_unique<int>();
-/// auto p = make_unique<std::tuple<int, int>>(0, 1);
-template <class T, class... Args>
-typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
-make_unique(Args &&... args) {
- return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-/// Constructs a `new T[n]` with the given args and returns a
-/// `unique_ptr<T[]>` which owns the object.
-///
-/// \param n size of the new array.
-///
-/// Example:
-///
-/// auto p = make_unique<int[]>(2); // value-initializes the array with 0's.
-template <class T>
-typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0,
- std::unique_ptr<T>>::type
-make_unique(size_t n) {
- return std::unique_ptr<T>(new typename std::remove_extent<T>::type[n]());
-}
-
-/// This function isn't used and is only here to provide better compile errors.
-template <class T, class... Args>
-typename std::enable_if<std::extent<T>::value != 0>::type
-make_unique(Args &&...) = delete;
-
-} // namespace aos
-
-#endif // AOS_MAKE_UNIQUE_H_
diff --git a/frc971/wpilib/ahal/BUILD b/frc971/wpilib/ahal/BUILD
index 350aa90..510a072 100644
--- a/frc971/wpilib/ahal/BUILD
+++ b/frc971/wpilib/ahal/BUILD
@@ -18,7 +18,6 @@
target_compatible_with = ["//tools/platforms/hardware:roborio"],
visibility = ["//third_party:__pkg__"],
deps = [
- "//aos:make_unique",
"//aos:realtime",
"//aos/logging",
"//third_party:wpilib_hal",
diff --git a/frc971/wpilib/ahal/DriverStation.cc b/frc971/wpilib/ahal/DriverStation.cc
index 8420a9e..9ea1f7a 100644
--- a/frc971/wpilib/ahal/DriverStation.cc
+++ b/frc971/wpilib/ahal/DriverStation.cc
@@ -8,9 +8,9 @@
#include "frc971/wpilib/ahal/DriverStation.h"
#include <chrono>
+#include <memory>
#include "FRC_NetworkCommunication/FRCComm.h"
-#include "aos/make_unique.h"
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Utility.h"
#include "frc971/wpilib/ahal/WPIErrors.h"
@@ -399,17 +399,17 @@
// DS, and if the DS thinks you don't have robot code, then you can't enable).
HAL_ObserveUserProgramStarting();
- m_joystickAxes = aos::make_unique<HAL_JoystickAxes[]>(kJoystickPorts);
- m_joystickPOVs = aos::make_unique<HAL_JoystickPOVs[]>(kJoystickPorts);
- m_joystickButtons = aos::make_unique<HAL_JoystickButtons[]>(kJoystickPorts);
+ m_joystickAxes = std::make_unique<HAL_JoystickAxes[]>(kJoystickPorts);
+ m_joystickPOVs = std::make_unique<HAL_JoystickPOVs[]>(kJoystickPorts);
+ m_joystickButtons = std::make_unique<HAL_JoystickButtons[]>(kJoystickPorts);
m_joystickDescriptor =
- aos::make_unique<HAL_JoystickDescriptor[]>(kJoystickPorts);
- m_joystickAxesCache = aos::make_unique<HAL_JoystickAxes[]>(kJoystickPorts);
- m_joystickPOVsCache = aos::make_unique<HAL_JoystickPOVs[]>(kJoystickPorts);
+ std::make_unique<HAL_JoystickDescriptor[]>(kJoystickPorts);
+ m_joystickAxesCache = std::make_unique<HAL_JoystickAxes[]>(kJoystickPorts);
+ m_joystickPOVsCache = std::make_unique<HAL_JoystickPOVs[]>(kJoystickPorts);
m_joystickButtonsCache =
- aos::make_unique<HAL_JoystickButtons[]>(kJoystickPorts);
+ std::make_unique<HAL_JoystickButtons[]>(kJoystickPorts);
m_joystickDescriptorCache =
- aos::make_unique<HAL_JoystickDescriptor[]>(kJoystickPorts);
+ std::make_unique<HAL_JoystickDescriptor[]>(kJoystickPorts);
// All joysticks should default to having zero axes, povs and buttons, so
// uninitialized memory doesn't get sent to speed controllers.
diff --git a/y2012/BUILD b/y2012/BUILD
index 450abfa..37032a8 100644
--- a/y2012/BUILD
+++ b/y2012/BUILD
@@ -39,7 +39,6 @@
target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos:init",
- "//aos:make_unique",
"//frc971/control_loops:control_loop",
"//aos/events:shm_event_loop",
"//aos/logging",
diff --git a/y2012/wpilib_interface.cc b/y2012/wpilib_interface.cc
index 959e198..15e1bbb 100644
--- a/y2012/wpilib_interface.cc
+++ b/y2012/wpilib_interface.cc
@@ -7,6 +7,7 @@
#include <functional>
#include <mutex>
#include <thread>
+#include <memory>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Compressor.h"
@@ -22,7 +23,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
@@ -47,7 +47,7 @@
namespace accessories = ::y2012::control_loops::accessories;
using namespace frc;
-using aos::make_unique;
+using std::make_unique;
namespace y2012 {
namespace wpilib {
diff --git a/y2014/BUILD b/y2014/BUILD
index 15e187f..51590c7 100644
--- a/y2014/BUILD
+++ b/y2014/BUILD
@@ -105,7 +105,6 @@
deps = [
":constants",
"//aos:init",
- "//aos:make_unique",
"//frc971/control_loops:control_loop",
"//aos/logging",
"//frc971/input:robot_state_fbs",
diff --git a/y2014/wpilib_interface.cc b/y2014/wpilib_interface.cc
index 8f53ee2..ea87a18 100644
--- a/y2014/wpilib_interface.cc
+++ b/y2014/wpilib_interface.cc
@@ -7,6 +7,7 @@
#include <functional>
#include <mutex>
#include <thread>
+#include <memory>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Compressor.h"
@@ -21,7 +22,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
@@ -53,7 +53,7 @@
namespace claw = ::y2014::control_loops::claw;
namespace shooter = ::y2014::control_loops::shooter;
-using aos::make_unique;
+using std::make_unique;
namespace y2014 {
namespace wpilib {
diff --git a/y2014_bot3/BUILD b/y2014_bot3/BUILD
index 7daa19e..40233c5 100644
--- a/y2014_bot3/BUILD
+++ b/y2014_bot3/BUILD
@@ -39,7 +39,6 @@
target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos:init",
- "//aos:make_unique",
"//frc971/control_loops:control_loop",
"//aos/logging",
"//frc971/input:robot_state_fbs",
diff --git a/y2014_bot3/wpilib_interface.cc b/y2014_bot3/wpilib_interface.cc
index dedeab7..cdb85c2 100644
--- a/y2014_bot3/wpilib_interface.cc
+++ b/y2014_bot3/wpilib_interface.cc
@@ -7,6 +7,7 @@
#include <functional>
#include <mutex>
#include <thread>
+#include <memory>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Compressor.h"
@@ -21,7 +22,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
@@ -49,7 +49,7 @@
#define M_PI 3.14159265358979323846
#endif
-using aos::make_unique;
+using std::make_unique;
using ::aos::util::SimpleLogInterval;
using ::frc971::wpilib::BufferedPcm;
using ::frc971::wpilib::BufferedSolenoid;
diff --git a/y2016/BUILD b/y2016/BUILD
index d61eb68..0c9852f 100644
--- a/y2016/BUILD
+++ b/y2016/BUILD
@@ -112,7 +112,6 @@
deps = [
":constants",
"//aos:init",
- "//aos:make_unique",
"//aos:math",
"//frc971/control_loops:control_loop",
"//aos/logging",
diff --git a/y2016/wpilib_interface.cc b/y2016/wpilib_interface.cc
index 8ff345d..e8ad2f6 100644
--- a/y2016/wpilib_interface.cc
+++ b/y2016/wpilib_interface.cc
@@ -22,7 +22,6 @@
#include "aos/commonmath.h"
#include "aos/events/shm_event_loop.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
@@ -54,7 +53,7 @@
#include "y2016/control_loops/superstructure/superstructure_position_generated.h"
#include "y2016/queues/ball_detector_generated.h"
-using aos::make_unique;
+using std::make_unique;
using ::frc971::wpilib::LoopOutputHandler;
namespace shooter = ::y2016::control_loops::shooter;
namespace superstructure = ::y2016::control_loops::superstructure;
diff --git a/y2017/BUILD b/y2017/BUILD
index 36151dd..ba6d452 100644
--- a/y2017/BUILD
+++ b/y2017/BUILD
@@ -75,7 +75,6 @@
deps = [
":constants",
"//aos:init",
- "//aos:make_unique",
"//aos:math",
"//frc971/control_loops:control_loop",
"//aos/logging",
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index 14029e3..e43bdb1 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/wpilib_interface.cc
@@ -9,6 +9,7 @@
#include <functional>
#include <mutex>
#include <thread>
+#include <memory>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Compressor.h"
@@ -25,7 +26,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
#include "aos/util/compiler_memory_barrier.h"
@@ -65,7 +65,7 @@
using ::y2017::constants::Values;
namespace chrono = ::std::chrono;
using namespace frc;
-using aos::make_unique;
+using std::make_unique;
namespace y2017 {
namespace wpilib {
diff --git a/y2018/BUILD b/y2018/BUILD
index 4278a0f..6d3bc47 100644
--- a/y2018/BUILD
+++ b/y2018/BUILD
@@ -74,7 +74,6 @@
deps = [
":status_light_fbs",
"//aos:init",
- "//aos:make_unique",
"//aos:math",
"//frc971/control_loops:control_loop",
"//aos/logging",
diff --git a/y2018/wpilib_interface.cc b/y2018/wpilib_interface.cc
index 641a474..e3175af 100644
--- a/y2018/wpilib_interface.cc
+++ b/y2018/wpilib_interface.cc
@@ -8,6 +8,7 @@
#include <cmath>
#include <functional>
#include <thread>
+#include <memory>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Counter.h"
@@ -24,7 +25,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/time/time.h"
#include "aos/util/compiler_memory_barrier.h"
#include "aos/util/log_interval.h"
@@ -55,7 +55,7 @@
#define M_PI 3.14159265358979323846
#endif
-using aos::make_unique;
+using std::make_unique;
using ::aos::monotonic_clock;
using ::y2018::constants::Values;
namespace chrono = ::std::chrono;
diff --git a/y2019/BUILD b/y2019/BUILD
index ec777e3..1fc03c5 100644
--- a/y2019/BUILD
+++ b/y2019/BUILD
@@ -63,7 +63,6 @@
":constants",
":status_light_fbs",
"//aos:init",
- "//aos:make_unique",
"//aos:math",
"//frc971/control_loops:control_loop",
"//aos/events:shm_event_loop",
diff --git a/y2019/wpilib_interface.cc b/y2019/wpilib_interface.cc
index d644ee7..891031a 100644
--- a/y2019/wpilib_interface.cc
+++ b/y2019/wpilib_interface.cc
@@ -9,6 +9,7 @@
#include <functional>
#include <mutex>
#include <thread>
+#include <memory>
#include "ctre/phoenix/CANifier.h"
#include "frc971/wpilib/ahal/AnalogInput.h"
@@ -24,7 +25,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/realtime.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
@@ -62,7 +62,7 @@
using ::y2019::constants::Values;
namespace superstructure = ::y2019::control_loops::superstructure;
namespace chrono = ::std::chrono;
-using aos::make_unique;
+using std::make_unique;
namespace y2019 {
namespace wpilib {
diff --git a/y2020/BUILD b/y2020/BUILD
index 6f21242..1987939 100644
--- a/y2020/BUILD
+++ b/y2020/BUILD
@@ -86,7 +86,6 @@
deps = [
":constants",
"//aos:init",
- "//aos:make_unique",
"//aos:math",
"//frc971/control_loops:control_loop",
"//aos/events:shm_event_loop",
diff --git a/y2020/wpilib_interface.cc b/y2020/wpilib_interface.cc
index e0f6f6b..4e623d6 100644
--- a/y2020/wpilib_interface.cc
+++ b/y2020/wpilib_interface.cc
@@ -9,6 +9,7 @@
#include <functional>
#include <mutex>
#include <thread>
+#include <memory>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Counter.h"
@@ -24,7 +25,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/network/team_number.h"
#include "aos/realtime.h"
#include "aos/time/time.h"
@@ -56,7 +56,7 @@
using ::y2020::constants::Values;
namespace superstructure = ::y2020::control_loops::superstructure;
namespace chrono = ::std::chrono;
-using aos::make_unique;
+using std::make_unique;
namespace y2020 {
namespace wpilib {
diff --git a/y2021_bot3/BUILD b/y2021_bot3/BUILD
index a8f6c01..8c68771 100644
--- a/y2021_bot3/BUILD
+++ b/y2021_bot3/BUILD
@@ -46,7 +46,6 @@
deps = [
":constants",
"//aos:init",
- "//aos:make_unique",
"//aos:math",
"//frc971/control_loops:control_loop",
"//aos/events:shm_event_loop",
diff --git a/y2021_bot3/wpilib_interface.cc b/y2021_bot3/wpilib_interface.cc
index 4e07842..6f427ce 100644
--- a/y2021_bot3/wpilib_interface.cc
+++ b/y2021_bot3/wpilib_interface.cc
@@ -9,6 +9,7 @@
#include <functional>
#include <mutex>
#include <thread>
+#include <memory>
#include "ctre/phoenix/CANifier.h"
#include "frc971/wpilib/ahal/AnalogInput.h"
@@ -25,7 +26,6 @@
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
-#include "aos/make_unique.h"
#include "aos/realtime.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
@@ -55,7 +55,7 @@
using ::y2021_bot3::constants::Values;
namespace superstructure = ::y2021_bot3::control_loops::superstructure;
namespace chrono = ::std::chrono;
-using aos::make_unique;
+using std::make_unique;
namespace y2021_bot3 {
namespace wpilib {