mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Deprecate proxy supplier constructor (#6553)
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "frc2/command/Commands.h"
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc2/command/ConditionalCommand.h"
|
||||
#include "frc2/command/DeferredCommand.h"
|
||||
#include "frc2/command/FunctionalCommand.h"
|
||||
@@ -60,6 +62,7 @@ CommandPtr cmd::Print(std::string_view msg) {
|
||||
return PrintCommand(msg).ToPtr();
|
||||
}
|
||||
|
||||
WPI_IGNORE_DEPRECATED
|
||||
CommandPtr cmd::DeferredProxy(wpi::unique_function<Command*()> supplier) {
|
||||
return ProxyCommand(std::move(supplier)).ToPtr();
|
||||
}
|
||||
@@ -67,6 +70,7 @@ CommandPtr cmd::DeferredProxy(wpi::unique_function<Command*()> supplier) {
|
||||
CommandPtr cmd::DeferredProxy(wpi::unique_function<CommandPtr()> supplier) {
|
||||
return ProxyCommand(std::move(supplier)).ToPtr();
|
||||
}
|
||||
WPI_UNIGNORE_DEPRECATED
|
||||
|
||||
CommandPtr cmd::Wait(units::second_t duration) {
|
||||
return WaitCommand(duration).ToPtr();
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include "frc2/command/ProxyCommand.h"
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
WPI_IGNORE_DEPRECATED
|
||||
ProxyCommand::ProxyCommand(wpi::unique_function<Command*()> supplier)
|
||||
: m_supplier(std::move(supplier)) {}
|
||||
|
||||
@@ -18,9 +20,10 @@ ProxyCommand::ProxyCommand(wpi::unique_function<CommandPtr()> supplier)
|
||||
holder = supplier();
|
||||
return holder->get();
|
||||
}) {}
|
||||
WPI_UNIGNORE_DEPRECATED
|
||||
|
||||
ProxyCommand::ProxyCommand(Command* command)
|
||||
: ProxyCommand([command] { return command; }) {
|
||||
: m_supplier([command] { return command; }) {
|
||||
SetName(fmt::format("Proxy({})", command->GetName()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user