R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandCLIAbstract.h
Go to the documentation of this file.
1#pragma once
2
3#include <CLI/CLI.hpp>
4
5namespace R3B::Neuland
6{
8 {
9 public:
13 CLIAbstract() = default;
14
15 // rule of 5
16 virtual ~CLIAbstract() = default;
17 CLIAbstract(const CLIAbstract&) = default;
19 auto operator=(const CLIAbstract&) -> CLIAbstract& = default;
20 auto operator=(CLIAbstract&&) -> CLIAbstract& = default;
21
28 virtual void init() = 0;
29
33 virtual void run() = 0;
34
40 virtual void setup_options(CLI::App& program_options) = 0;
41
47 virtual void post_parse() {}
48
57 [[nodiscard]] virtual auto has_print_default_options() const -> bool { return false; }
58
66 [[nodiscard]] virtual auto has_dump() const -> bool { return false; }
67
68 virtual void print_options() {}
69 virtual void dump_options() {}
70 virtual void set_rank_num(int val) {}
71 virtual void set_num_of_procs(int val) {}
72
73 // Setters:
74 void set_fail(bool is_failed) { is_failed_ = is_failed; }
75
76 // Getters:
77 [[nodiscard]] auto has_failed() const -> bool { return is_failed_; }
78 [[nodiscard]] auto has_inited() const -> bool { return is_inited_; }
79
80 protected:
81 void set_inited(bool is_inited) { is_inited_ = is_inited; }
82
83 private:
84 bool is_failed_ = false;
85 bool is_inited_ = false;
86 };
87} // namespace R3B::Neuland
auto operator=(CLIAbstract &&) -> CLIAbstract &=default
auto has_failed() const -> bool
virtual auto has_print_default_options() const -> bool
Check the flag whether the default options should be printed in JSON strings.
virtual void init()=0
Initialization of a CLI program.
virtual void post_parse()
Action done after the option parsing.
virtual void run()=0
Run the CLI program.
CLIAbstract()=default
Default constructor.
virtual ~CLIAbstract()=default
virtual void set_num_of_procs(int val)
CLIAbstract(const CLIAbstract &)=default
virtual void set_rank_num(int val)
virtual void setup_options(CLI::App &program_options)=0
Setup the CLI options given to the program.
auto has_inited() const -> bool
virtual auto has_dump() const -> bool
Check whether the options should be dump to a JSON file.
auto operator=(const CLIAbstract &) -> CLIAbstract &=default
void set_inited(bool is_inited)
CLIAbstract(CLIAbstract &&)=default
Simulation of NeuLAND Bar/Paddle.