0.4.1
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
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"
15
16namespace
17{
18
19int Main(int argc, const char* argv[]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
20{
21 // Config Manager object
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"
38 return EXIT_SUCCESS;
39 }
40 }
41
42 try
43 {
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
58int 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
65int main(int argc, const char* argv[])
66{
67 return Main(argc, argv);
68}
69
70#endif
Application logic.
Config management for the Project.
Provides the version of the project.
#define PROJECT_VERSION_STRING
Project Version String in the form "major.minor.patch".
Definition Version.hpp:32
int main(int argc, const char *argv[])
Definition main.cpp:65
int processCommandLineArguments(int argc, const char *argv[])
Processes the command line arguments.
Definition AppLogic.cpp:43
void initialize()
Initializes the config manager. Call this function before using other functions.
const boost::program_options::options_description & GetProgramOptions()
Get the Program Options object.