R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3B::Neuland::CLIApplication Class Referenceabstract

#include <R3BNeulandApp.h>

Classes

struct  Options
 

Public Member Functions

 CLIApplication (std::string_view name, std::unique_ptr< FairRun > run, std::reference_wrapper< Options > option)
 
 CLIApplication (const CLIApplication &)=delete
 
 CLIApplication (CLIApplication &&)=delete
 
auto operator= (const CLIApplication &) -> CLIApplication &=delete
 
auto operator= (CLIApplication &&) -> CLIApplication &=delete
 
 ~CLIApplication () override
 
template<typename CLIAPP, typename OptionType>
void setup_common_options (CLIAPP &program_options, OptionType &options)
 
template<typename OptionType>
void print_json_options (const OptionType &options)
 
template<typename OptionType>
void dump_json_options (const OptionType &options, const std::string &filename)
 
void set_log_level (std::string_view log_level)
 
void set_run_id (int run_id)
 
void set_output_filename (std::string_view output_filename)
 
void set_inputpar_filename (std::string_view inputpar_filename)
 
void set_second_inputpar_filename (std::string_view inputpar_filename)
 
void set_outputpar_filename (std::string_view outputpar_filename)
 
void set_event_num (int val)
 
void set_input_filename (const std::vector< std::string > &input_filename)
 
void set_tree_input_filename (const std::vector< std::string > &input_filename)
 
auto get_run () -> FairRun *
 
auto has_mpi () -> bool
 
- Public Member Functions inherited from R3B::Neuland::CLIAbstract
 CLIAbstract ()=default
 Default constructor.
 
virtual ~CLIAbstract ()=default
 
 CLIAbstract (const CLIAbstract &)=default
 
 CLIAbstract (CLIAbstract &&)=default
 
auto operator= (const CLIAbstract &) -> CLIAbstract &=default
 
auto operator= (CLIAbstract &&) -> CLIAbstract &=default
 
void set_fail (bool is_failed)
 
auto has_failed () const -> bool
 
auto has_inited () const -> bool
 

Protected Member Functions

template<typename OptionType>
void ParseApplicationOptionImp (const std::vector< std::string > &filename, OptionType &options)
 
- Protected Member Functions inherited from R3B::Neuland::CLIAbstract
void set_inited (bool is_inited)
 

Private Member Functions

void set_num_of_procs (int val) override
 
void set_rank_num (int val) override
 
void dump_options () override
 
void init () override
 Initialization of a CLI program.
 
void run () override
 Run the CLI program.
 
void print_options () override
 
auto has_print_default_options () const -> bool override
 Check the flag whether the default options should be printed in JSON strings.
 
auto has_dump () const -> bool override
 Check whether the options should be dump to a JSON file.
 
void setup_options (CLI::App &program_options) override
 Setup the CLI options given to the program.
 
void post_parse () override
 Action done after the option parsing.
 
virtual void pre_init (FairRun *run)=0
 
virtual void ParseApplicationOption (const std::vector< std::string > &filename_or_option)=0
 
virtual void post_init (FairRun *run)
 
void add_input_filename (R3BFileSource2 *filesource)
 
virtual void print_json_options ()
 
virtual void dump_json_options (const std::string &filename)
 
virtual void run_action (FairRun *run, int num_of_events)
 
virtual void setup_application_options (CLI::App &program_options)
 
void setup_common_options (CLI::App &program_options)
 
void add_inout_files ()
 
void add_inout_pars ()
 
void extract_input_files ()
 

Static Private Member Functions

static void setup_logger ()
 
static void patch_files_or_strings (nlohmann::ordered_json &json_obj, const std::vector< std::string > &filenames_or_options)
 

Private Attributes

bool is_already_parsed_ = false
 
bool is_dump_ = false
 
bool has_print_default_options_ = false
 
int num_of_procs_ = 0
 
int rank_num_ = 0
 
std::string app_name_
 
std::string dump_json_filename_
 
