[commands] Add proxy factory to Commands (#5603)

This commit is contained in:
Ryan Blue
2023-09-17 23:49:02 -04:00
committed by GitHub
parent 633c5a8a22
commit 9fe258427a
3 changed files with 44 additions and 2 deletions

View File

@@ -142,6 +142,26 @@ CommandPtr Select(std::function<Key()> selector,
return SelectCommand(std::move(selector), std::move(vec)).ToPtr();
}
/**
* Constructs a command that schedules the command returned from the supplier
* when initialized, and ends when it is no longer scheduled. The supplier is
* called when the command is initialized.
*
* @param supplier the command supplier
*/
[[nodiscard]]
CommandPtr DeferredProxy(wpi::unique_function<Command*()> supplier);
/**
* Constructs a command that schedules the command returned from the supplier
* when initialized, and ends when it is no longer scheduled. The supplier is
* called when the command is initialized.
*
* @param supplier the command supplier
*/
[[nodiscard]]
CommandPtr DeferredProxy(wpi::unique_function<CommandPtr()> supplier);
// Command Groups
namespace impl {