AP_Scripting.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>.
  12. */
  13. #pragma once
  14. #ifdef ENABLE_SCRIPTING
  15. #include <AP_Common/AP_Common.h>
  16. #include <AP_Param/AP_Param.h>
  17. class AP_Scripting
  18. {
  19. public:
  20. AP_Scripting();
  21. /* Do not allow copies */
  22. AP_Scripting(const AP_Scripting &other) = delete;
  23. AP_Scripting &operator=(const AP_Scripting&) = delete;
  24. bool init(void);
  25. static AP_Scripting * get_singleton(void) { return _singleton; }
  26. static const struct AP_Param::GroupInfo var_info[];
  27. private:
  28. void load_script(const char *filename); // load a script from a file
  29. void thread(void); // main script execution thread
  30. AP_Int8 _enable;
  31. AP_Int32 _script_vm_exec_count;
  32. AP_Int32 _script_heap_size;
  33. AP_Int8 _debug_level;
  34. static AP_Scripting *_singleton;
  35. };
  36. namespace AP {
  37. AP_Scripting * scripting(void);
  38. };
  39. #endif // ENABLE_SCRIPTING