These macros add constants, variables, and arbitrary Python objects to modules.
They provide different approaches for exposing C++ values and objects to Python.
Macros | |
| #define | PY_MODULE_INTEGER_CONSTANT(i_module, s_name, s_value) |
| Add an integer constant to a Python module. | |
| #define | PY_MODULE_STRING_CONSTANT(i_module, s_name, s_value) |
| Add a string constant to a Python module. | |
| #define | PY_INJECT_OBJECT_IN_MODULE_EX(o_object, i_module, s_objectName) |
| Inject an arbitrary object into an already created module at runtime. | |
| #define | PY_INJECT_OBJECT_IN_MODULE(o_object, i_module) |
| Inject an object using its C++ identifier as the Python name. | |
| #define | PY_MODULE_ADD_INTEGER_CONSTANT(i_module, s_name, v_value) |
| Inject an integer constant into an already created module at runtime. | |
| #define | PY_MODULE_ADD_STRING_CONSTANT(i_module, s_name, s_value) |
| Inject a string constant into an already created module at runtime. | |
| #define PY_MODULE_INTEGER_CONSTANT | ( | i_module, | |
| s_name, | |||
| s_value ) |
Add an integer constant to a Python module.
The constant will be added to the module during module creation (at injection time). This is executed before main(), so the constant is available when the module is created.
| i_module | Module identifier declared by PY_DECLARE_MODULE_* |
| s_name | Python name of constant (const char* string with static storage duration) |
| s_value | Integer value of the constant (long) |
Definition at line 431 of file pyobject_macros.h.
| #define PY_MODULE_STRING_CONSTANT | ( | i_module, | |
| s_name, | |||
| s_value ) |
Add a string constant to a Python module.
The constant will be added to the module during module creation (at injection time). This is executed before main(), so the constant is available when the module is created.
| i_module | Module identifier declared by PY_DECLARE_MODULE_* |
| s_name | Python name of constant (const char* string with static storage duration) |
| s_value | String value of the constant (const char* string with static storage duration) |
Definition at line 453 of file pyobject_macros.h.
| #define PY_INJECT_OBJECT_IN_MODULE_EX | ( | o_object, | |
| i_module, | |||
| s_objectName ) |
Inject an arbitrary object into an already created module at runtime.
This performs immediate injection into the module namespace, unlike the PY_MODULE_*_CONSTANT macros which defer injection until module creation.
Must be called after the module has been injected with PY_INJECT_MODULE.
| o_object | Object/variable to be injected (will be converted to Python object) |
| i_module | Module identifier of an already injected module |
| s_objectName | Python name of object (const char* string with static storage duration) |
Definition at line 489 of file pyobject_macros.h.
| #define PY_INJECT_OBJECT_IN_MODULE | ( | o_object, | |
| i_module ) |
Inject an object using its C++ identifier as the Python name.
Wraps PY_INJECT_OBJECT_IN_MODULE_EX() with s_objectName derived from o_object.
| o_object | Object/variable to be injected (name will be used as Python name) |
| i_module | Module identifier of an already injected module |
Definition at line 519 of file pyobject_macros.h.
| #define PY_MODULE_ADD_INTEGER_CONSTANT | ( | i_module, | |
| s_name, | |||
| v_value ) |
Inject an integer constant into an already created module at runtime.
This performs immediate injection, unlike PY_MODULE_INTEGER_CONSTANT which registers the constant for inclusion during module creation.
| i_module | Module identifier of an already injected module |
| s_name | Python name of constant (const char* string with static storage duration) |
| v_value | Integer value of the constant (long) |
Definition at line 551 of file pyobject_macros.h.
| #define PY_MODULE_ADD_STRING_CONSTANT | ( | i_module, | |
| s_name, | |||
| s_value ) |
Inject a string constant into an already created module at runtime.
This performs immediate injection, unlike PY_MODULE_STRING_CONSTANT which registers the constant for inclusion during module creation.
| i_module | Module identifier of an already injected module |
| s_name | Python name of constant (const char* string with static storage duration) |
| s_value | String value of the constant (const char* string with static storage duration) |
Definition at line 585 of file pyobject_macros.h.