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
"
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
AppLogic.hpp
Application logic.
ConfigManager.hpp
Config management for the Project.
Version.hpp
Provides the version of the project.
PROJECT_VERSION_STRING
#define PROJECT_VERSION_STRING
Project Version String in the form "major.minor.patch".
Definition
Version.hpp:32
main
int main(int argc, const char *argv[])
Definition
main.cpp:65
NAV::AppLogic::processCommandLineArguments
int processCommandLineArguments(int argc, const char *argv[])
Processes the command line arguments.
Definition
AppLogic.cpp:43
NAV::ConfigManager::initialize
void initialize()
Initializes the config manager. Call this function before using other functions.
Definition
ConfigManager.cpp:37
NAV::ConfigManager::GetProgramOptions
const boost::program_options::options_description & GetProgramOptions()
Get the Program Options object.
Definition
ConfigManager.cpp:74
src
main.cpp
Generated by
1.13.2