Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
subsystem.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_SUBSYSTEM_HPP_
25#define TAPROOT_SUBSYSTEM_HPP_
26
27#include <cstdint>
28
29#include "tap/util_macros.hpp"
30
31namespace tap
32{
33class Drivers;
34namespace control
35{
36class Command;
37
54{
55public:
57
58 virtual ~Subsystem();
59
64 virtual void initialize() {}
65
71
82 mockable void setDefaultCommand(Command* defaultCommand);
83
90 mockable inline Command* getDefaultCommand() const { return defaultCommand; }
91
104 virtual void refresh() {}
105
112 virtual void refreshSafeDisconnect() {}
113
123 mockable void setTestCommand(Command* testCommand);
124
131 mockable inline Command* getTestCommand() const { return testCommand; }
132
133 virtual const char* getName() const;
134
135 mockable inline int getGlobalIdentifier() const { return globalIdentifier; }
136
137protected:
139
140private:
141 Command* defaultCommand;
142
143 Command* testCommand;
144
149 const int globalIdentifier;
150
151#if defined(PLATFORM_HOSTED) && defined(ENV_UNIT_TESTS)
152 //> Testing Related Stuff ---
153public:
154 // Define default constructor to allow NiceMocks to call default constructor and actually
155 // construct :/, because setpoint subsystem inherits virtually from Subsystem *sigh*
156 Subsystem();
157#endif
158}; // class Subsystem
159
160} // namespace control
161
162} // namespace tap
163
164#endif // TAPROOT_SUBSYSTEM_HPP_
Definition drivers.hpp:70
Definition command.hpp:44
Definition subsystem.hpp:54
mockable void setTestCommand(Command *testCommand)
Definition subsystem.cpp:58
virtual void refreshSafeDisconnect()
Definition subsystem.hpp:112
virtual ~Subsystem()
Definition subsystem.cpp:42
mockable int getGlobalIdentifier() const
Definition subsystem.hpp:135
mockable Command * getTestCommand() const
Definition subsystem.hpp:131
virtual void initialize()
Definition subsystem.hpp:64
void registerAndInitialize()
Definition subsystem.cpp:44
mockable void setDefaultCommand(Command *defaultCommand)
Definition subsystem.cpp:50
virtual const char * getName() const
Definition subsystem.cpp:66
mockable Command * getDefaultCommand() const
Definition subsystem.hpp:90
Drivers * drivers
Definition subsystem.hpp:138
virtual void refresh()
Definition subsystem.hpp:104
Definition ballistics.cpp:29
tap::Drivers Drivers
Definition drivers.hpp:11
#define mockable
Wrap class functions that are not already virtual in this function if you wish to mock them.
Definition util_macros.hpp:38