Loading [MathJax]/jax/output/HTML-CSS/config.js
WPILibC++
2025.3.2
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
Enumerations
a
b
c
d
e
f
h
i
l
m
n
o
p
r
s
t
u
v
Enumerator
a
b
c
f
h
i
k
l
m
o
p
s
t
u
w
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
Enumerator
a
b
c
f
i
k
m
o
p
r
s
v
Related Symbols
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
b
c
d
e
f
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
a
c
e
h
m
n
p
r
s
t
u
w
Enumerator
c
h
i
m
n
p
u
w
Macros
_
a
c
d
e
f
g
h
i
j
k
l
m
n
p
r
s
t
u
v
w
x
▼
WPILibC++
LICENSE
Deprecated List
Todo List
►
Topics
►
Namespaces
►
Concepts
►
Classes
▼
Files
▼
File List
►
cameraserver
►
debugging
►
fmt
►
frc
►
frc
►
frc
►
frc
►
frc
►
frc
►
frc2
▼
frc2
▼
command
►
button
►
sysid
►
Command.h
►
CommandHelper.h
►
CommandPtr.h
►
Commands.h
►
CommandScheduler.h
►
ConditionalCommand.h
►
DeferredCommand.h
►
FunctionalCommand.h
►
InstantCommand.h
►
MecanumControllerCommand.h
►
NotifierCommand.h
►
ParallelCommandGroup.h
►
ParallelDeadlineGroup.h
►
ParallelRaceGroup.h
►
PIDCommand.h
►
PIDSubsystem.h
►
PrintCommand.h
►
ProfiledPIDCommand.h
►
ProfiledPIDSubsystem.h
►
ProxyCommand.h
►
RamseteCommand.h
►
RepeatCommand.h
►
Requirements.h
►
RunCommand.h
►
ScheduleCommand.h
►
SelectCommand.h
►
SequentialCommandGroup.h
►
StartEndCommand.h
►
Subsystem.h
►
SubsystemBase.h
►
SwerveControllerCommand.h
►
TrapezoidProfileCommand.h
►
TrapezoidProfileSubsystem.h
►
WaitCommand.h
►
WaitUntilCommand.h
►
WrapperCommand.h
►
generated
►
generated
►
generated
►
hal
►
networktables
►
thirdparty
►
thirdparty
►
thirdparty
►
units
►
vision
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpi
►
wpimath
►
wpinet
cscore.h
►
cscore_c.h
►
cscore_cpp.h
►
cscore_cv.h
cscore_oo.h
►
cscore_raw.h
►
cscore_runloop.h
ntcore.h
►
ntcore_c.h
►
ntcore_cpp.h
►
ntcore_test.h
►
WPILibVersion.h
debugging.hpp
►
pb.h
►
pb_common.h
►
pb_decode.h
►
pb_encode.h
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
WrapperCommand.h
Go to the documentation of this file.
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
#pragma once
6
7
#ifdef _WIN32
8
#pragma warning(push)
9
#pragma warning(disable : 4521)
10
#endif
11
12
#include <concepts>
13
#include <memory>
14
#include <utility>
15
16
#include "
frc2/command/Command.h
"
17
#include "
frc2/command/CommandHelper.h
"
18
19
namespace
frc2
{
20
/**
21
* A class used internally to wrap commands while overriding a specific method;
22
* all other methods will call through to the wrapped command.
23
*
24
* <p>Wrapped commands may only be used through the wrapper, trying to directly
25
* schedule them or add them to a group will throw an exception.
26
*/
27
class
WrapperCommand
:
public
CommandHelper
<Command, WrapperCommand> {
28
public
:
29
/**
30
* Wrap a command.
31
*
32
* @param command the command being wrapped. Trying to directly schedule this
33
* command or add it to a group will throw an exception.
34
*/
35
explicit
WrapperCommand
(std::unique_ptr<Command>&& command);
36
37
/**
38
* Wrap a command.
39
*
40
* @param command the command being wrapped. Trying to directly schedule this
41
* command or add it to a group will throw an exception.
42
*/
43
template
<std::derived_from<Command> T>
44
// NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
45
explicit
WrapperCommand
(T&& command)
46
:
WrapperCommand
(
47
std
::make_unique<
std
::
decay_t
<T>>(
std
::forward<T>(command))) {}
45
explicit
WrapperCommand
(T&& command) {
…
}
48
49
WrapperCommand
(
WrapperCommand
&& other) =
default
;
50
51
// No copy constructors for command groups
52
WrapperCommand
(
const
WrapperCommand
& other) =
delete
;
53
54
// Prevent template expansion from emulating copy ctor
55
WrapperCommand
(
WrapperCommand
&) =
delete
;
56
57
void
Initialize
()
override
;
58
59
void
Execute
()
override
;
60
61
bool
IsFinished
()
override
;
62
63
void
End
(
bool
interrupted)
override
;
64
65
bool
RunsWhenDisabled
()
const override
;
66
67
InterruptionBehavior
GetInterruptionBehavior
()
const override
;
68
69
wpi::SmallSet<Subsystem*, 4>
GetRequirements
()
const override
;
70
71
protected
:
72
/// Command being wrapped.
73
std::unique_ptr<Command>
m_command
;
74
};
27
class
WrapperCommand
:
public
CommandHelper
<Command, WrapperCommand> {
…
};
75
}
// namespace frc2
76
77
#ifdef _WIN32
78
#pragma warning(pop)
79
#endif
Command.h
CommandHelper.h
frc2::CommandHelper
CRTP implementation to allow polymorphic decorator functions in Command.
Definition
CommandHelper.h:25
frc2::WrapperCommand
A class used internally to wrap commands while overriding a specific method; all other methods will c...
Definition
WrapperCommand.h:27
frc2::WrapperCommand::WrapperCommand
WrapperCommand(T &&command)
Wrap a command.
Definition
WrapperCommand.h:45
frc2::WrapperCommand::WrapperCommand
WrapperCommand(const WrapperCommand &other)=delete
frc2::WrapperCommand::Execute
void Execute() override
frc2::WrapperCommand::WrapperCommand
WrapperCommand(std::unique_ptr< Command > &&command)
Wrap a command.
frc2::WrapperCommand::RunsWhenDisabled
bool RunsWhenDisabled() const override
frc2::WrapperCommand::Initialize
void Initialize() override
frc2::WrapperCommand::IsFinished
bool IsFinished() override
frc2::WrapperCommand::m_command
std::unique_ptr< Command > m_command
Command being wrapped.
Definition
WrapperCommand.h:73
frc2::WrapperCommand::End
void End(bool interrupted) override
frc2::WrapperCommand::WrapperCommand
WrapperCommand(WrapperCommand &&other)=default
frc2::WrapperCommand::GetInterruptionBehavior
InterruptionBehavior GetInterruptionBehavior() const override
frc2::WrapperCommand::GetRequirements
wpi::SmallSet< Subsystem *, 4 > GetRequirements() const override
frc2::WrapperCommand::WrapperCommand
WrapperCommand(WrapperCommand &)=delete
wpi::SmallSet
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition
SmallSet.h:135
frc2
Definition
FunctionalCommand.h:13
std
Implement std::hash so that hash_code can be used in STL containers.
Definition
PointerIntPair.h:280
decay_t
typename std::decay< T >::type decay_t
Definition
base.h:311
frc2
command
WrapperCommand.h
Generated on Mon Mar 17 2025 23:50:34 for WPILibC++ by
1.12.0