WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::cmd::SelectCommand< Key > Class Template Reference

A command composition that runs one of a selection of commands using a selector and a key to command mapping. More...

#include <wpi/commands2/SelectCommand.hpp>

Inheritance diagram for wpi::cmd::SelectCommand< Key >:
wpi::cmd::CommandHelper< Command, SelectCommand< Key > >

Public Member Functions

template<std::derived_from< Command >... Commands>
 SelectCommand (std::function< Key()> selector, std::pair< Key, Commands >... commands)
 Creates a new SelectCommand.
 SelectCommand (std::function< Key()> selector, std::vector< std::pair< Key, std::unique_ptr< Command > > > &&commands)
 SelectCommand (const SelectCommand &other)=delete
 SelectCommand (SelectCommand &)=delete
 SelectCommand (SelectCommand &&other)=default
void Initialize () override
void Execute () override
void End (bool interrupted) override
bool IsFinished () override
bool RunsWhenDisabled () const override
Command::InterruptionBehavior GetInterruptionBehavior () const override
void InitSendable (wpi::util::SendableBuilder &builder) override
Public Member Functions inherited from wpi::cmd::CommandHelper< Command, SelectCommand< Key > >
 CommandHelper ()=default
CommandPtr ToPtr () &&override

Detailed Description

template<typename Key>
class wpi::cmd::SelectCommand< Key >

A command composition that runs one of a selection of commands using a selector and a key to command mapping.

The rules for command compositions apply: command instances that are passed to it are owned by the composition and cannot be added to any other composition or scheduled individually, and the composition requires all subsystems its components require.

This class is provided by the NewCommands VendorDep

Constructor & Destructor Documentation

◆ SelectCommand() [1/5]

template<typename Key>
template<std::derived_from< Command >... Commands>
wpi::cmd::SelectCommand< Key >::SelectCommand ( std::function< Key()> selector,
std::pair< Key, Commands >... commands )
inlineexplicit

Creates a new SelectCommand.

Parameters
commandsthe map of commands to choose from
selectorthe selector to determine which command to run

◆ SelectCommand() [2/5]

template<typename Key>
wpi::cmd::SelectCommand< Key >::SelectCommand ( std::function< Key()> selector,
std::vector< std::pair< Key, std::unique_ptr< Command > > > && commands )
inline

◆ SelectCommand() [3/5]

template<typename Key>
wpi::cmd::SelectCommand< Key >::SelectCommand ( const SelectCommand< Key > & other)
delete

◆ SelectCommand() [4/5]

template<typename Key>
wpi::cmd::SelectCommand< Key >::SelectCommand ( SelectCommand< Key > & )
delete

◆ SelectCommand() [5/5]

template<typename Key>
wpi::cmd::SelectCommand< Key >::SelectCommand ( SelectCommand< Key > && other)
default

Member Function Documentation

◆ End()

template<typename Key>
void wpi::cmd::SelectCommand< Key >::End ( bool interrupted)
inlineoverride

◆ Execute()

template<typename Key>
void wpi::cmd::SelectCommand< Key >::Execute ( )
inlineoverride

◆ GetInterruptionBehavior()

template<typename Key>
Command::InterruptionBehavior wpi::cmd::SelectCommand< Key >::GetInterruptionBehavior ( ) const
inlineoverride

◆ Initialize()

template<typename T>
void wpi::cmd::SelectCommand< T >::Initialize ( )
override

◆ InitSendable()

template<typename Key>
void wpi::cmd::SelectCommand< Key >::InitSendable ( wpi::util::SendableBuilder & builder)
inlineoverride

◆ IsFinished()

template<typename Key>
bool wpi::cmd::SelectCommand< Key >::IsFinished ( )
inlineoverride

◆ RunsWhenDisabled()

template<typename Key>
bool wpi::cmd::SelectCommand< Key >::RunsWhenDisabled ( ) const
inlineoverride

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