std::unique_ptr< FairRun > run_
 
std::reference_wrapper< Optionsoption_
 
TStopwatch timer_
 
std::vector< std::pair< std::string, bool > > input_files_
 

Detailed Description

Definition at line 32 of file R3BNeulandApp.h.

Constructor & Destructor Documentation

◆ CLIApplication() [1/3]

R3B::Neuland::CLIApplication::CLIApplication ( std::string_view name,
std::unique_ptr< FairRun > run,
std::reference_wrapper< Options > option )
explicit

Definition at line 99 of file R3BNeulandApp.cxx.

◆ CLIApplication() [2/3]

R3B::Neuland::CLIApplication::CLIApplication ( const CLIApplication & )
delete

◆ CLIApplication() [3/3]

R3B::Neuland::CLIApplication::CLIApplication ( CLIApplication && )
delete

◆ ~CLIApplication()

R3B::Neuland::CLIApplication::~CLIApplication ( )
override

Definition at line 111 of file R3BNeulandApp.cxx.

Member Function Documentation

◆ add_inout_files()

void R3B::Neuland::CLIApplication::add_inout_files ( )
private

Definition at line 234 of file R3BNeulandApp.cxx.

◆ add_inout_pars()

void R3B::Neuland::CLIApplication::add_inout_pars ( )
private

Definition at line 266 of file R3BNeulandApp.cxx.

◆ add_input_filename()

void R3B::Neuland::CLIApplication::add_input_filename ( R3BFileSource2 * filesource)
private

Definition at line 321 of file R3BNeulandApp.cxx.

◆ dump_json_options() [1/2]

template<typename OptionType>
void R3B::Neuland::CLIApplication::dump_json_options ( const OptionType & options,
const std::string & filename )

Definition at line 172 of file R3BNeulandApp.h.

◆ dump_json_options() [2/2]

virtual void R3B::Neuland::CLIApplication::dump_json_options ( const std::string & filename)
inlineprivatevirtual

◆ dump_options()

void R3B::Neuland::CLIApplication::dump_options ( )
inlineoverrideprivatevirtual

Reimplemented from R3B::Neuland::CLIAbstract.

Definition at line 127 of file R3BNeulandApp.h.

◆ extract_input_files()

void R3B::Neuland::CLIApplication::extract_input_files ( )
private

Definition at line 332 of file R3BNeulandApp.cxx.

◆ get_run()

auto R3B::Neuland::CLIApplication::get_run ( ) -> FairRun*
inline

Definition at line 104 of file R3BNeulandApp.h.

◆ has_dump()

auto R3B::Neuland::CLIApplication::has_dump ( ) const -> bool
inlinenodiscardoverrideprivatevirtual

This metehod is only useful when if the dynamic type of the object is derived from R3B::Neuland::CLIApplication

Returns
Flag value

Reimplemented from R3B::Neuland::CLIAbstract.

Definition at line 132 of file R3BNeulandApp.h.

◆ has_mpi()

auto R3B::Neuland::CLIApplication::has_mpi ( ) -> bool
inline

Definition at line 105 of file R3BNeulandApp.h.

◆ has_print_default_options()

auto R3B::Neuland::CLIApplication::has_print_default_options ( ) const -> bool
inlinenodiscardoverrideprivatevirtual

This metehod is only useful when if the dynamic type of the object is derived from R3B::Neuland::CLIApplication

Returns
Flag of printing JSON string.
See also
ref

Reimplemented from R3B::Neuland::CLIAbstract.

Definition at line 131 of file R3BNeulandApp.h.

◆ init()

void R3B::Neuland::CLIApplication::init ( )
overrideprivatevirtual

The initialization process must be done before calling the run method. Setters such as set_rank_num should be called before the initialization. detailed description

Implements R3B::Neuland::CLIAbstract.

Definition at line 155 of file R3BNeulandApp.cxx.

◆ operator=() [1/2]

auto R3B::Neuland::CLIApplication::operator= ( CLIApplication && ) -> CLIApplication &=delete
delete

