Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
gtwrap.pybind_wrapper.PybindWrapper Class Reference

Public Member Functions

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_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
 
def wrap_instantiated_declaration
 
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)
 

Public Attributes

 ignore_classes
 
 method_indent
 
 module_name
 
 module_template
 
 python_keywords
 
 top_module_namespaces
 
 use_boost_serialization
 

Private Member Functions

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_method (self, method, cpp_class, prefix, suffix, method_suffix="")
 
def _wrap_print
 
def _wrap_serialization (self, cpp_class)
 

Private Attributes

 _ipython_special_methods
 
 _serializing_classes
 

Detailed Description

Class to generate binding code for Pybind11 specifically.

Definition at line 23 of file pybind_wrapper.py.

Constructor & Destructor Documentation

◆ __init__()

def gtwrap.pybind_wrapper.PybindWrapper.__init__ (   self,
  module_name,
  top_module_namespaces = '',
  use_boost_serialization = False,
  ignore_classes = (),
  module_template = "" 
)

Definition at line 33 of file pybind_wrapper.py.

Member Function Documentation

◆ _add_namespaces()

def gtwrap.pybind_wrapper.PybindWrapper._add_namespaces (   self,
  name,
  namespaces 
)
private

Definition at line 521 of file pybind_wrapper.py.

◆ _gen_module_var()

def gtwrap.pybind_wrapper.PybindWrapper._gen_module_var (   self,
  namespaces 
)
private
Get the Pybind11 module name from the namespaces.

Definition at line 515 of file pybind_wrapper.py.

◆ _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 73 of file pybind_wrapper.py.

◆ _partial_match()

def gtwrap.pybind_wrapper.PybindWrapper._partial_match (   self,
  namespaces1,
  namespaces2 
)
private

Definition at line 509 of file pybind_wrapper.py.

◆ _py_args_names()

def gtwrap.pybind_wrapper.PybindWrapper._py_args_names (   self,
  args 
)
private
Set the argument names in Pybind11 format.

Definition at line 56 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 161 of file pybind_wrapper.py.

◆ _wrap_print()

def gtwrap.pybind_wrapper.PybindWrapper._wrap_print (   self,
  ret 
)
private

Definition at line 115 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 95 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 697 of file pybind_wrapper.py.

◆ wrap_ctors()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_ctors (   self,
  my_class 
)
Wrap the constructors.

Definition at line 84 of file pybind_wrapper.py.

◆ 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 324 of file pybind_wrapper.py.

◆ wrap_enums()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_enums (   self,
  enums,
  instantiated_class,
  prefix = ' ' * 4 
)
Wrap multiple enums defined in a class.

Definition at line 349 of file pybind_wrapper.py.

◆ 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 612 of file pybind_wrapper.py.

◆ wrap_functions()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_functions (   self,
  functions,
  namespace,
  prefix = '\n' + ' ' * 8,
  suffix = '' 
)
Wrap all the global functions.

Definition at line 460 of file pybind_wrapper.py.

◆ wrap_instantiated_class()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_instantiated_class (   self,
  instantiated_class 
)

Definition at line 361 of file pybind_wrapper.py.

◆ wrap_instantiated_declaration()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_instantiated_declaration (   self,
  instantiated_decl 
)

Definition at line 415 of file pybind_wrapper.py.

◆ wrap_methods()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_methods (   self,
  methods,
  cpp_class,
  prefix = '\n' + ' ' * 8,
  suffix = '' 
)
Wrap all the methods in the `cpp_class`.

Definition at line 242 of file pybind_wrapper.py.

◆ wrap_namespace()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_namespace (   self,
  namespace 
)
Wrap the complete `namespace`.

Definition at line 529 of file pybind_wrapper.py.

◆ 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 306 of file pybind_wrapper.py.

◆ wrap_properties()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_properties (   self,
  properties,
  cpp_class,
  prefix = '\n' + ' ' * 8 
)
Wrap all the properties in the `cpp_class`.

Definition at line 292 of file pybind_wrapper.py.

◆ wrap_stl_class()

def gtwrap.pybind_wrapper.PybindWrapper.wrap_stl_class (   self,
  stl_class 
)
Wrap STL containers.

Definition at line 429 of file pybind_wrapper.py.

◆ 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 672 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 275 of file pybind_wrapper.py.

Member Data Documentation

◆ _ipython_special_methods

gtwrap.pybind_wrapper.PybindWrapper._ipython_special_methods
private

Definition at line 52 of file pybind_wrapper.py.

◆ _serializing_classes

gtwrap.pybind_wrapper.PybindWrapper._serializing_classes
private

Definition at line 38 of file pybind_wrapper.py.

◆ ignore_classes

gtwrap.pybind_wrapper.PybindWrapper.ignore_classes

Definition at line 37 of file pybind_wrapper.py.

◆ method_indent

gtwrap.pybind_wrapper.PybindWrapper.method_indent

Definition at line 49 of file pybind_wrapper.py.

◆ module_name

gtwrap.pybind_wrapper.PybindWrapper.module_name

Definition at line 34 of file pybind_wrapper.py.

◆ module_template

gtwrap.pybind_wrapper.PybindWrapper.module_template

Definition at line 39 of file pybind_wrapper.py.

◆ python_keywords

gtwrap.pybind_wrapper.PybindWrapper.python_keywords

Definition at line 40 of file pybind_wrapper.py.

◆ top_module_namespaces

gtwrap.pybind_wrapper.PybindWrapper.top_module_namespaces

Definition at line 35 of file pybind_wrapper.py.

◆ use_boost_serialization

gtwrap.pybind_wrapper.PybindWrapper.use_boost_serialization

Definition at line 36 of file pybind_wrapper.py.


The documentation for this class was generated from the following file:


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:47:26