8 using namespace boost::python;
13 std::string initCommand(
"from FWCore.ParameterSet.Types import makeCppPSet\n"
15 initCommand += fileName +
"')";
17 handle<>(PyRun_String(initCommand.c_str(),
20 mainNamespace.ptr()));
22 handle<>(PyRun_String(command.c_str(),
25 mainNamespace.ptr()));
32 command +=
"\nfrom FWCore.ParameterSet.Types import makeCppPSet\nmakeCppPSet(locals(), topPSet)";
33 handle<>(PyRun_String(command.c_str(),
36 mainNamespace.ptr()));
41 std::shared_ptr<ParameterSet>
47 std::shared_ptr<ParameterSet>
55 std::shared_ptr<ParameterSet>&
main) {
60 std::shared_ptr<ParameterSet>
64 boost::python::object mainModule = object(handle<>(borrowed(PyImport_AddModule(const_cast<char*>(
"__main__")))));
66 boost::python::object mainNamespace = mainModule.attr(
"__dict__");
68 mainNamespace[
"topPSet"] = ptr(&theProcessPSet);
72 if(module.substr(module.size()-3) ==
".py") {
78 catch( error_already_set ) {
82 auto returnValue = std::make_shared<ParameterSet>();
83 theProcessPSet.
pset().
swap(*returnValue);
std::shared_ptr< ParameterSet > readPSetsFrom(std::string const &fileOrString)
static void makePSetsFromString(std::string const &module, boost::python::object &mainNamespace)
void pythonToCppException(const std::string &iType)
void swap(ParameterSet &other)
std::shared_ptr< edm::ParameterSet > parameterSet()
edm::ParameterSet & pset()
std::shared_ptr< ParameterSet > readConfig(std::string const &config)
void makeParameterSets(std::string const &configtext, std::shared_ptr< ParameterSet > &main)
essentially the same as the previous method
static void makePSetsFromFile(std::string const &fileName, boost::python::object &mainNamespace)