WPILibC++
2020.3.2
InstantCommand.h
1
/*----------------------------------------------------------------------------*/
2
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
3
/* Open Source Software - may be modified and shared by FRC teams. The code */
4
/* must be accompanied by the FIRST BSD license file in the root directory of */
5
/* the project. */
6
/*----------------------------------------------------------------------------*/
7
8
#pragma once
9
10
#include <functional>
11
12
#include <wpi/Twine.h>
13
14
#include "frc/commands/Command.h"
15
#include "frc/commands/Subsystem.h"
16
17
namespace
frc
{
18
24
class
InstantCommand
:
public
Command
{
25
public
:
31
explicit
InstantCommand
(
const
wpi::Twine
& name);
32
38
explicit
InstantCommand
(
Subsystem
& subsystem);
39
46
InstantCommand
(
const
wpi::Twine
& name,
Subsystem
& subsystem);
47
53
explicit
InstantCommand
(std::function<
void
()> func);
54
61
InstantCommand
(
Subsystem
& subsystem, std::function<
void
()> func);
62
69
InstantCommand
(
const
wpi::Twine
& name, std::function<
void
()> func);
70
78
InstantCommand
(
const
wpi::Twine
& name,
Subsystem
& subsystem,
79
std::function<
void
()> func);
80
81
InstantCommand
() =
default
;
82
virtual
~
InstantCommand
() =
default
;
83
84
InstantCommand
(
InstantCommand
&&) =
default
;
85
InstantCommand
& operator=(
InstantCommand
&&) =
default
;
86
87
protected
:
88
std::function<void()> m_func =
nullptr
;
89
void
_Initialize()
override
;
90
bool
IsFinished
()
override
;
91
};
92
93
}
// namespace frc
frc::Command
The Command class is at the very core of the entire command framework.
Definition:
Command.h:49
frc::Subsystem
Definition:
Subsystem.h:24
frc::InstantCommand
This command will execute once, then finish immediately afterward.
Definition:
InstantCommand.h:24
frc::InstantCommand::IsFinished
bool IsFinished() override
Returns whether this command is finished.
frc
A class that enforces constraints on the differential drive kinematics.
Definition:
SPIAccelerometerSim.h:16
wpi::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition:
Twine.h:85
wpilibOldCommands
src
main
native
include
frc
commands
InstantCommand.h
Generated on Fri Feb 21 2020 08:50:36 for WPILibC++ by
1.8.16