7413590519
Replace hand-rolled argument parsing with CLI11-backed parse paths for streamer runtime config and simulator runtime options. Simulator help text is now generated from CLI11 app definitions to keep parser/help output in sync, while preserving legacy validation messages and exit semantics used by automation.
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
#include "cvmmap_streamer/ipc/contracts.hpp"
|
|
|
|
namespace cvmmap_streamer::sim {
|
|
|
|
struct RuntimeConfig {
|
|
std::uint32_t frames{360};
|
|
std::uint32_t fps{60};
|
|
std::uint16_t width{64};
|
|
std::uint16_t height{48};
|
|
std::optional<std::uint32_t> emit_reset_at{};
|
|
std::optional<std::uint32_t> emit_reset_every{};
|
|
std::optional<std::uint32_t> switch_format_at{};
|
|
std::optional<std::uint16_t> switch_width{};
|
|
std::optional<std::uint16_t> switch_height{};
|
|
std::string label{"sim"};
|
|
std::string shm_name{"cvmmap_sim"};
|
|
std::string zmq_endpoint{"ipc:///tmp/cvmmap_sim"};
|
|
std::uint8_t channels{3};
|
|
ipc::Depth depth{ipc::Depth::U8};
|
|
ipc::PixelFormat pixel_format{ipc::PixelFormat::BGR};
|
|
|
|
[[nodiscard]]
|
|
std::uint32_t payload_size_bytes() const;
|
|
};
|
|
|
|
enum class ParseStatus {
|
|
Ok,
|
|
Help,
|
|
Error,
|
|
};
|
|
|
|
struct ParseResult {
|
|
ParseStatus status{ParseStatus::Ok};
|
|
RuntimeConfig config{};
|
|
std::string message{};
|
|
int exit_code{0};
|
|
};
|
|
|
|
std::expected<RuntimeConfig, std::string> parse_runtime_config(int argc,
|
|
char **argv);
|
|
void print_help();
|
|
ParseResult parse_runtime_config_with_cli11(
|
|
int argc, char **argv, std::string_view executable_name = "cvmmap_sim");
|
|
|
|
} // namespace cvmmap_streamer::sim
|