Definition at line 115 of file fclmodule.cxx.
PythonDictConverter::PythonDictConverter |
( |
| ) |
|
Definition at line 151 of file fclmodule.cxx.
159 _stack.emplace_back(PyDict_New());
std::vector< PyObject * > _stack
void PythonDictConverter::add_object |
( |
key_t const & |
key, |
|
|
PyObject * |
pyobj |
|
) |
| |
|
private |
Definition at line 335 of file fclmodule.cxx.
348 throw cet::exception(
"fclmodule") <<
"No parent object." << std::endl;
351 if(PyDict_Check(parent)) {
355 PyObject* keyobj = cxx_str_to_python(key);
356 PyDict_SetItem(parent, keyobj, pyobj);
359 else if(PyList_Check(parent)) {
363 PyList_Append(parent, pyobj);
370 throw cet::exception(
"fclmodule") <<
"Parent object is not dictionary or list." << std::endl;
std::vector< PyObject * > _stack
void PythonDictConverter::atom |
( |
key_t const & |
key, |
|
|
any_t const & |
any |
|
) |
| |
|
private |
Definition at line 226 of file fclmodule.cxx.
238 const std::string&
atom = std::any_cast<
const std::string&>(any);
242 std::string lcatom(atom);
244 [](
unsigned char c){
return std::tolower(c);});
248 if(lcatom == std::string(
"true") || lcatom == std::string(
"\"true\"")) {
252 else if(lcatom == std::string(
"false") || lcatom == std::string(
"\"false\"")) {
259 size_t n = atom.size();
260 if(pyval == 0 && n >= 2 && atom[0] ==
'"' && atom[n-1] ==
'"') {
261 std::string
s = atom.substr(1, n-2);
262 pyval = cxx_str_to_python(s);
268 std::istringstream iss(atom);
270 iss >> std::noskipws >> i;
271 if(iss.eof()
and !iss.fail())
272 pyval = PyLong_FromLong(i);
278 std::istringstream iss(atom);
280 iss >> std::noskipws >>
x;
281 if(iss.eof()
and !iss.fail())
282 pyval = PyFloat_FromDouble(x);
288 pyval = cxx_str_to_python(atom);
void atom(key_t const &key, any_t const &any)
process_name opflash particleana ie x
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
then echo File list $list not found else cat $list while read file do echo $file sed s
void add_object(key_t const &key, PyObject *pyobj)
void PythonDictConverter::enter_sequence |
( |
key_t const & |
key, |
|
|
any_t const & |
any |
|
) |
| |
|
private |
Definition at line 205 of file fclmodule.cxx.
std::vector< PyObject * > _stack
void add_object(key_t const &key, PyObject *pyobj)
void PythonDictConverter::enter_table |
( |
key_t const & |
key, |
|
|
any_t const & |
any |
|
) |
| |
|
private |
Definition at line 184 of file fclmodule.cxx.
202 _stack.emplace_back(dict);
std::vector< PyObject * > _stack
void add_object(key_t const &key, PyObject *pyobj)
void PythonDictConverter::exit_sequence |
( |
key_t const & |
key, |
|
|
any_t const & |
any |
|
) |
| |
|
private |
Definition at line 314 of file fclmodule.cxx.
325 throw cet::exception(
"fclmodule") <<
"Result stack has wrong size: "
326 <<
_stack.size() << std::endl;
327 if(!PyList_Check(
_stack.back()))
328 throw cet::exception(
"fclmodule") <<
"Result stack has wrong type." << std::endl;
std::vector< PyObject * > _stack
void PythonDictConverter::exit_table |
( |
key_t const & |
key, |
|
|
any_t const & |
any |
|
) |
| |
|
private |
Definition at line 296 of file fclmodule.cxx.
304 throw cet::exception(
"fclmodule") <<
"Result stack has wrong size: "
305 <<
_stack.size() << std::endl;
306 if(!PyDict_Check(
_stack.back()))
307 throw cet::exception(
"fclmodule") <<
"Result stack has wrong type." << std::endl;
std::vector< PyObject * > _stack
PyObject * PythonDictConverter::result |
( |
| ) |
const |
Definition at line 162 of file fclmodule.cxx.
174 throw cet::exception(
"fclmodule") <<
"Result stack has wrong size: "
175 <<
_stack.size() << std::endl;
176 if(!PyDict_Check(
_stack[0]))
177 throw cet::exception(
"fclmodule") <<
"Result stack has wrong type." << std::endl;
std::vector< PyObject * > _stack
std::vector<PyObject*> PythonDictConverter::_stack |
|
private |
The documentation for this class was generated from the following file: