[commands] Remove EndlessCommand (#4483)

This commit is contained in:
Starlight220
2022-10-21 03:24:54 +03:00
committed by GitHub
parent 16cdc741cf
commit dc037f8d41
16 changed files with 44 additions and 289 deletions

View File

@@ -7,7 +7,6 @@
#include "frc2/command/CommandHelper.h"
#include "frc2/command/CommandScheduler.h"
#include "frc2/command/ConditionalCommand.h"
#include "frc2/command/EndlessCommand.h"
#include "frc2/command/InstantCommand.h"
#include "frc2/command/ParallelCommandGroup.h"
#include "frc2/command/ParallelDeadlineGroup.h"
@@ -91,10 +90,6 @@ PerpetualCommand Command::Perpetually() && {
WPI_UNIGNORE_DEPRECATED
}
CommandPtr Command::Endlessly() && {
return CommandPtr(std::move(*this).TransferOwnership()).Endlessly();
}
CommandPtr Command::Repeatedly() && {
return CommandPtr(std::move(*this).TransferOwnership()).Repeatedly();
}

View File

@@ -6,7 +6,6 @@
#include "frc2/command/CommandScheduler.h"
#include "frc2/command/ConditionalCommand.h"
#include "frc2/command/EndlessCommand.h"
#include "frc2/command/InstantCommand.h"
#include "frc2/command/ParallelCommandGroup.h"
#include "frc2/command/ParallelDeadlineGroup.h"
@@ -26,11 +25,6 @@ CommandPtr CommandPtr::Repeatedly() && {
return std::move(*this);
}
CommandPtr CommandPtr::Endlessly() && {
m_ptr = std::make_unique<EndlessCommand>(std::move(m_ptr));
return std::move(*this);
}
CommandPtr CommandPtr::AsProxy() && {
m_ptr = std::make_unique<ProxyScheduleCommand>(std::move(m_ptr));
return std::move(*this);

View File

@@ -1,28 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "frc2/command/EndlessCommand.h"
using namespace frc2;
EndlessCommand::EndlessCommand(std::unique_ptr<Command>&& command) {
if (!CommandGroupBase::RequireUngrouped(*command)) {
return;
}
m_command = std::move(command);
m_command->SetGrouped(true);
AddRequirements(m_command->GetRequirements());
}
void EndlessCommand::Initialize() {
m_command->Initialize();
}
void EndlessCommand::Execute() {
m_command->Execute();
}
void EndlessCommand::End(bool interrupted) {
m_command->End(interrupted);
}