iceoryx_posh 2.0.3
cmd_line_args.hpp
1// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// SPDX-License-Identifier: Apache-2.0
16#ifndef IOX_POSH_ROUDI_CMD_LINE_ARGS_HPP
17#define IOX_POSH_ROUDI_CMD_LINE_ARGS_HPP
18
19#include "iceoryx_hoofs/log/logstream.hpp"
20#include "iceoryx_posh/iceoryx_posh_types.hpp"
21#include "iceoryx_posh/version/compatibility_check_level.hpp"
22
23#include <cstdint>
24
25namespace iox
26{
27namespace config
28{
30{
31 roudi::MonitoringMode monitoringMode{roudi::MonitoringMode::ON};
32 iox::log::LogLevel logLevel{iox::log::LogLevel::kWarn};
33 version::CompatibilityCheckLevel compatibilityCheckLevel{version::CompatibilityCheckLevel::PATCH};
34 units::Duration processKillDelay{roudi::PROCESS_DEFAULT_KILL_DELAY};
35 cxx::optional<uint16_t> uniqueRouDiId{cxx::nullopt};
36 bool run{true};
37 roudi::ConfigFilePathString_t configFilePath;
38};
39
40inline iox::log::LogStream& operator<<(iox::log::LogStream& logstream, const CmdLineArgs_t& cmdLineArgs) noexcept
41{
42 logstream << "Log level: " << cmdLineArgs.logLevel << "\n";
43 logstream << "Monitoring mode: " << cmdLineArgs.monitoringMode << "\n";
44 logstream << "Compatibility check level: " << cmdLineArgs.compatibilityCheckLevel << "\n";
45 cmdLineArgs.uniqueRouDiId.and_then([&logstream](auto& id) { logstream << "Unique RouDi ID: " << id << "\n"; })
46 .or_else([&logstream] { logstream << "Unique RouDi ID: < unset >\n"; });
47 logstream << "Process kill delay: " << cmdLineArgs.processKillDelay.toSeconds() << " s\n";
48 if (!cmdLineArgs.configFilePath.empty())
49 {
50 logstream << "Config file used is: " << cmdLineArgs.configFilePath;
51 }
52 else
53 {
54 logstream << "Config file used is: < none >";
55 }
56 return logstream;
57}
58} // namespace config
59} // namespace iox
60
61#endif // IOX_POSH_ROUDI_CMD_LINE_ARGS_HPP
MonitoringMode
Controls process alive monitoring. Upon timeout, a monitored process is removed and its resources are...
Definition: iceoryx_posh_types.hpp:243
Definition: cmd_line_args.hpp:30