iceoryx_posh 2.0.5
Loading...
Searching...
No Matches
roudi_cmd_line_parser.hpp
1// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2// Copyright (c) 2020 - 2021 by Apex.AI Inc. All rights reserved.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16// SPDX-License-Identifier: Apache-2.0
17#ifndef IOX_POSH_ROUDI_ROUDI_CMD_LINE_PARSER_HPP
18#define IOX_POSH_ROUDI_ROUDI_CMD_LINE_PARSER_HPP
19
20#include "iceoryx_hoofs/cxx/expected.hpp"
21#include "iceoryx_hoofs/cxx/optional.hpp"
22#include "iceoryx_hoofs/internal/units/duration.hpp"
23#include "iceoryx_hoofs/log/logcommon.hpp"
24#include "iceoryx_posh/iceoryx_posh_types.hpp"
25#include "iceoryx_posh/roudi/cmd_line_args.hpp"
26#include "iceoryx_posh/version/compatibility_check_level.hpp"
27
28namespace iox
29{
30namespace config
31{
32enum class CmdLineParserResult
33{
34 UNKNOWN_OPTION_USED,
35 INFO_OUTPUT_ONLY
36};
37
39{
40 public:
41 enum class CmdLineArgumentParsingMode
42 {
43 ALL,
44 ONE
45 };
46
47 CmdLineParser() noexcept = default;
48 virtual ~CmdLineParser() noexcept = default;
49 CmdLineParser& operator=(const CmdLineParser& other) = delete;
50 CmdLineParser(const CmdLineParser& other) = delete;
51 CmdLineParser& operator=(CmdLineParser&&) = delete;
52 CmdLineParser(CmdLineParser&& other) = delete;
53
60 virtual cxx::expected<CmdLineArgs_t, CmdLineParserResult>
61 parse(int argc,
62 char* argv[],
63 const CmdLineArgumentParsingMode cmdLineParsingMode = CmdLineArgumentParsingMode::ALL) noexcept;
64
65 protected:
66 bool m_run{true};
67 iox::log::LogLevel m_logLevel{iox::log::LogLevel::kWarn};
68 roudi::MonitoringMode m_monitoringMode{roudi::MonitoringMode::ON};
69 version::CompatibilityCheckLevel m_compatibilityCheckLevel{version::CompatibilityCheckLevel::PATCH};
70 cxx::optional<uint16_t> m_uniqueRouDiId;
71 units::Duration m_processKillDelay{roudi::PROCESS_DEFAULT_KILL_DELAY};
72};
73
74} // namespace config
75} // namespace iox
76
77#endif // IOX_POSH_ROUDI_ROUDI_CMD_LINE_PARSER_HPP
Definition roudi_cmd_line_parser.hpp:39
virtual cxx::expected< CmdLineArgs_t, CmdLineParserResult > parse(int argc, char *argv[], const CmdLineArgumentParsingMode cmdLineParsingMode=CmdLineArgumentParsingMode::ALL) noexcept
process the passed command line arguments
MonitoringMode
Controls process alive monitoring. Upon timeout, a monitored process is removed and its resources are...
Definition iceoryx_posh_types.hpp:243