◆ operator=() [2/2]

auto R3B::Neuland::CLIApplication::operator= ( const CLIApplication & ) -> CLIApplication &=delete
delete

◆ ParseApplicationOption()

virtual void R3B::Neuland::CLIApplication::ParseApplicationOption ( const std::vector< std::string > & filename_or_option)
privatepure virtual

◆ ParseApplicationOptionImp()

template<typename OptionType>
void R3B::Neuland::CLIApplication::ParseApplicationOptionImp ( const std::vector< std::string > & filename,
OptionType & options )
protected

Definition at line 189 of file R3BNeulandApp.h.

◆ patch_files_or_strings()

void R3B::Neuland::CLIApplication::patch_files_or_strings ( nlohmann::ordered_json & json_obj,
const std::vector< std::string > & filenames_or_options )
staticprivate

Definition at line 356 of file R3BNeulandApp.cxx.

◆ post_init()

virtual void R3B::Neuland::CLIApplication::post_init ( FairRun * run)
inlineprivatevirtual

Reimplemented in R3B::Neuland::SimulationApplication.

Definition at line 139 of file R3BNeulandApp.h.

◆ post_parse()

void R3B::Neuland::CLIApplication::post_parse ( )
overrideprivatevirtual

Thus this method should be called immediately after calling CLI11_PARSE.

Reimplemented from R3B::Neuland::CLIAbstract.

Definition at line 149 of file R3BNeulandApp.cxx.

◆ pre_init()

virtual void R3B::Neuland::CLIApplication::pre_init ( FairRun * run)
privatepure virtual

◆ print_json_options() [1/2]

virtual void R3B::Neuland::CLIApplication::print_json_options ( )
inlineprivatevirtual

◆ print_json_options() [2/2]

template<typename OptionType>
void R3B::Neuland::CLIApplication::print_json_options ( const OptionType & options)

Definition at line 157 of file R3BNeulandApp.h.

◆ print_options()

void R3B::Neuland::CLIApplication::print_options ( )
inlineoverrideprivatevirtual

Reimplemented from R3B::Neuland::CLIAbstract.

Definition at line 130 of file R3BNeulandApp.h.

◆ run()

void R3B::Neuland::CLIApplication::run ( )
overrideprivatevirtual

Implements R3B::Neuland::CLIAbstract.

Definition at line 308 of file R3BNeulandApp.cxx.

◆ run_action()

void R3B::Neuland::CLIApplication::run_action ( FairRun * run,
int num_of_events )
privatevirtual

Reimplemented in R3B::Neuland::SimulationApplication.

Definition at line 319 of file R3BNeulandApp.cxx.

◆ set_event_num()

void R3B::Neuland::CLIApplication::set_event_num ( int val)
inline

Definition at line 92 of file R3BNeulandApp.h.

◆ set_input_filename()

void R3B::Neuland::CLIApplication::set_input_filename ( const std::vector< std::string > & input_filename)
inline

Definition at line 93 of file R3BNeulandApp.h.

◆ set_inputpar_filename()

void R3B::Neuland::CLIApplication::set_inputpar_filename ( std::string_view inputpar_filename)
inline

Definition at line 83 of file R3BNeulandApp.h.

◆ set_log_level()

void R3B::Neuland::CLIApplication::set_log_level ( std::string_view log_level)
inline

Definition at line 80 of file R3BNeulandApp.h.

◆ set_num_of_procs()

void R3B::Neuland::CLIApplication::set_num_of_procs ( int val)
inlineoverrideprivatevirtual

Reimplemented from R3B::Neuland::CLIAbstract.

Definition at line 125 of file R3BNeulandApp.h.

◆ set_output_filename()

void R3B::Neuland::CLIApplication::set_output_filename ( std::string_view output_filename)
inline

Definition at line 82 of file R3BNeulandApp.h.

◆ set_outputpar_filename()

