18#ifndef IOX_POSH_GW_TOML_FILE_CONFIG_PARSER_HPP
19#define IOX_POSH_GW_TOML_FILE_CONFIG_PARSER_HPP
21#include "iceoryx_hoofs/cxx/expected.hpp"
22#include "iceoryx_posh/gateway/gateway_config.hpp"
23#include "iceoryx_posh/iceoryx_posh_types.hpp"
32enum TomlGatewayConfigParseError
35 INCOMPLETE_CONFIGURATION,
36 INCOMPLETE_SERVICE_DESCRIPTION,
37 INVALID_SERVICE_DESCRIPTION,
39 MAXIMUM_NUMBER_OF_ENTRIES_EXCEEDED
42constexpr const char* TOML_GATEWAY_CONFIG_FILE_PARSE_ERROR_STRINGS[] = {
"FILE_NOT_FOUND",
43 "INCOMPLETE_CONFIGURATION",
44 "INCOMPLETE_SERVICE_DESCRIPTION",
45 "INVALID_SERVICE_DESCRIPTION",
46 "EXCEPTION_IN_PARSER",
47 "MAXIMUM_NUMBER_OF_ENTRIES_EXCEEDED"};
49static constexpr const char REGEX_VALID_CHARACTERS[] =
"^[a-zA-Z_][a-zA-Z0-9_]*$";
51static constexpr const char DEFAULT_CONFIG_FILE_PATH[] =
"/etc/iceoryx/gateway_config.toml";
52static constexpr const char GATEWAY_CONFIG_SERVICE_TABLE_NAME[] =
"services";
53static constexpr const char GATEWAY_CONFIG_SERVICE_NAME[] =
"service";
54static constexpr const char GATEWAY_CONFIG_SERVICE_INSTANCE_NAME[] =
"instance";
55static constexpr const char GATEWAY_CONFIG_SERVICE_EVENT_NAME[] =
"event";
63 static cxx::expected<GatewayConfig, TomlGatewayConfigParseError>
64 parse(
const roudi::ConfigFilePathString_t& path = roudi::ConfigFilePathString_t(DEFAULT_CONFIG_FILE_PATH))
noexcept;
67 static cxx::expected<TomlGatewayConfigParseError> validate(
const cpptoml::table& parsedToml)
noexcept;
70 static bool hasInvalidCharacter(
const std::string& s)
noexcept;
The TomlGatewayConfigParser class provides methods for parsing gateway configs from toml text files.
Definition toml_gateway_config_parser.hpp:61