8 #include "GaudiKernel/IClassManager.h"
9 #include "GaudiKernel/IProperty.h"
10 #include "GaudiKernel/ISvcLocator.h"
11 #include "GaudiKernel/SmartIF.h"
12 #include "GaudiKernel/IAppMgrUI.h"
13 #include "GaudiKernel/IClassIDSvc.h"
14 #include "GaudiKernel/Bootstrap.h"
18 #include <boost/program_options.hpp>
19 namespace po = boost::program_options;
25 int inputError(
const std::string& errDescr,
const po::options_description& optDescr ) {
26 std::cerr << errDescr <<
"\n" << optDescr << std::endl;
32 IAppMgrUI*
theApp = Gaudi::createApplicationMgr();
33 SmartIF<IProperty> propMgr(
theApp);
38 CHECK_WITH_CONTEXT( propMgr->setProperty(
"JobOptionsType",
"NONE"),
"initGaudi",
nullptr );
41 CHECK_WITH_CONTEXT( propMgr->setProperty(
"OutputLevel", MSG::WARNING),
"initGaudi",
nullptr );
45 svcLocator = Gaudi::svcLocator();
53 const std::string appName(
"genCLIDDB");
54 po::options_description
desc(appName +
" allowed options");
56 (
"help,h",
"produce help message")
57 (
"package,p", po::value<std::string>(),
"package we want to load clids from")
58 (
"input,i", po::value<std::string>(),
"optional path to input clid db file")
59 (
"output,o", po::value<std::string>(),
"optional path to resulting clid db file")
60 (
"jobopts,j", po::value<std::string>(),
"name of optional job options txt file, located at ../share/jobopts")
61 (
"verbose,v", po::value<bool>()->implicit_value(
true),
"verbose output")
63 std::string packageName(
"ALL");
64 std::string inputCLIDDB;
75 if (vm.count(
"help")) {
76 std::cout <<
desc << std::endl;
80 if (vm.count(
"package")) {
81 packageName = vm[
"package"].as<std::string>();
83 return inputError(
"Please specify a package using option --package.\n",
desc);
86 if (vm.count(
"output")) {
92 bool verbose = vm.count(
"verbose") && vm[
"verbose"].as<
bool>();
95 ISvcLocator* pSvcLoc(
nullptr);
96 std::string
jobopts(
"CLIDComps/minimalPrintout.opts");
97 if (vm.count(
"jobopts")) {
98 jobopts = vm[
"jobopts"].as<std::string>();
101 std::cerr <<
"cannot initialize Gaudi" << std::endl;
106 SmartIF<IMessageSvc>
msgSvc(pSvcLoc);
111 log.setLevel(MSG::WARNING);
114 SmartIF<IClassManager> pICM(pSvcLoc);
117 SmartIF<IClassIDSvc> pClassIDSvc(pSvcLoc->service(
"ClassIDSvc"));
120 SmartIF<IProperty> pCLIDSvcProp(pClassIDSvc);
123 log << MSG::INFO <<
"Writing clid.db for package "
127 std::string dbfiles(
"{}");
128 if (vm.count(
"input")) {
129 log << MSG::INFO <<
"Reading clid.db from " << vm[
"input"].as<std::string>() <<
"." <<
endmsg;
130 dbfiles =
"{\"" + vm[
"input"].as<std::string>() +
"\"}";
142 return (pClassIDSvc->finalize()).isSuccess() ? 0 : -1;