[commands] C++: Add CommandPtr supplier constructor to ProxyCommand (#5572)

Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
This commit is contained in:
Ryan Blue
2023-08-29 16:23:00 -04:00
committed by GitHub
parent 36d514eae7
commit 39a73b5b58
2 changed files with 18 additions and 6 deletions

View File

@@ -31,6 +31,15 @@ class ProxyCommand : public CommandHelper<Command, ProxyCommand> {
*/
explicit ProxyCommand(wpi::unique_function<Command*()> supplier);
/**
* Creates a new ProxyCommand that schedules the supplied command when
* initialized, and ends when it is no longer scheduled. Useful for lazily
* creating commands at runtime.
*
* @param supplier the command supplier
*/
explicit ProxyCommand(wpi::unique_function<CommandPtr()> supplier);
/**
* Creates a new ProxyCommand that schedules the given command when
* initialized, and ends when it is no longer scheduled.
@@ -56,8 +65,6 @@ class ProxyCommand : public CommandHelper<Command, ProxyCommand> {
void End(bool interrupted) override;
void Execute() override;
bool IsFinished() override;
void InitSendable(wpi::SendableBuilder& builder) override;