WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Trigger.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2011-2016. 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 <memory>
11 #include <string>
12 
13 #include "SmartDashboard/Sendable.h"
14 
15 namespace frc {
16 
17 class Command;
18 
34 class Trigger : public Sendable {
35  public:
36  Trigger() = default;
37  virtual ~Trigger() = default;
38  bool Grab();
39  virtual bool Get() = 0;
40  void WhenActive(Command* command);
41  void WhileActive(Command* command);
42  void WhenInactive(Command* command);
43  void CancelWhenActive(Command* command);
44  void ToggleWhenActive(Command* command);
45 
46  void InitTable(std::shared_ptr<ITable> subtable) override;
47  std::shared_ptr<ITable> GetTable() const override;
48  std::string GetSmartDashboardType() const override;
49 
50  protected:
51  std::shared_ptr<ITable> m_table;
52 };
53 
54 } // namespace frc
void InitTable(std::shared_ptr< ITable > subtable) override
Initializes a table for this sendable object.
Definition: Trigger.cpp:54
std::string GetSmartDashboardType() const override
Definition: Trigger.cpp:52
Definition: Sendable.h:17
The Command class is at the very core of the entire command framework.
Definition: Command.h:52
This class provides an easy way to link commands to inputs.
Definition: Trigger.h:34
std::shared_ptr< ITable > GetTable() const override
Definition: Trigger.cpp:61