WPILibC++ 2024.3.2
frc2::WrapperCommand Class Reference

A class used internally to wrap commands while overriding a specific method; all other methods will call through to the wrapped command. More...

#include <frc2/command/WrapperCommand.h>

Inheritance diagram for frc2::WrapperCommand:
frc2::CommandHelper< Command, WrapperCommand >

Public Member Functions

 WrapperCommand (std::unique_ptr< Command > &&command)
 Wrap a command. More...
 
template<std::derived_from< Command > T>
 WrapperCommand (T &&command)
 Wrap a command. More...
 
 WrapperCommand (WrapperCommand &&other)=default
 
 WrapperCommand (const WrapperCommand &other)=delete
 
 WrapperCommand (WrapperCommand &)=delete
 
void Initialize () override
 
void Execute () override
 
bool IsFinished () override
 
void End (bool interrupted) override
 
bool RunsWhenDisabled () const override
 
InterruptionBehavior GetInterruptionBehavior () const override
 
wpi::SmallSet< Subsystem *, 4 > GetRequirements () const override
 
- Public Member Functions inherited from frc2::CommandHelper< Command, WrapperCommand >
 CommandHelper ()=default
 
CommandPtr ToPtr () &&override
 

Protected Attributes

std::unique_ptr< Commandm_command
 Command being wrapped. More...
 

Additional Inherited Members

- Protected Member Functions inherited from frc2::CommandHelper< Command, WrapperCommand >
std::unique_ptr< CommandTransferOwnership () &&override
 

Detailed Description

A class used internally to wrap commands while overriding a specific method; all other methods will call through to the wrapped command.

Wrapped commands may only be used through the wrapper, trying to directly schedule them or add them to a group will throw an exception.

Constructor & Destructor Documentation

◆ WrapperCommand() [1/5]

frc2::WrapperCommand::WrapperCommand ( std::unique_ptr< Command > &&  command)
explicit

Wrap a command.

Parameters
commandthe command being wrapped. Trying to directly schedule this command or add it to a group will throw an exception.

◆ WrapperCommand() [2/5]

template<std::derived_from< Command > T>
frc2::WrapperCommand::WrapperCommand ( T &&  command)
inlineexplicit

Wrap a command.

Parameters
commandthe command being wrapped. Trying to directly schedule this command or add it to a group will throw an exception.

◆ WrapperCommand() [3/5]

frc2::WrapperCommand::WrapperCommand ( WrapperCommand &&  other)
default

◆ WrapperCommand() [4/5]

frc2::WrapperCommand::WrapperCommand ( const WrapperCommand other)
delete

◆ WrapperCommand() [5/5]

frc2::WrapperCommand::WrapperCommand ( WrapperCommand )
delete

Member Function Documentation

◆ End()

void frc2::WrapperCommand::End ( bool  interrupted)
override

◆ Execute()

void frc2::WrapperCommand::Execute ( )
override

◆ GetInterruptionBehavior()

InterruptionBehavior frc2::WrapperCommand::GetInterruptionBehavior ( ) const
override

◆ GetRequirements()

wpi::SmallSet< Subsystem *, 4 > frc2::WrapperCommand::GetRequirements ( ) const
override

◆ Initialize()

void frc2::WrapperCommand::Initialize ( )
override

◆ IsFinished()

bool frc2::WrapperCommand::IsFinished ( )
override

◆ RunsWhenDisabled()

bool frc2::WrapperCommand::RunsWhenDisabled ( ) const
override

Member Data Documentation

◆ m_command

std::unique_ptr<Command> frc2::WrapperCommand::m_command
protected

Command being wrapped.


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