iceoryx_posh  2.0.2
roudi_config_file_provider.hpp
1 // Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 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_CONFIG_FILE_PROVIDER_HPP
18 #define IOX_POSH_ROUDI_ROUDI_CONFIG_FILE_PROVIDER_HPP
19 
20 #include "iceoryx_hoofs/cxx/expected.hpp"
21 #include "iceoryx_hoofs/cxx/string.hpp"
22 #include "iceoryx_posh/iceoryx_posh_config.hpp"
23 #include "iceoryx_posh/iceoryx_posh_types.hpp"
24 
25 namespace iox
26 {
27 namespace roudi
28 {
39 {
40  NO_GENERAL_SECTION,
41  INVALID_CONFIG_FILE_VERSION,
42  NO_SEGMENTS,
43  MAX_NUMBER_OF_SEGMENTS_EXCEEDED,
44  SEGMENT_WITHOUT_MEMPOOL,
45  MAX_NUMBER_OF_MEMPOOLS_PER_SEGMENT_EXCEEDED,
46  MEMPOOL_WITHOUT_CHUNK_SIZE,
47  MEMPOOL_WITHOUT_CHUNK_COUNT,
48  EXCEPTION_IN_PARSER
49 };
50 
51 constexpr const char* ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS[] = {"NO_GENERAL_SECTION",
52  "INVALID_CONFIG_FILE_VERSION",
53  "NO_SEGMENTS",
54  "MAX_NUMBER_OF_SEGMENTS_EXCEEDED",
55  "SEGMENT_WITHOUT_MEMPOOL",
56  "MAX_NUMBER_OF_MEMPOOLS_PER_SEGMENT_EXCEEDED",
57  "MEMPOOL_WITHOUT_CHUNK_SIZE",
58  "MEMPOOL_WITHOUT_CHUNK_COUNT",
59  "EXCEPTION_IN_PARSER"};
60 
63 {
64  public:
68  virtual cxx::expected<RouDiConfig_t, RouDiConfigFileParseError> parse() noexcept = 0;
69 
70  protected:
71  ConfigFilePathString_t m_customConfigFilePath;
72 };
73 
74 } // namespace roudi
75 } // namespace iox
76 
77 #endif // IOX_POSH_ROUDI_ROUDI_CONFIG_FILE_PROVIDER_HPP
Base class for a config file provider.
Definition: roudi_config_file_provider.hpp:63
virtual cxx::expected< RouDiConfig_t, RouDiConfigFileParseError > parse() noexcept=0
interface to parse a config file which needs to be implemented for a custom parser
RouDiConfigFileParseError
This are the errors which can occur when a config file is parsed NO_GENERAL_SECTION - the section for...
Definition: roudi_config_file_provider.hpp:39