Now you can download a copy of these docs so you can use them offline! Download now
Scheduler.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2011. 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 $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef __SCHEDULER_H__
8 #define __SCHEDULER_H__
9 
10 #include "Commands/Command.h"
11 #include "ErrorBase.h"
12 #include "SmartDashboard/NamedSendable.h"
13 #include "networktables/NetworkTable.h"
14 #include "networktables2/type/NumberArray.h"
15 #include "networktables2/type/StringArray.h"
16 #include "SmartDashboard/SmartDashboard.h"
17 #include <list>
18 #include <map>
19 #include <set>
20 #include <vector>
21 
22 class ButtonScheduler;
23 class Subsystem;
24 
25 class Scheduler : public ErrorBase, public NamedSendable
26 {
27 public:
28  static Scheduler *GetInstance();
29 
30  void AddCommand(Command* command);
31  void AddButton(ButtonScheduler* button);
32  void RegisterSubsystem(Subsystem *subsystem);
33  void Run();
34  void Remove(Command *command);
35  void RemoveAll();
36  void SetEnabled(bool enabled);
37 
38  void UpdateTable();
39  std::string GetSmartDashboardType();
40  void InitTable(ITable *subTable);
41  ITable * GetTable();
42  std::string GetName();
43  std::string GetType();
44 
45 private:
46  Scheduler();
47  virtual ~Scheduler();
48 
49  void ProcessCommandAddition(Command *command);
50 
51  static Scheduler *_instance;
52  Command::SubsystemSet m_subsystems;
53  SEM_ID m_buttonsLock;
54  typedef std::vector<ButtonScheduler *> ButtonVector;
55  ButtonVector m_buttons;
56  typedef std::vector<Command *> CommandVector;
57  SEM_ID m_additionsLock;
58  CommandVector m_additions;
59  typedef std::set<Command *> CommandSet;
60  CommandSet m_commands;
61  bool m_adding;
62  bool m_enabled;
63  StringArray *commands;
64  NumberArray *ids;
65  NumberArray *toCancel;
66  ITable *m_table;
67  bool m_runningCommandsChanged;
68 };
69 #endif
70 
std::string GetName()
Definition: Scheduler.cpp:263
Definition: ITable.h:26
void Run()
Definition: Scheduler.cpp:130
void AddCommand(Command *command)
Definition: Scheduler.cpp:63
std::string GetSmartDashboardType()
Definition: Scheduler.cpp:271
void InitTable(ITable *subTable)
Definition: Scheduler.cpp:275
void UpdateTable()
Definition: Scheduler.cpp:225
void Remove(Command *command)
Definition: Scheduler.cpp:197
void RegisterSubsystem(Subsystem *subsystem)
Definition: Scheduler.cpp:185
ITable * GetTable()
Definition: Scheduler.cpp:286
static Scheduler * GetInstance()
Definition: Scheduler.cpp:47

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6