WPILibC++ 2024.3.2
|
Defers Command construction to runtime. More...
#include <frc2/command/DeferredCommand.h>
Public Member Functions | |
DeferredCommand (wpi::unique_function< CommandPtr()> supplier, Requirements requirements) | |
Creates a new DeferredCommand that runs the supplied command when initialized, and ends when it ends. More... | |
DeferredCommand (DeferredCommand &&other)=default | |
void | Initialize () override |
void | Execute () override |
void | End (bool interrupted) override |
bool | IsFinished () override |
void | InitSendable (wpi::SendableBuilder &builder) override |
Public Member Functions inherited from frc2::CommandHelper< Command, DeferredCommand > | |
CommandHelper ()=default | |
CommandPtr | ToPtr () &&override |
Additional Inherited Members | |
Protected Member Functions inherited from frc2::CommandHelper< Command, DeferredCommand > | |
std::unique_ptr< Command > | TransferOwnership () &&override |
Defers Command construction to runtime.
Runs the command returned by the supplier when this command is initialized, and ends when it ends. Useful for performing runtime tasks before creating a new command. If this command is interrupted, it will cancel the command.
Note that the supplier must create a new Command each call. For selecting one of a preallocated set of commands, use SelectCommand.
This class is provided by the NewCommands VendorDep
frc2::DeferredCommand::DeferredCommand | ( | wpi::unique_function< CommandPtr()> | supplier, |
Requirements | requirements | ||
) |
Creates a new DeferredCommand that runs the supplied command when initialized, and ends when it ends.
Useful for lazily creating commands at runtime. The supplier will be called each time this command is initialized. The supplier must create a new Command each call.
supplier | The command supplier |
requirements | The command requirements. |
|
default |
|
override |
|
override |
|
override |
|
override |
|
override |