Loading...
Searching...
No Matches
TomlConfigLoader.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4
5#pragma once
6
7#ifdef USE_CAPNP
8#include <capnp/message.h>
9
10#include <stdexcept>
11#include <string>
12
13namespace gpr::io {
14
18class ConfigValueRangeError : public std::invalid_argument {
19public:
20 enum class Reason { NotFinite, NotIntegral, OutOfRange };
21
22 ConfigValueRangeError(std::string key, Reason reason);
23
24 [[nodiscard]] const std::string& key() const noexcept
25 {
26 return key_;
27 }
28 [[nodiscard]] Reason reason() const noexcept
29 {
30 return reason_;
31 }
32
33private:
34 std::string key_;
35 Reason reason_;
36};
37
48void loadInputParametersFromToml(const std::string& path,
49 capnp::MallocMessageBuilder& message);
50
51} // namespace gpr::io
52#endif