2019-08-25 23:55:59 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
|
|
|
|
/* 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. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
#include <initializer_list>
|
2019-08-25 23:55:59 -04:00
|
|
|
#include <string>
|
|
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
#include <frc/smartdashboard/Sendable.h>
|
|
|
|
|
#include <frc/smartdashboard/SendableHelper.h>
|
2019-08-25 23:55:59 -04:00
|
|
|
#include <wpi/SmallSet.h>
|
2019-09-14 15:22:54 -05:00
|
|
|
#include <wpi/Twine.h>
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-11-05 20:52:49 -08:00
|
|
|
#include "frc2/command/Command.h"
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
namespace frc2 {
|
|
|
|
|
/**
|
|
|
|
|
* A Sendable base class for Commands.
|
|
|
|
|
*/
|
2019-09-14 15:22:54 -05:00
|
|
|
class CommandBase : public Command,
|
|
|
|
|
public frc::Sendable,
|
|
|
|
|
public frc::SendableHelper<CommandBase> {
|
2019-08-25 23:55:59 -04:00
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* Adds the specified requirements to the command.
|
|
|
|
|
*
|
|
|
|
|
* @param requirements the requirements to add
|
|
|
|
|
*/
|
|
|
|
|
void AddRequirements(std::initializer_list<Subsystem*> requirements);
|
|
|
|
|
|
|
|
|
|
void AddRequirements(wpi::SmallSet<Subsystem*, 4> requirements);
|
|
|
|
|
|
|
|
|
|
wpi::SmallSet<Subsystem*, 4> GetRequirements() const override;
|
|
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
/**
|
|
|
|
|
* Sets the name of this Command.
|
|
|
|
|
*
|
|
|
|
|
* @param name name
|
|
|
|
|
*/
|
|
|
|
|
void SetName(const wpi::Twine& name);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
/**
|
|
|
|
|
* Gets the name of this Command.
|
|
|
|
|
*
|
|
|
|
|
* @return Name
|
|
|
|
|
*/
|
2019-08-25 23:55:59 -04:00
|
|
|
std::string GetName() const override;
|
|
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
/**
|
|
|
|
|
* Gets the subsystem name of this Command.
|
|
|
|
|
*
|
|
|
|
|
* @return Subsystem name
|
|
|
|
|
*/
|
|
|
|
|
std::string GetSubsystem() const;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
/**
|
|
|
|
|
* Sets the subsystem name of this Command.
|
|
|
|
|
*
|
|
|
|
|
* @param subsystem subsystem name
|
|
|
|
|
*/
|
|
|
|
|
void SetSubsystem(const wpi::Twine& subsystem);
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
void InitSendable(frc::SendableBuilder& builder) override;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
CommandBase();
|
|
|
|
|
wpi::SmallSet<Subsystem*, 4> m_requirements;
|
|
|
|
|
};
|
|
|
|
|
} // namespace frc2
|