|
def | __init__ (self, module_name, top_module_namespaces='', use_boost_serialization=False, ignore_classes=(), module_template="") |
|
def | wrap (self, sources, main_module_name) |
|
def | wrap_ctors (self, my_class) |
|
def | wrap_dunder_methods (self, methods, cpp_class, prefix='\n'+' ' *8, suffix='') |
|
def | wrap_enum (self, enum, class_name='', module=None, prefix=' ' *4) |
|
def | wrap_enums (self, enums, instantiated_class, prefix=' ' *4) |
|
def | wrap_file (self, content, module_name=None, submodules=None) |
|
def | wrap_functions (self, functions, namespace, prefix='\n'+' ' *8, suffix='') |
|
def | wrap_instantiated_class (self, instantiator.InstantiatedClass instantiated_class) |
|
def | wrap_instantiated_declaration (self, instantiator.InstantiatedDeclaration instantiated_decl) |
|
def | wrap_methods (self, methods, cpp_class, prefix='\n'+' ' *8, suffix='') |
|
def | wrap_namespace (self, namespace) |
|
def | wrap_operators (self, operators,cpp_class, prefix='\n'+' ' *8) |
|
def | wrap_properties (self, properties, cpp_class, prefix='\n'+' ' *8) |
|
def | wrap_stl_class (self, stl_class) |
|
def | wrap_submodule (self, source) |
|
def | wrap_variable (self, namespace, module_var, variable, prefix='\n'+' ' *8) |
|
|
def | _add_namespaces (self, name, namespaces) |
|
def | _gen_module_var (self, namespaces) |
|
def | _method_args_signature (self, args) |
|
def | _partial_match (self, namespaces1, namespaces2) |
|
def | _py_args_names (self, args) |
|
def | _wrap_dunder (self, method, cpp_class, prefix, suffix, method_suffix="") |
|
def | _wrap_method (self, method, cpp_class, prefix, suffix, method_suffix="") |
|
def | _wrap_print (self, str ret, parser.Method method, str cpp_class, List[str] args_names, str args_signature_with_names, str py_args_names, str prefix, str suffix) |
|
def | _wrap_serialization (self, cpp_class) |
|
Class to generate binding code for Pybind11 specifically.
Definition at line 23 of file pybind_wrapper.py.
◆ __init__()
def gtwrap.pybind_wrapper.PybindWrapper.__init__ |
( |
|
self, |
|
|
|
module_name, |
|
|
|
top_module_namespaces = '' , |
|
|
|
use_boost_serialization = False , |
|
|
|
ignore_classes = () , |
|
|
|
module_template = "" |
|
) |
| |
◆ _add_namespaces()
def gtwrap.pybind_wrapper.PybindWrapper._add_namespaces |
( |
|
self, |
|
|
|
name, |
|
|
|
namespaces |
|
) |
| |
|
private |
◆ _gen_module_var()
def gtwrap.pybind_wrapper.PybindWrapper._gen_module_var |
( |
|
self, |
|
|
|
namespaces |
|
) |
| |
|
private |
◆ _method_args_signature()
def gtwrap.pybind_wrapper.PybindWrapper._method_args_signature |
( |
|
self, |
|
|
|
args |
|
) |
| |
|
private |
Generate the argument types and names as per the method signature.
Definition at line 75 of file pybind_wrapper.py.
◆ _partial_match()
def gtwrap.pybind_wrapper.PybindWrapper._partial_match |
( |
|
self, |
|
|
|
namespaces1, |
|
|
|
namespaces2 |
|
) |
| |
|
private |
◆ _py_args_names()
def gtwrap.pybind_wrapper.PybindWrapper._py_args_names |
( |
|
self, |
|
|
|
args |
|
) |
| |
|
private |
◆ _wrap_dunder()
def gtwrap.pybind_wrapper.PybindWrapper._wrap_dunder |
( |
|
self, |
|
|
|
method, |
|
|
|
cpp_class, |
|
|
|
prefix, |
|
|
|
suffix, |
|
|
|
method_suffix = "" |
|
) |
| |
|
private |
Wrap a Python double-underscore (dunder) method.
E.g. __len__() gets wrapped as `.def("__len__", [](gtsam::KeySet* self) {return self->size();})`
Supported methods are:
- __contains__(T x)
- __len__()
- __iter__()
Definition at line 158 of file pybind_wrapper.py.
◆ _wrap_method()
def gtwrap.pybind_wrapper.PybindWrapper._wrap_method |
( |
|
self, |
|
|
|
method, |
|
|
|
cpp_class, |
|
|
|
prefix, |
|
|
|
suffix, |
|
|
|
method_suffix = "" |
|
) |
| |
|
private |
Wrap the `method` for the class specified by `cpp_class`.
Args:
method: The method to wrap.
cpp_class: The C++ name of the class to which the method belongs.
prefix: Prefix to add to the wrapped method when writing to the cpp file.
suffix: Suffix to add to the wrapped method when writing to the cpp file.
method_suffix: A string to append to the wrapped method name.
Definition at line 203 of file pybind_wrapper.py.
◆ _wrap_print()
def gtwrap.pybind_wrapper.PybindWrapper._wrap_print |
( |
|
self, |
|
|
str |
ret, |
|
|
parser.Method |
method, |
|
|
str |
cpp_class, |
|
|
List[str] |
args_names, |
|
|
str |
args_signature_with_names, |
|
|
str |
py_args_names, |
|
|
str |
prefix, |
|
|
str |
suffix |
|
) |
| |
|
private |
Update the print method to print to the output stream and append a __repr__ method.
Args:
ret (str): The result of the parser.
method (parser.Method): The method to be wrapped.
cpp_class (str): The C++ name of the class to which the method belongs.
args_names (List[str]): List of argument variable names passed to the method.
args_signature_with_names (str): C++ arguments containing their names and type signatures.
py_args_names (str): The pybind11 formatted version of the argument list.
prefix (str): Prefix to add to the wrapped method when writing to the cpp file.
suffix (str): Suffix to add to the wrapped method when writing to the cpp file.
Returns:
str: The wrapped print method.
Definition at line 117 of file pybind_wrapper.py.
◆ _wrap_serialization()
def gtwrap.pybind_wrapper.PybindWrapper._wrap_serialization |
( |
|
self, |
|
|
|
cpp_class |
|
) |
| |
|
private |
Helper method to add serialize, deserialize and pickle methods to the wrapped class.
Definition at line 97 of file pybind_wrapper.py.
◆ wrap()
def gtwrap.pybind_wrapper.PybindWrapper.wrap |
( |
|
self, |
|
|
|
sources, |
|
|
|
main_module_name |
|
) |
| |
Wrap all the main interface file.
Args:
sources: List of all interface files.
The first file should be the main module.
main_module_name: The name for the main module.
Definition at line 761 of file pybind_wrapper.py.
◆ wrap_ctors()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_ctors |
( |
|
self, |
|
|
|
my_class |
|
) |
| |
◆ wrap_dunder_methods()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_dunder_methods |
( |
|
self, |
|
|
|
methods, |
|
|
|
cpp_class, |
|
|
|
prefix = '\n' + ' ' * 8 , |
|
|
|
suffix = '' |
|
) |
| |
◆ wrap_enum()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_enum |
( |
|
self, |
|
|
|
enum, |
|
|
|
class_name = '' , |
|
|
|
module = None , |
|
|
|
prefix = ' ' * 4 |
|
) |
| |
Wrap an enum.
Args:
enum: The parsed enum to wrap.
class_name: The class under which the enum is defined.
prefix: The amount of indentation.
Definition at line 385 of file pybind_wrapper.py.
◆ wrap_enums()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_enums |
( |
|
self, |
|
|
|
enums, |
|
|
|
instantiated_class, |
|
|
|
prefix = ' ' * 4 |
|
) |
| |
◆ wrap_file()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_file |
( |
|
self, |
|
|
|
content, |
|
|
|
module_name = None , |
|
|
|
submodules = None |
|
) |
| |
Wrap the code in the interface file.
Args:
content: The contents of the interface file.
module_name: The name of the module.
submodules: List of other interface file names that should be linked to.
Definition at line 676 of file pybind_wrapper.py.
◆ wrap_functions()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_functions |
( |
|
self, |
|
|
|
functions, |
|
|
|
namespace, |
|
|
|
prefix = '\n' + ' ' * 8 , |
|
|
|
suffix = '' |
|
) |
| |
◆ wrap_instantiated_class()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_instantiated_class |
( |
|
self, |
|
|
instantiator.InstantiatedClass |
instantiated_class |
|
) |
| |
◆ wrap_instantiated_declaration()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_instantiated_declaration |
( |
|
self, |
|
|
instantiator.InstantiatedDeclaration |
instantiated_decl |
|
) |
| |
◆ wrap_methods()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_methods |
( |
|
self, |
|
|
|
methods, |
|
|
|
cpp_class, |
|
|
|
prefix = '\n' + ' ' * 8 , |
|
|
|
suffix = '' |
|
) |
| |
◆ wrap_namespace()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_namespace |
( |
|
self, |
|
|
|
namespace |
|
) |
| |
◆ wrap_operators()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_operators |
( |
|
self, |
|
|
|
operators, |
|
|
|
cpp_class, |
|
|
|
prefix = '\n' + ' ' * 8 |
|
) |
| |
Wrap all the overloaded operators in the `cpp_class`.
Definition at line 367 of file pybind_wrapper.py.
◆ wrap_properties()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_properties |
( |
|
self, |
|
|
|
properties, |
|
|
|
cpp_class, |
|
|
|
prefix = '\n' + ' ' * 8 |
|
) |
| |
◆ wrap_stl_class()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_stl_class |
( |
|
self, |
|
|
|
stl_class |
|
) |
| |
◆ wrap_submodule()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_submodule |
( |
|
self, |
|
|
|
source |
|
) |
| |
Wrap a list of submodule files, i.e. a set of interface files which are
in support of a larger wrapping project.
E.g. This is used in GTSAM where we have a main gtsam.i, but various smaller .i files
which are the submodules.
The benefit of this scheme is that it reduces compute and memory usage during compilation.
Args:
source: Interface file which forms the submodule.
Definition at line 736 of file pybind_wrapper.py.
◆ wrap_variable()
def gtwrap.pybind_wrapper.PybindWrapper.wrap_variable |
( |
|
self, |
|
|
|
namespace, |
|
|
|
module_var, |
|
|
|
variable, |
|
|
|
prefix = '\n' + ' ' * 8 |
|
) |
| |
Wrap a variable that's not part of a class (i.e. global)
Definition at line 332 of file pybind_wrapper.py.
◆ _ipython_special_methods
gtwrap.pybind_wrapper.PybindWrapper._ipython_special_methods |
|
private |
◆ _serializing_classes
gtwrap.pybind_wrapper.PybindWrapper._serializing_classes |
|
private |
◆ dunder_methods
gtwrap.pybind_wrapper.PybindWrapper.dunder_methods |
◆ ignore_classes
gtwrap.pybind_wrapper.PybindWrapper.ignore_classes |
◆ method_indent
gtwrap.pybind_wrapper.PybindWrapper.method_indent |
◆ module_name
gtwrap.pybind_wrapper.PybindWrapper.module_name |
◆ module_template
gtwrap.pybind_wrapper.PybindWrapper.module_template |
◆ python_keywords
gtwrap.pybind_wrapper.PybindWrapper.python_keywords |
◆ top_module_namespaces
gtwrap.pybind_wrapper.PybindWrapper.top_module_namespaces |
◆ use_boost_serialization
gtwrap.pybind_wrapper.PybindWrapper.use_boost_serialization |
The documentation for this class was generated from the following file: