[commands] Add C++ Requirements struct (#5504)

This commit is contained in:
Joseph Eng
2023-09-17 20:48:39 -07:00
committed by GitHub
parent b265a68eea
commit 633c5a8a22
43 changed files with 273 additions and 1112 deletions

View File

@@ -49,17 +49,7 @@ CommandPtr Idle();
*/
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action once and finishes.
*
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
Requirements requirements = {});
/**
* Constructs a command that runs an action every iteration until interrupted.
@@ -68,18 +58,7 @@ CommandPtr RunOnce(std::function<void()> action,
* @param requirements subsystems the action requires
*/
[[nodiscard]]
CommandPtr Run(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action every iteration until interrupted.
*
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]]
CommandPtr Run(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
CommandPtr Run(std::function<void()> action, Requirements requirements = {});
/**
* Constructs a command that runs an action once and another action when the
@@ -91,19 +70,7 @@ CommandPtr Run(std::function<void()> action,
*/
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action once and another action when the
* command is interrupted.
*
* @param start the action to run on start
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
Requirements requirements = {});
/**
* Constructs a command that runs an action every iteration until interrupted,
@@ -115,19 +82,7 @@ CommandPtr StartEnd(std::function<void()> start, std::function<void()> end,
*/
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action every iteration until interrupted,
* and then runs a second action.
*
* @param run the action to run every iteration
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
Requirements requirements = {});
/**
* Constructs a command that prints a message and finishes.