-
- Downloads
Clean up of app.h
app.h, generated from app.h_in, has unnecessary code duplication and isn't a header file (it defines globals, static functions and doesn't have a header guard, moreover, it has a 'using namespace std;'). Because of this, a real headerfile that declares the stuff defined in apps.h was missing leading to even more code duplication: scattered forward declarations in .cpp files and an often repeated type of std::map<std::string, px4_main_t>. This patch moves cmake/qurt/apps.h_in to src/platforms/apps.cpp.in (with some changes) and removes cmake/posix/apps.h_in. Then src/platforms/apps.cpp.in is split into src/platforms/apps.cpp.in and src/platforms/apps.h.in, splitting declarations from definitions. A typedef is defined for the map (apps_map_type). The main difference between cmake/posix/apps.h_in and cmake/qurt/apps.h_in was that the first defined a global 'apps', while qurt stores the apps in QShell. I opted to get rid of the global variable (which are in general evil for various reasons) and used the API of cmake/qurt/apps.h_in where a provided 'apps' map is initialized with a call to init_app_map. Thus removing the existing code duplication.
Showing
- cmake/posix/apps.h_in 0 additions, 88 deletionscmake/posix/apps.h_in
- cmake/posix/px4_impl_posix.cmake 6 additions, 4 deletionscmake/posix/px4_impl_posix.cmake
- cmake/qurt/px4_impl_qurt.cmake 6 additions, 3 deletionscmake/qurt/px4_impl_qurt.cmake
- src/drivers/qshell/qurt/qshell.cpp 5 additions, 12 deletionssrc/drivers/qshell/qurt/qshell.cpp
- src/drivers/qshell/qurt/qshell.h 2 additions, 3 deletionssrc/drivers/qshell/qurt/qshell.h
- src/firmware/posix/CMakeLists.txt 5 additions, 5 deletionssrc/firmware/posix/CMakeLists.txt
- src/firmware/qurt/CMakeLists.txt 3 additions, 3 deletionssrc/firmware/qurt/CMakeLists.txt
- src/platforms/apps.cpp.in 74 additions, 0 deletionssrc/platforms/apps.cpp.in
- src/platforms/apps.h.in 27 additions, 0 deletionssrc/platforms/apps.h.in
- src/platforms/posix/main.cpp 11 additions, 1 deletionsrc/platforms/posix/main.cpp
- src/platforms/qurt/px4_layer/main.cpp 4 additions, 6 deletionssrc/platforms/qurt/px4_layer/main.cpp
Loading
Please register or sign in to comment