WPILibC++  2020.3.2-60-g3011ebe
ScheduleCommand.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <wpi/ArrayRef.h>
11 #include <wpi/SmallVector.h>
12 
13 #include "frc2/command/CommandBase.h"
14 #include "frc2/command/CommandHelper.h"
15 #include "frc2/command/SetUtilities.h"
16 
17 namespace frc2 {
24 class ScheduleCommand : public CommandHelper<CommandBase, ScheduleCommand> {
25  public:
32  explicit ScheduleCommand(wpi::ArrayRef<Command*> toSchedule);
33 
34  ScheduleCommand(ScheduleCommand&& other) = default;
35 
36  ScheduleCommand(const ScheduleCommand& other) = default;
37 
38  void Initialize() override;
39 
40  bool IsFinished() override;
41 
42  bool RunsWhenDisabled() const override;
43 
44  private:
45  wpi::SmallVector<Command*, 4> m_toSchedule;
46 };
47 } // namespace frc2
wpi::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:42
frc2::ScheduleCommand::Initialize
void Initialize() override
The initial subroutine of a command.
frc2::CommandHelper
CRTP implementation to allow polymorphic decorator functions in Command.
Definition: CommandHelper.h:26
frc2::ScheduleCommand::RunsWhenDisabled
bool RunsWhenDisabled() const override
Whether the given command should run when the robot is disabled.
frc2::ScheduleCommand
Schedules the given commands when this command is initialized.
Definition: ScheduleCommand.h:24
frc2::ScheduleCommand::IsFinished
bool IsFinished() override
Whether the command has finished.
wpi::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:856
frc2::ScheduleCommand::ScheduleCommand
ScheduleCommand(wpi::ArrayRef< Command * > toSchedule)
Creates a new ScheduleCommand that schedules the given commands when initialized.