mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[commands] Remove deprecated classes and functions (#5409)
Removes:
- PerpetualCommand
- Command.perpetually()
- CommandGroupBase
- Command.IsGrouped() (C++ only)
- Command.SetGrouped() (C++ only)
- Command.withInterrupt()
- ProxyScheduleCommand
- Button
- InternalButton, JoystickButton, NetworkButton and POVButton now subclass Trigger
- Old style Trigger functions:
- Trigger.whenActive
- Trigger.whileActiveOnce
- Trigger.whileActiveContinuous
- Trigger.whenInactive
- Trigger.toggleWhenActive
- Trigger.cancelWhenActive
- CommandScheduler.clearButtons()
- CommandScheduler.addButtons() (Java only)
- Command supplier constructor of SelectCommand
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc2/command/CommandBase.h"
|
||||
@@ -95,17 +94,6 @@ class SelectCommand : public CommandHelper<CommandBase, SelectCommand<Key>> {
|
||||
// Prevent template expansion from emulating copy ctor
|
||||
SelectCommand(SelectCommand&) = delete;
|
||||
|
||||
/**
|
||||
* Creates a new selectcommand.
|
||||
*
|
||||
* @param toRun a supplier providing the command to run
|
||||
* @deprecated Replace with {@link ProxyCommand},
|
||||
* composing multiple of them in a {@link ParallelRaceGroup} if needed.
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with ProxyCommand")
|
||||
explicit SelectCommand(std::function<Command*()> toRun)
|
||||
: m_toRun{std::move(toRun)} {}
|
||||
|
||||
SelectCommand(SelectCommand&& other) = default;
|
||||
|
||||
void Initialize() override;
|
||||
@@ -147,7 +135,6 @@ class SelectCommand : public CommandHelper<CommandBase, SelectCommand<Key>> {
|
||||
private:
|
||||
std::unordered_map<Key, std::unique_ptr<Command>> m_commands;
|
||||
std::function<Key()> m_selector;
|
||||
std::function<Command*()> m_toRun;
|
||||
Command* m_selectedCommand;
|
||||
bool m_runsWhenDisabled = true;
|
||||
Command::InterruptionBehavior m_interruptBehavior{
|
||||
@@ -156,16 +143,12 @@ class SelectCommand : public CommandHelper<CommandBase, SelectCommand<Key>> {
|
||||
|
||||
template <typename T>
|
||||
void SelectCommand<T>::Initialize() {
|
||||
if (m_selector) {
|
||||
auto find = m_commands.find(m_selector());
|
||||
if (find == m_commands.end()) {
|
||||
m_selectedCommand = new PrintCommand(
|
||||
"SelectCommand selector value does not correspond to any command!");
|
||||
return;
|
||||
}
|
||||
m_selectedCommand = find->second.get();
|
||||
auto find = m_commands.find(m_selector());
|
||||
if (find == m_commands.end()) {
|
||||
m_selectedCommand = new PrintCommand(
|
||||
"SelectCommand selector value does not correspond to any command!");
|
||||
} else {
|
||||
m_selectedCommand = m_toRun();
|
||||
m_selectedCommand = find->second.get();
|
||||
}
|
||||
m_selectedCommand->Initialize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user