void R3B::Neuland::CLIApplication::set_outputpar_filename ( std::string_view outputpar_filename)
inline

Definition at line 88 of file R3BNeulandApp.h.

◆ set_rank_num()

void R3B::Neuland::CLIApplication::set_rank_num ( int val)
inlineoverrideprivatevirtual

Reimplemented from R3B::Neuland::CLIAbstract.

Definition at line 126 of file R3BNeulandApp.h.

◆ set_run_id()

void R3B::Neuland::CLIApplication::set_run_id ( int run_id)
inline

Definition at line 81 of file R3BNeulandApp.h.

◆ set_second_inputpar_filename()

void R3B::Neuland::CLIApplication::set_second_inputpar_filename ( std::string_view inputpar_filename)
inline

Definition at line 84 of file R3BNeulandApp.h.

◆ set_tree_input_filename()

void R3B::Neuland::CLIApplication::set_tree_input_filename ( const std::vector< std::string > & input_filename)
inline

Definition at line 97 of file R3BNeulandApp.h.

◆ setup_application_options()

virtual void R3B::Neuland::CLIApplication::setup_application_options ( CLI::App & program_options)
inlineprivatevirtual

Reimplemented in R3B::Neuland::AnalysisApplication.

Definition at line 144 of file R3BNeulandApp.h.

◆ setup_common_options() [1/2]

void R3B::Neuland::CLIApplication::setup_common_options ( CLI::App & program_options)
private

Definition at line 173 of file R3BNeulandApp.cxx.

◆ setup_common_options() [2/2]

template<typename CLIAPP, typename OptionType>
void R3B::Neuland::CLIApplication::setup_common_options ( CLIAPP & program_options,
OptionType & options )

◆ setup_logger()

void R3B::Neuland::CLIApplication::setup_logger ( )
staticprivate

Definition at line 135 of file R3BNeulandApp.cxx.

◆ setup_options()

void R3B::Neuland::CLIApplication::setup_options ( CLI::App & program_options)
overrideprivatevirtual
Parameters
program_optionsOptions fed to the program.

Implements R3B::Neuland::CLIAbstract.

Definition at line 167 of file R3BNeulandApp.cxx.

Member Data Documentation

◆ app_name_

std::string R3B::Neuland::CLIApplication::app_name_
private

Definition at line 117 of file R3BNeulandApp.h.

◆ dump_json_filename_

std::string R3B::Neuland::CLIApplication::dump_json_filename_
private

Definition at line 118 of file R3BNeulandApp.h.

◆ has_print_default_options_

bool R3B::Neuland::CLIApplication::has_print_default_options_ = false
private

Definition at line 114 of file R3BNeulandApp.h.

◆ input_files_

std::vector<std::pair<std::string, bool> > R3B::Neuland::CLIApplication::input_files_
private

Definition at line 122 of file R3BNeulandApp.h.

◆ is_already_parsed_

bool R3B::Neuland::CLIApplication::is_already_parsed_ = false
private

Definition at line 112 of file R3BNeulandApp.h.

◆ is_dump_

bool R3B::Neuland::CLIApplication::is_dump_ = false
private

Definition at line 113 of file R3BNeulandApp.h.

◆ num_of_procs_

int R3B::Neuland::CLIApplication::num_of_procs_ = 0
private

Definition at line 115 of file R3BNeulandApp.h.

◆ option_

std::reference_wrapper<Options> R3B::Neuland::CLIApplication::option_
private

Definition at line 120 of file R3BNeulandApp.h.

◆ rank_num_

int R3B::Neuland::CLIApplication::rank_num_ = 0
private

Definition at line 116 of file R3BNeulandApp.h.

◆ run_

std::unique_ptr<FairRun> R3B::Neuland::CLIApplication::run_
private

Definition at line 119 of file R3BNeulandApp.h.

◆ timer_

TStopwatch R3B::Neuland::CLIApplication::timer_
private

Definition at line 121 of file R3BNeulandApp.h.


The documentation for this class was generated from the following files: