mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[commands] Add convenience factories (#4460)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
This commit is contained in:
@@ -282,6 +282,15 @@ safe) semantics.
|
||||
*/
|
||||
[[nodiscard]] CommandPtr HandleInterrupt(std::function<void()> handler) &&;
|
||||
|
||||
/**
|
||||
* Decorates this Command with a name. Is an inline function for
|
||||
* #SetName(std::string_view);
|
||||
*
|
||||
* @param name name
|
||||
* @return the decorated Command
|
||||
*/
|
||||
[[nodiscard]] CommandPtr WithName(std::string_view name) &&;
|
||||
|
||||
/**
|
||||
* Schedules this command.
|
||||
*/
|
||||
@@ -343,8 +352,21 @@ safe) semantics.
|
||||
return InterruptionBehavior::kCancelSelf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this Command. Defaults to the simple class name if not
|
||||
* overridden.
|
||||
*
|
||||
* @return The display name of the Command
|
||||
*/
|
||||
virtual std::string GetName() const;
|
||||
|
||||
/**
|
||||
* Sets the name of this Command. Nullop if not overridden.
|
||||
*
|
||||
* @param name The display name of the Command.
|
||||
*/
|
||||
virtual void SetName(std::string_view name);
|
||||
|
||||
/**
|
||||
* Transfers ownership of this command to a unique pointer. Used for
|
||||
* decorator methods.
|
||||
|
||||
Reference in New Issue
Block a user