AsmGrader 0.0.0
Loading...
Searching...
No Matches
app.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <optional>
8#include <utility>
9
10namespace asmgrader {
11
13{
14public:
15 explicit App(ProgramOptions opts)
16 : OPTS{std::move(opts)} {}
17
18 virtual ~App() = default;
19
20 const ProgramOptions& get_opts() const noexcept { return OPTS; }
21
22 int run() noexcept {
23 std::optional res = wrap_throwable_fn(&App::run_impl, this);
24
25 return res.value_or(-1);
26 }
27
29
30protected:
31 virtual int run_impl() = 0;
32};
33
34} // namespace asmgrader
Definition app.hpp:13
virtual int run_impl()=0
const ProgramOptions & get_opts() const noexcept
Definition app.hpp:20
const ProgramOptions OPTS
Definition app.hpp:28
int run() noexcept
Definition app.hpp:22
App(ProgramOptions opts)
Definition app.hpp:15
virtual ~App()=default
A trivially-movable, but non-copyable type.
Definition class_traits.hpp:14
Definition asm_buffer.hpp:19
std::optional< std::invoke_result_t< Func, Args... > > wrap_throwable_fn(Func &&fn, Args &&... args)
Definition trace_exception.hpp:34
Definition program_options.hpp:31