Orrery
A GPU-accelerated N-body gravitational simulator
Toggle main menu visibility
Loading...
Searching...
No Matches
config_file.hpp
Go to the documentation of this file.
1
#pragma once
2
53
54
#include <cstddef>
55
#include <filesystem>
56
#include <iosfwd>
57
#include <span>
58
#include <stdexcept>
59
#include <string>
60
#include <string_view>
61
62
#include "
orrery/sim/configuration.hpp
"
63
64
namespace
orrery::sim {
65
73
class
ConfigurationError
:
public
std::runtime_error {
74
public
:
78
ConfigurationError
(
const
std::string& message, std::string
origin
, std::size_t
line
);
79
81
[[nodiscard]]
const
std::string&
origin
() const noexcept {
return
origin_; }
82
84
[[nodiscard]] std::size_t
line
() const noexcept {
return
line_; }
85
86
private
:
87
std::string origin_;
88
std::size_t line_;
89
};
90
100
[[nodiscard]]
Configuration
parse_configuration
(std::istream& in, std::string_view origin);
101
116
void
apply_settings
(
Configuration
& configuration, std::span<const std::string> assignments,
117
std::string_view origin);
118
124
[[nodiscard]]
Configuration
read_configuration_file
(
const
std::filesystem::path& path);
125
136
void
write_configuration
(std::ostream& out,
const
Configuration
& configuration);
137
138
}
// namespace orrery::sim
orrery::sim::ConfigurationError::ConfigurationError
ConfigurationError(const std::string &message, std::string origin, std::size_t line)
origin is the file name, or whatever else names the stream for a caller that parsed something other t...
orrery::sim::ConfigurationError::line
std::size_t line() const noexcept
The line the problem was on, counting from one.
Definition
config_file.hpp:84
orrery::sim::ConfigurationError::origin
const std::string & origin() const noexcept
The name of what was being parsed.
Definition
config_file.hpp:81
orrery::sim::write_configuration
void write_configuration(std::ostream &out, const Configuration &configuration)
Write configuration in the format above.
orrery::sim::parse_configuration
Configuration parse_configuration(std::istream &in, std::string_view origin)
Read a configuration from in, whose name for error messages is origin.
orrery::sim::apply_settings
void apply_settings(Configuration &configuration, std::span< const std::string > assignments, std::string_view origin)
Apply key = value assignments on top of an existing configuration.
orrery::sim::read_configuration_file
Configuration read_configuration_file(const std::filesystem::path &path)
Read a configuration from a file.
configuration.hpp
Everything a run is, as data.
orrery::sim::Configuration
A whole run, as data.
Definition
configuration.hpp:332
orrery
sim
config_file.hpp
Generated by
1.17.0