From 9126646fef77b47d8e85b67937990d7991d1f439 Mon Sep 17 00:00:00 2001 From: Jonathan Leitschuh Date: Tue, 12 Aug 2014 15:17:57 -0400 Subject: [PATCH] Adds the Trigger template and adds WPILib.h import to all templates Change-Id: Ibaecc4802822cf4c0a4a5bf9ddc960b96e40d1e9 --- .../templates/command-based/Command.h | 1 + .../templates/command-based/CommandBase.h | 1 + .../templates/command-based/CommandGroup.h | 1 + .../templates/command-based/ExampleCommand.h | 1 + .../templates/command-based/PIDSubsystem.cpp | 3 --- .../templates/command-based/RobotMap.h | 1 + .../templates/command-based/Trigger.cpp | 21 ++++++++----------- .../templates/command-based/Trigger.h | 16 ++++++++------ 8 files changed, 24 insertions(+), 21 deletions(-) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.h index b234d35ae1..1cb0db42cb 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.h +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.h @@ -2,6 +2,7 @@ #define $classname_H #include "../CommandBase.h" +#include "WPILib.h" class $classname: public CommandBase { diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.h index f949a530ef..b4492ee38e 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.h +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.h @@ -5,6 +5,7 @@ #include "Commands/Command.h" #include "Subsystems/ExampleSubsystem.h" #include "OI.h" +#include "WPILib.h" /** * The base for all commands. All atomic commands should subclass CommandBase. diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.h index b86ae9aca0..dfa979c266 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.h +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.h @@ -2,6 +2,7 @@ #define $classname_H #include "Commands/CommandGroup.h" +#include "WPILib.h" class $classname: public CommandGroup { diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.h index 0e7e52a467..8e0b3d1b73 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.h +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.h @@ -2,6 +2,7 @@ #define EXAMPLE_COMMAND_H #include "../CommandBase.h" +#include "WPILib.h" class ExampleCommand: public CommandBase { diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.cpp index be88166533..53647fc09f 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.cpp @@ -3,9 +3,6 @@ #include "SmartDashboard/SmartDashboard.h" #include "LiveWindow/LiveWindow.h" -#@autogenerated_code("pid", "") -#parse("${exporter-path}PIDSubsystem-pid.cpp") -#end $classname::$classname() : PIDSubsystem("$classname", 1.0, 0.0, 0.0) { diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/RobotMap.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/RobotMap.h index 61f189678d..54742835fc 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/RobotMap.h +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/RobotMap.h @@ -1,6 +1,7 @@ #ifndef ROBOTMAP_H #define ROBOTMAP_H +#include "WPILib.h" /** * The RobotMap is a mapping from the ports sensors and actuators are wired into diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.cpp index 7169ecb480..0425fa10c9 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.cpp @@ -1,15 +1,12 @@ -// TODO: convert into C++ template -#error "This is not a C++ file. I have no idea what this is doing here, so I'm leaving this message here to let someone else clean this up" -import edu.wpi.first.wpilibj.command.Trigger; +#include "$classname.h" -/** - * New and improved C++ - */ -public class $classname extends Trigger +$classname::$classname() { -public: - bool get() - { - return false; - } + } + +bool $classname::Get() +{ + return false; +} + diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.h index c85dfad622..e2a666e0ba 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.h +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.h @@ -1,9 +1,13 @@ -// TODO: convert into C++ template -#error "This is not a C++ file. I have no idea what this is doing here, so I'm leaving this message here to let someone else clean this up" -import edu.wpi.first.wpilibj.command.Trigger; +#ifndef $classname_H +#define $classname_H -public class $classname extends Trigger +#include "WPILib.h" + +class $classname: public Trigger { public: - bool get(); -} + $classname(); + bool Get(); +}; + +#endif