Split the two command implementations into separate libraries (#2012)

This will allow us at the user code side to determine to include old commands, new commands or both.
This commit is contained in:
Thad House
2019-11-01 21:58:54 -07:00
committed by Peter Johnson
parent 2ad15cae19
commit 509819d83f
271 changed files with 470 additions and 91 deletions

View File

@@ -0,0 +1,73 @@
/*----------------------------------------------------------------------------*/
/* 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
#include <frc/smartdashboard/Sendable.h>
#include <frc/smartdashboard/SendableHelper.h>
#include <string>
#include <wpi/SmallSet.h>
#include <wpi/Twine.h>
#include "Command.h"
namespace frc2 {
/**
* A Sendable base class for Commands.
*/
class CommandBase : public Command,
public frc::Sendable,
public frc::SendableHelper<CommandBase> {
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;
/**
* Sets the name of this Command.
*
* @param name name
*/
void SetName(const wpi::Twine& name);
/**
* Gets the name of this Command.
*
* @return Name
*/
std::string GetName() const override;
/**
* Gets the subsystem name of this Command.
*
* @return Subsystem name
*/
std::string GetSubsystem() const;
/**
* Sets the subsystem name of this Command.
*
* @param subsystem subsystem name
*/
void SetSubsystem(const wpi::Twine& subsystem);
void InitSendable(frc::SendableBuilder& builder) override;
protected:
CommandBase();
wpi::SmallSet<Subsystem*, 4> m_requirements;
};
} // namespace frc2