WPILibC++ 2027.0.0-alpha-5
Loading...
Searching...
No Matches
wpi::cmd::ProxyCommand Class Reference

Schedules a given command when this command is initialized and ends when it ends, but does not directly run it. More...

#include <wpi/commands2/ProxyCommand.hpp>

Inheritance diagram for wpi::cmd::ProxyCommand:
wpi::cmd::CommandHelper< Command, ProxyCommand >

Public Member Functions

 ProxyCommand (Command *command)
 Creates a new ProxyCommand that schedules the given command when initialized, and ends when it is no longer scheduled.
 ProxyCommand (std::unique_ptr< Command > command)
 Creates a new ProxyCommand that schedules the given command when initialized, and ends when it is no longer scheduled.
 ProxyCommand (ProxyCommand &&other)=default
void Initialize () override
void End (bool interrupted) override
bool IsFinished () override
void InitSendable (wpi::util::SendableBuilder &builder) override
Public Member Functions inherited from wpi::cmd::CommandHelper< Command, ProxyCommand >
 CommandHelper ()=default
CommandPtr ToPtr () &&override

Detailed Description

Schedules a given command when this command is initialized and ends when it ends, but does not directly run it.

Use this for including a command in a composition without adding its requirements, but only if you know what you are doing. If you are unsure, see the WPILib docs for a complete explanation of proxy semantics. Do not proxy a command from a subsystem already required by the composition, or else the composition will cancel itself when the proxy is reached. If this command is interrupted, it will cancel the command.

This class is provided by the Commands v2 VendorDep

Constructor & Destructor Documentation

◆ ProxyCommand() [1/3]

wpi::cmd::ProxyCommand::ProxyCommand ( Command * command)
explicit

Creates a new ProxyCommand that schedules the given command when initialized, and ends when it is no longer scheduled.

Parameters
commandthe command to run by proxy

◆ ProxyCommand() [2/3]

wpi::cmd::ProxyCommand::ProxyCommand ( std::unique_ptr< Command > command)
explicit

Creates a new ProxyCommand that schedules the given command when initialized, and ends when it is no longer scheduled.

Note that this constructor passes ownership of the given command to the returned ProxyCommand.

Parameters
commandthe command to schedule

◆ ProxyCommand() [3/3]

wpi::cmd::ProxyCommand::ProxyCommand ( ProxyCommand && other)
default

Member Function Documentation

◆ End()

void wpi::cmd::ProxyCommand::End ( bool interrupted)
override

◆ Initialize()

void wpi::cmd::ProxyCommand::Initialize ( )
override

◆ InitSendable()

void wpi::cmd::ProxyCommand::InitSendable ( wpi::util::SendableBuilder & builder)
override

◆ IsFinished()

bool wpi::cmd::ProxyCommand::IsFinished ( )
override

The documentation for this class was generated from the following file: