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 #ifndef __TRIGGER_H__
9 #define __TRIGGER_H__
10 
11 #include "SmartDashboard/Sendable.h"
12 #include <memory>
13 
14 class Command;
15 
33 class Trigger : public Sendable {
34  public:
35  Trigger() = default;
36  virtual ~Trigger() = default;
37  bool Grab();
38  virtual bool Get() = 0;
39  void WhenActive(Command *command);
40  void WhileActive(Command *command);
41  void WhenInactive(Command *command);
42  void CancelWhenActive(Command *command);
43  void ToggleWhenActive(Command *command);
44 
45  virtual void InitTable(std::shared_ptr<ITable> table);
46  virtual std::shared_ptr<ITable> GetTable() const;
47  virtual std::string GetSmartDashboardType() const;
48 
49  protected:
50  std::shared_ptr<ITable> m_table;
51 };
52 
53 #endif
Definition: Sendable.h:15
virtual std::shared_ptr< ITable > GetTable() const
Definition: Trigger.cpp:62
virtual std::string GetSmartDashboardType() const
Definition: Trigger.cpp:53
The Command class is at the very core of the entire command framework.
Definition: Command.h:54
This class provides an easy way to link commands to inputs.
Definition: Trigger.h:33
virtual void InitTable(std::shared_ptr< ITable > table)
Initializes a table for this sendable object.
Definition: Trigger.cpp:55