From 7aa9ad44b8f246a1ffcfe6ec0a8b08068b76cee5 Mon Sep 17 00:00:00 2001 From: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com> Date: Tue, 26 Dec 2023 13:14:34 -0800 Subject: [PATCH] [commands] Deprecate C++ TransferOwnership() (#6095) It has been completely replaced with ToPtr(). --- .../src/main/native/include/frc2/command/Command.h | 1 + .../src/main/native/include/frc2/command/CommandHelper.h | 3 +++ .../src/main/native/include/frc2/command/SelectCommand.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h index 7bb6213e75..27f5f18407 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h @@ -432,6 +432,7 @@ class Command : public wpi::Sendable, public wpi::SendableHelper { * Transfers ownership of this command to a unique pointer. Used for * decorator methods. */ + [[deprecated("Use ToPtr() instead")]] virtual std::unique_ptr TransferOwnership() && = 0; std::optional m_previousComposition; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h index ed93b655f9..ba6fe920b8 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h @@ -8,6 +8,8 @@ #include #include +#include + #include "frc2/command/Command.h" #include "frc2/command/CommandPtr.h" @@ -34,6 +36,7 @@ class CommandHelper : public Base { } protected: + WPI_DEPRECATED("Use ToPtr() instead") std::unique_ptr TransferOwnership() && override { return std::make_unique(std::move(*static_cast(this))); } diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h index 4c2ba66fde..cc311063b4 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h @@ -17,6 +17,7 @@ #include #include +#include #include #include "frc2/command/Command.h" @@ -134,6 +135,7 @@ class SelectCommand : public CommandHelper> { } protected: + WPI_DEPRECATED("Use ToPtr() instead") std::unique_ptr TransferOwnership() && override { return std::make_unique(std::move(*this)); }