3 #include "GaudiKernel/Bootstrap.h"
4 #include "GaudiKernel/IAppMgrUI.h"
5 #include "GaudiKernel/IProperty.h"
6 #include "GaudiKernel/ISvcLocator.h"
7 #include "GaudiKernel/Property.h"
8 #include "GaudiKernel/SmartIF.h"
11 #include "boost/program_options.hpp"
19 options_description desc(
"Allowed options");
21 (
"help,h",
"produce help message")
22 (
"config", value<std::string>(),
"comma separated list of python configuration files")
23 (
"post-option", value<std::string>(),
"python command to be run after ConfigurableUser has been applied")
24 (
"param",
value<std::vector<std::string>>(),
"parameters to the configuration file, multiple can be given")
26 positional_options_description p;
30 store(command_line_parser(argc, argv).
options(desc).positional(p).run(), vm);
32 catch(boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >){
33 std::cerr <<
"Unknown option(s) detected." << std::endl
34 <<
"Usage:" << std::endl
42 if (vm.count(
"help") or vm.count(
"h")) {
43 std::cout << desc << std::endl;
46 if (!vm.count(
"config")) {
47 std::cout <<
"Please specify a config file" << std::endl;
50 fileName = vm[
"config"].as<std::string>();
53 std::stringstream params;
54 if (0 != vm.count(
"param")) {
55 std::vector<std::string> vParams = vm[
"param"].as<std::vector<std::string>>();
56 std::cout <<
"Configuration parameters are:" << std::endl;
57 for(std::string
s : vParams){
59 std::cout <<
"\t"<< s << std::endl;
63 std::string postAction;
64 if (0 != vm.count(
"post-option")) {
65 postAction = vm[
"post-option"].as<std::string>();
74 propMgr->
setProperty(
"JobOptionsPreAction", params.str());
75 propMgr->
setProperty(
"JobOptionsPostAction", postAction);
virtual StatusCode run()=0
Run the complete job (from initialize to terminate)
int main(int argc, char **argv)
Definition of the basic interface.
virtual StatusCode setProperty(const Property &p)=0
Set the property by property.
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)