Commit | Line | Data |
---|---|---|
df27a6a3 | 1 | /* |
4cff3ded AW |
2 | This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl). |
3 | Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
4 | Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
df27a6a3 | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
4cff3ded AW |
6 | */ |
7 | ||
8 | #ifndef MODULE_H | |
9 | #define MODULE_H | |
10 | ||
b6c86164 AW |
11 | #include <string> |
12 | using std::string; | |
b6c86164 | 13 | |
af9072ee | 14 | // See : http://smoothieware.org/listofevents |
968cfcba | 15 | |
af9072ee | 16 | enum _EVENT_ENUM { |
968cfcba MM |
17 | #define EVENT(name, func) name, |
18 | #include "Event.h" | |
19 | #undef EVENT | |
af9072ee MM |
20 | NUMBER_OF_DEFINED_EVENTS |
21 | }; | |
22 | ||
ab2a4410 MM |
23 | class Module; |
24 | ||
25 | typedef void (Module::*ModuleCallback)(void * argument); | |
26 | ||
27 | extern const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS]; | |
28 | ||
4cff3ded | 29 | // Module base class |
df27a6a3 | 30 | // All modules must extend this class, see http://smoothieware.org/moduleexample |
4cff3ded AW |
31 | class Kernel; |
32 | class Module { | |
33 | public: | |
34 | Module(); | |
98761c28 | 35 | virtual ~Module(); |
4cff3ded | 36 | virtual void on_module_loaded(); |
98761c28 | 37 | void register_for_event( _EVENT_ENUM event_id); |
968cfcba MM |
38 | #define EVENT(name, func) virtual void func (void*); |
39 | #include "Event.h" | |
40 | #undef EVENT | |
4cff3ded AW |
41 | }; |
42 | ||
43 | #endif |