Python helper
Helper macros for Python bindings. More...
Modules | |
Python doc helper | |
Generate argument doc string for Python. | |
Macros | |
#define | PARAM_FIELD_STRINGS(_field, _seq) BOOST_PP_SEQ_FOR_EACH_I(PARAM_FIELD_STRINGS_,_field,_seq) |
Expand to a list of stringified fields. More... | |
#define | PARAM_FIELDS(_src, _seq) BOOST_PP_SEQ_FOR_EACH_I(PARAM_FIELDS_,_src,_seq) |
Expand to a list of the given field in the parameter sequence. More... | |
#define | PARAM_PY_DECLARE(_src, _seq) BOOST_PP_SEQ_FOR_EACH(PARAM_PY_DECLARE_,_src,_seq) |
Declare field variables for Python C type without initialization. More... | |
#define | PARAM_PY_DECLARE_INIT(_src, _seq) BOOST_PP_SEQ_FOR_EACH(PARAM_PY_DECLARE_INIT_,_src,_seq) |
Declare field variables of Python c type with initialization to default. More... | |
#define | PARAM_PY_DICT_SET_VALUE(_dict, _field, _src, _seq) BOOST_PP_SEQ_FOR_EACH(PARAM_PY_DICT_SET_VALUE_,(_dict,_field,_src),_seq) |
Populate a Python dict with a structure variable. More... | |
#define | PARAM_PY_FIELDS(_src, _seq) BOOST_PP_SEQ_FOR_EACH_I(PARAM_PY_FIELDS_,_src,_seq) |
Expand to a comma separated list of the given field in the sequence. More... | |
#define | PARAM_PY_KWDS(_seq) PARAM_FOREACH(PARAM_PY_KWDS_,_seq) |
Generate a format string for kewords based argument. More... | |
#define | PARAM_REF(_src, _seq) BOOST_PP_SEQ_FOR_EACH_I(PARAM_REF_,_src,_seq) |
Generate a list of field references. More... | |
Detailed Description
Helper macros for Python bindings.
Macro Definition Documentation
◆ PARAM_FIELD_STRINGS
#define PARAM_FIELD_STRINGS | ( | _field, | |
_seq | |||
) | BOOST_PP_SEQ_FOR_EACH_I(PARAM_FIELD_STRINGS_,_field,_seq) |
Expand to a list of stringified fields.
◆ PARAM_FIELDS
#define PARAM_FIELDS | ( | _src, | |
_seq | |||
) | BOOST_PP_SEQ_FOR_EACH_I(PARAM_FIELDS_,_src,_seq) |
Expand to a list of the given field in the parameter sequence.
_src:
macro to generate source field. See here for more details
For example, PARAM_FIELDS(PARAM_FARG, _seq) expands to:
arg1,arg2 ...
◆ PARAM_PY_DECLARE
#define PARAM_PY_DECLARE | ( | _src, | |
_seq | |||
) | BOOST_PP_SEQ_FOR_EACH(PARAM_PY_DECLARE_,_src,_seq) |
Declare field variables for Python C type without initialization.
◆ PARAM_PY_DECLARE_INIT
#define PARAM_PY_DECLARE_INIT | ( | _src, | |
_seq | |||
) | BOOST_PP_SEQ_FOR_EACH(PARAM_PY_DECLARE_INIT_,_src,_seq) |
Declare field variables of Python c type with initialization to default.
◆ PARAM_PY_DICT_SET_VALUE
#define PARAM_PY_DICT_SET_VALUE | ( | _dict, | |
_field, | |||
_src, | |||
_seq | |||
) | BOOST_PP_SEQ_FOR_EACH(PARAM_PY_DICT_SET_VALUE_,(_dict,_field,_src),_seq) |
Populate a Python dict with a structure variable.
_dict:
the Python dictionary object_field:
specifies the field to use as key_src:
macro to generate source field. See here for more details
Roughly translated to:
PyDict_SetItem(_dict,#_field1,_src(_param));
PyDict_SetItem(_dict,#_field2,_src(_param));
...
◆ PARAM_PY_FIELDS
#define PARAM_PY_FIELDS | ( | _src, | |
_seq | |||
) | BOOST_PP_SEQ_FOR_EACH_I(PARAM_PY_FIELDS_,_src,_seq) |
Expand to a comma separated list of the given field in the sequence.
_src:
macro to generate source field. See here for more details
The field will be casted from python C to C type
◆ PARAM_PY_KWDS
#define PARAM_PY_KWDS | ( | _seq | ) | PARAM_FOREACH(PARAM_PY_KWDS_,_seq) |
Generate a format string for kewords based argument.
◆ PARAM_REF
#define PARAM_REF | ( | _src, | |
_seq | |||
) | BOOST_PP_SEQ_FOR_EACH_I(PARAM_REF_,_src,_seq) |
Generate a list of field references.
_src:
macro to generate source field. See here for
more details Expand to:
&_src(_param1), &_src(_param1) ...