2016-11-18 17:42:40 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
|
2016-11-18 17:42:40 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "frc/commands/InstantCommand.h"
|
2016-11-18 17:42:40 -05:00
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
|
2018-04-29 23:33:19 -07:00
|
|
|
InstantCommand::InstantCommand(const wpi::Twine& name) : Command(name) {}
|
2016-11-18 17:42:40 -05:00
|
|
|
|
2018-09-02 14:18:12 -07:00
|
|
|
InstantCommand::InstantCommand(Subsystem& subsystem) : Command(subsystem) {}
|
|
|
|
|
|
2018-08-19 22:43:21 -04:00
|
|
|
InstantCommand::InstantCommand(const wpi::Twine& name, Subsystem& subsystem)
|
|
|
|
|
: Command(name, subsystem) {}
|
|
|
|
|
|
2018-09-12 02:44:22 -04:00
|
|
|
InstantCommand::InstantCommand(std::function<void()> func) : m_func(func) {}
|
|
|
|
|
|
|
|
|
|
InstantCommand::InstantCommand(Subsystem& subsystem, std::function<void()> func)
|
|
|
|
|
: InstantCommand(subsystem) {
|
|
|
|
|
m_func = func;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InstantCommand::InstantCommand(const wpi::Twine& name,
|
|
|
|
|
std::function<void()> func)
|
|
|
|
|
: InstantCommand(name) {
|
|
|
|
|
m_func = func;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InstantCommand::InstantCommand(const wpi::Twine& name, Subsystem& subsystem,
|
|
|
|
|
std::function<void()> func)
|
|
|
|
|
: InstantCommand(name, subsystem) {
|
|
|
|
|
m_func = func;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InstantCommand::_Initialize() {
|
|
|
|
|
Command::_Initialize();
|
|
|
|
|
if (m_func) {
|
|
|
|
|
m_func();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-18 17:42:40 -05:00
|
|
|
bool InstantCommand::IsFinished() { return true; }
|