| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // This file is part of INSTINCT, the INS Toolkit for Integrated | ||
| 2 | // Navigation Concepts and Training by the Institute of Navigation of | ||
| 3 | // the University of Stuttgart, Germany. | ||
| 4 | // | ||
| 5 | // This Source Code Form is subject to the terms of the Mozilla Public | ||
| 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| 7 | // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| 8 | |||
| 9 | #include <iostream> | ||
| 10 | |||
| 11 | #include "internal/Version.hpp" | ||
| 12 | |||
| 13 | #include "internal/AppLogic.hpp" | ||
| 14 | #include "internal/ConfigManager.hpp" | ||
| 15 | |||
| 16 | namespace | ||
| 17 | { | ||
| 18 | |||
| 19 | ✗ | int Main(int argc, const char* argv[]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) | |
| 20 | { | ||
| 21 | // Config Manager object | ||
| 22 | ✗ | NAV::ConfigManager::initialize(); | |
| 23 | |||
| 24 | ✗ | if (argc == 2) | |
| 25 | { | ||
| 26 | // User requested the version of the program | ||
| 27 | ✗ | if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) | |
| 28 | { | ||
| 29 | ✗ | std::cout << PROJECT_VERSION_STRING << '\n'; | |
| 30 | ✗ | return EXIT_SUCCESS; | |
| 31 | } | ||
| 32 | |||
| 33 | // User requested the help text of the program | ||
| 34 | ✗ | if (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) | |
| 35 | { | ||
| 36 | ✗ | std::cout << "INSTINCT " << PROJECT_VERSION_STRING << " - INS Toolkit for Integrated Navigation Concepts and Training\n\n" | |
| 37 | ✗ | << NAV::ConfigManager::GetProgramOptions() << '\n'; | |
| 38 | ✗ | return EXIT_SUCCESS; | |
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | try | ||
| 43 | { | ||
| 44 | ✗ | return NAV::AppLogic::processCommandLineArguments(argc, argv); | |
| 45 | } | ||
| 46 | ✗ | catch (const std::exception& e) | |
| 47 | { | ||
| 48 | ✗ | std::cerr << "Critical Event occurred: " << e.what() << '\n'; | |
| 49 | ✗ | return EXIT_FAILURE; | |
| 50 | ✗ | } | |
| 51 | } | ||
| 52 | } // namespace | ||
| 53 | |||
| 54 | #if defined(_WIN32) && !defined(_CONSOLE) | ||
| 55 | #include <windows.h> | ||
| 56 | #include <stdlib.h> // __argc, argv | ||
| 57 | |||
| 58 | int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) | ||
| 59 | { | ||
| 60 | return Main(__argc, const_cast<const char**>(__argv)); | ||
| 61 | } | ||
| 62 | |||
| 63 | #else | ||
| 64 | |||
| 65 | ✗ | int main(int argc, const char* argv[]) | |
| 66 | { | ||
| 67 | ✗ | return Main(argc, argv); | |
| 68 | } | ||
| 69 | |||
| 70 | #endif | ||
| 71 |