mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[commands] Revert "Change grouping decorator impl to flatten nested group structures (#3335)" (#4402)
This reverts commit ef4ea84cb5.
This commit is contained in:
@@ -26,7 +26,3 @@ void EndlessCommand::Execute() {
|
||||
void EndlessCommand::End(bool interrupted) {
|
||||
m_command->End(interrupted);
|
||||
}
|
||||
|
||||
EndlessCommand EndlessCommand::Endlessly() && {
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,3 @@ void PerpetualCommand::Execute() {
|
||||
void PerpetualCommand::End(bool interrupted) {
|
||||
m_command->End(interrupted);
|
||||
}
|
||||
|
||||
PerpetualCommand PerpetualCommand::Perpetually() && {
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,3 @@ void RepeatCommand::End(bool interrupted) {
|
||||
bool RepeatCommand::RunsWhenDisabled() const {
|
||||
return m_command->RunsWhenDisabled();
|
||||
}
|
||||
|
||||
RepeatCommand RepeatCommand::Repeatedly() && {
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "frc2/command/SequentialCommandGroup.h"
|
||||
|
||||
#include "frc2/command/InstantCommand.h"
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
SequentialCommandGroup::SequentialCommandGroup(
|
||||
@@ -74,33 +72,3 @@ void SequentialCommandGroup::AddCommands(
|
||||
m_commands.emplace_back(std::move(command));
|
||||
}
|
||||
}
|
||||
|
||||
SequentialCommandGroup SequentialCommandGroup::BeforeStarting(
|
||||
std::function<void()> toRun, wpi::span<Subsystem* const> requirements) && {
|
||||
// store all the commands
|
||||
std::vector<std::unique_ptr<Command>> tmp;
|
||||
tmp.emplace_back(
|
||||
std::make_unique<InstantCommand>(std::move(toRun), requirements));
|
||||
for (auto&& command : m_commands) {
|
||||
command->SetGrouped(false);
|
||||
tmp.emplace_back(std::move(command));
|
||||
}
|
||||
|
||||
// reset current state
|
||||
m_commands.clear();
|
||||
m_requirements.clear();
|
||||
m_runWhenDisabled = true;
|
||||
|
||||
// add the commands back
|
||||
AddCommands(std::move(tmp));
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
SequentialCommandGroup SequentialCommandGroup::AndThen(
|
||||
std::function<void()> toRun, wpi::span<Subsystem* const> requirements) && {
|
||||
std::vector<std::unique_ptr<Command>> tmp;
|
||||
tmp.emplace_back(
|
||||
std::make_unique<InstantCommand>(std::move(toRun), requirements));
|
||||
AddCommands(std::move(tmp));
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user