Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | List of all members
gtwrap.matlab_wrapper.wrapper.MatlabWrapper Class Reference
Inheritance diagram for gtwrap.matlab_wrapper.wrapper.MatlabWrapper:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, module_name, top_module_namespace='', ignore_classes=(), use_boost_serialization=False)
 
def add_class (self, instantiated_class)
 
def class_comment (self, instantiated_class)
 
def class_serialize_comment (self, class_name, static_methods)
 
def generate_collector_function (self, func_id)
 
def generate_content (self, cc_content, path)
 
def generate_preamble (self)
 
def generate_wrapper (self, namespace)
 
def get_class_name (self, cls)
 
def mex_function (self)
 
def wrap (self, files, path)
 
def wrap_class_constructors (self, namespace_name, inst_class, parent_name, ctors, is_virtual)
 
def wrap_class_deconstructor (self, namespace_name, inst_class)
 
def wrap_class_display (self)
 
def wrap_class_methods (self, namespace_name, inst_class, methods, serialize=(False,))
 
def wrap_class_properties
 
def wrap_class_serialize_method (self, namespace_name, inst_class)
 
def wrap_collector_function_deserialize (self, class_name, full_name='', namespace='')
 
def wrap_collector_function_return (self, method, instantiated_class=None)
 
def wrap_collector_function_return_types (self, return_type, func_id)
 
def wrap_collector_function_serialize (self, class_name, full_name='', namespace='')
 
def wrap_collector_function_shared_return (self, return_type_name, shared_obj, func_id, new_line=True)
 
def wrap_collector_function_upcast_from_void (self, class_name, func_id, cpp_name)
 
def wrap_collector_property_return
 
def wrap_enum (self, enum)
 
def wrap_global_function (self, function)
 
def wrap_instantiated_class
 
def wrap_method (self, methods)
 
def wrap_methods (self, methods, global_funcs=False, global_ns=None)
 
def wrap_namespace (self, namespace, add_mex_file=True)
 
def wrap_properties_block (self, class_name, inst_class)
 
def wrap_static_methods (self, namespace_name, instantiated_class, serialize)
 
- Public Member Functions inherited from gtwrap.matlab_wrapper.mixins.CheckMixin
def can_be_pointer
 
def is_class_enum
 
def is_enum
 
def is_global_enum
 
def is_ptr
 
def is_ref
 
def is_shared_ptr
 

Public Attributes

 data_type
 
 data_type_param
 
 global_function_id
 
 ignore_classes
 
 module_name
 
 top_module_namespace
 
 use_boost_serialization
 
 verbose
 
 wrapper_file_headers
 
 wrapper_id
 

Private Member Functions

def _collector_return
 
def _format_varargout (cls, return_type, return_type_formatted)
 
def _group_class_methods (self, methods)
 
def _group_methods (self, methods)
 
def _insert_spaces (self, x, y)
 
def _qualified_name (self, names)
 
def _unwrap_argument (self, arg, arg_id=0, instantiated_class=None)
 
def _update_wrapper_id
 
def _wrap_args (self, args)
 
def _wrap_list_variable_arguments (self, args)
 
def _wrap_method_check_statement
 
def _wrap_variable_arguments (self, args, wrap_datatypes=True)
 
def _wrapper_name (self)
 
def _wrapper_unwrap_arguments (self, args, arg_id=0, instantiated_class=None)
 

Static Private Member Functions

def _expand_default_arguments (method, save_backup=True)
 
def _return_count (return_type)
 

Additional Inherited Members

- Static Public Attributes inherited from gtwrap.matlab_wrapper.mixins.CheckMixin
 list
 
 Tuple
 

Detailed Description

Wrap the given C++ code into Matlab.

Attributes
    module: the C++ module being wrapped
    module_name: name of the C++ module being wrapped
    top_module_namespace: C++ namespace for the top module (default '')
    ignore_classes: A list of classes to ignore (default [])

Definition at line 23 of file wrapper.py.

Constructor & Destructor Documentation

◆ __init__()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.__init__ (   self,
  module_name,
  top_module_namespace = '',
  ignore_classes = (),
  use_boost_serialization = False 
)

Definition at line 37 of file wrapper.py.

Member Function Documentation

◆ _collector_return()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._collector_return (   self,
  obj 
)
private

Definition at line 1274 of file wrapper.py.

◆ _expand_default_arguments()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._expand_default_arguments (   method,
  save_backup = True 
)
staticprivate
Recursively expand all possibilities for optional default arguments.
We create "overload" functions with fewer arguments, but since we have to "remember" what
the default arguments are for later, we make a backup.

Definition at line 151 of file wrapper.py.

◆ _format_varargout()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._format_varargout (   cls,
  return_type,
  return_type_formatted 
)
private
Determine format of return and varargout statements

Definition at line 833 of file wrapper.py.

◆ _group_class_methods()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._group_class_methods (   self,
  methods 
)
private
Group overloaded methods together

Definition at line 828 of file wrapper.py.

◆ _group_methods()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._group_methods (   self,
  methods 
)
private
Group overloaded methods together

Definition at line 185 of file wrapper.py.

◆ _insert_spaces()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._insert_spaces (   self,
  x,
  y 
)
private
Insert spaces at the beginning of each line

Args:
    x: the statement currently generated
    y: the addition to add to the statement

Definition at line 141 of file wrapper.py.

◆ _qualified_name()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._qualified_name (   self,
  names 
)
private

Definition at line 138 of file wrapper.py.

◆ _return_count()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._return_count (   return_type)
staticprivate
The amount of objects returned by the given
interface_parser.ReturnType.

Definition at line 432 of file wrapper.py.

◆ _unwrap_argument()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._unwrap_argument (   self,
  arg,
  arg_id = 0,
  instantiated_class = None 
)
private

Definition at line 344 of file wrapper.py.

◆ _update_wrapper_id()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._update_wrapper_id (   self,
  collector_function = None,
  id_diff = 0,
  function_name 
)
private

Definition at line 104 of file wrapper.py.

◆ _wrap_args()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._wrap_args (   self,
  args 
)
private
Wrap an interface_parser.ArgumentList into a list of arguments.

Returns:
    A string representation of the arguments. For example:
'int x, double y'

Definition at line 204 of file wrapper.py.

◆ _wrap_list_variable_arguments()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._wrap_list_variable_arguments (   self,
  args 
)
private
Wrap an interface_parser.ArgumentList into a list of argument
variables.

Returns:
    A string representation of a list of variable arguments.
    For example:
'varargin{1}, varargin{2}, varargin{3}'

Definition at line 269 of file wrapper.py.

◆ _wrap_method_check_statement()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._wrap_method_check_statement (   self,
  args 
)
private

Definition at line 290 of file wrapper.py.

◆ _wrap_variable_arguments()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._wrap_variable_arguments (   self,
  args,
  wrap_datatypes = True 
)
private
Wrap an interface_parser.ArgumentList into a statement of argument
checks.

Returns:
    A string representation of a variable arguments for an if
    statement. For example:
' && isa(varargin{1},'double') && isa(varargin{2},'numeric')'

Definition at line 224 of file wrapper.py.

◆ _wrapper_name()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._wrapper_name (   self)
private
Determine the name of wrapper function.

Definition at line 438 of file wrapper.py.

◆ _wrapper_unwrap_arguments()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper._wrapper_unwrap_arguments (   self,
  args,
  arg_id = 0,
  instantiated_class = None 
)
private
Format the interface_parser.Arguments.

Examples:
    ((a), unsigned char a = unwrap< unsigned char >(in[1]);),
    ((a), Test& t = *unwrap_shared_ptr< Test >(in[1], "ptr_Test");),
    ((a), std::shared_ptr<Test> p1 = unwrap_shared_ptr< Test >(in[1], "ptr_Test");)

Definition at line 384 of file wrapper.py.

◆ add_class()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.add_class (   self,
  instantiated_class 
)
Add `instantiated_class` to the list of classes.

Definition at line 95 of file wrapper.py.

◆ class_comment()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.class_comment (   self,
  instantiated_class 
)
Generate comments for the given class in Matlab.

Args
    instantiated_class: the class being wrapped
    ctors: a list of the constructors in the class
    methods: a list of the methods in the class

Definition at line 467 of file wrapper.py.

◆ class_serialize_comment()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.class_serialize_comment (   self,
  class_name,
  static_methods 
)
Generate comments for serialize methods.

Definition at line 442 of file wrapper.py.

◆ generate_collector_function()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.generate_collector_function (   self,
  func_id 
)
Generate the complete collector function that goes into the wrapper.cpp file.

A collector function is the Mex function used to interact between
the C++ object and the Matlab .m files.

Definition at line 1418 of file wrapper.py.

◆ generate_content()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.generate_content (   self,
  cc_content,
  path 
)
Generate files and folders from matlab wrapper content.

Args:
    cc_content: The content to generate formatted as
(file_name, file_content) or
(folder_name, [(file_name, file_content)])
    path: The path to the files parent folder within the main folder

Definition at line 1851 of file wrapper.py.

◆ generate_preamble()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.generate_preamble (   self)
Generate the preamble of the wrapper file, which includes
the Boost exports, typedefs for collectors, and
the _deleteAllObjects and _RTTIRegister functions.

Definition at line 1682 of file wrapper.py.

◆ generate_wrapper()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.generate_wrapper (   self,
  namespace 
)
Generate the c++ wrapper.

Definition at line 1749 of file wrapper.py.

◆ get_class_name()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.get_class_name (   self,
  cls 
)
Get the name of the class `cls` taking template instantiations into account.

Definition at line 1671 of file wrapper.py.

◆ mex_function()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.mex_function (   self)
Generate the wrapped MEX function.

Definition at line 1634 of file wrapper.py.

◆ wrap()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap (   self,
  files,
  path 
)
High level function to wrap the project.

Definition at line 1901 of file wrapper.py.

◆ wrap_class_constructors()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_class_constructors (   self,
  namespace_name,
  inst_class,
  parent_name,
  ctors,
  is_virtual 
)
Wrap class constructor.

Args:
    namespace_name: the name of the namespace ('' if it does not exist)
    inst_class: instance of the class
    parent_name: the name of the parent class if it exists
    ctors: the interface_parser.Constructor in the class
    is_virtual: whether the class is part of a virtual inheritance
chain

Definition at line 623 of file wrapper.py.

◆ wrap_class_deconstructor()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_class_deconstructor (   self,
  namespace_name,
  inst_class 
)
Generate the delete function for the Matlab class.

Definition at line 801 of file wrapper.py.

◆ wrap_class_display()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_class_display (   self)
Generate the display function for the Matlab class.

Definition at line 818 of file wrapper.py.

◆ wrap_class_methods()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_class_methods (   self,
  namespace_name,
  inst_class,
  methods,
  serialize = (False, ) 
)
Wrap the methods in the class.

Args:
    namespace_name: the name of the class's namespace
    inst_class: the instantiated class whose methods to wrap
    methods: the methods to wrap in the order to wrap them
    serialize: mutable param storing if one of the methods is serialize

Definition at line 848 of file wrapper.py.

◆ wrap_class_properties()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_class_properties (   self,
  namespace_name 
)

Definition at line 761 of file wrapper.py.

◆ wrap_class_serialize_method()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_class_serialize_method (   self,
  namespace_name,
  inst_class 
)
Wrap the serizalize method of the class.

Definition at line 1818 of file wrapper.py.

◆ wrap_collector_function_deserialize()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_deserialize (   self,
  class_name,
  full_name = '',
  namespace = '' 
)
Wrap the deserizalize collector function.

Definition at line 1844 of file wrapper.py.

◆ wrap_collector_function_return()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_return (   self,
  method,
  instantiated_class = None 
)
Wrap the complete return type of the function.

Definition at line 1339 of file wrapper.py.

◆ wrap_collector_function_return_types()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_return_types (   self,
  return_type,
  func_id 
)
Wrap the return type of the collector function when a std::pair is returned.

Definition at line 1240 of file wrapper.py.

◆ wrap_collector_function_serialize()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_serialize (   self,
  class_name,
  full_name = '',
  namespace = '' 
)
Wrap the serizalize collector function.

Definition at line 1834 of file wrapper.py.

◆ wrap_collector_function_shared_return()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_shared_return (   self,
  return_type_name,
  shared_obj,
  func_id,
  new_line = True 
)
Wrap the collector function which returns a shared pointer.

Definition at line 1229 of file wrapper.py.

◆ wrap_collector_function_upcast_from_void()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_upcast_from_void (   self,
  class_name,
  func_id,
  cpp_name 
)
Add function to upcast type from void type.

Definition at line 1411 of file wrapper.py.

◆ wrap_collector_property_return()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_property_return (   self,
  class_property 
)

Definition at line 1400 of file wrapper.py.

◆ wrap_enum()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_enum (   self,
  enum 
)
Wrap an enum definition as a Matlab class.

Args:
    enum: The interface_parser.Enum instance

Definition at line 1136 of file wrapper.py.

◆ wrap_global_function()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_global_function (   self,
  function 
)
Wrap the given global function.

Definition at line 571 of file wrapper.py.

◆ wrap_instantiated_class()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_instantiated_class (   self,
  instantiated_class,
  namespace_name 
)

Definition at line 1025 of file wrapper.py.

◆ wrap_method()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_method (   self,
  methods 
)
Wrap methods in the body of a class.

Definition at line 538 of file wrapper.py.

◆ wrap_methods()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_methods (   self,
  methods,
  global_funcs = False,
  global_ns = None 
)
Wrap a sequence of methods/functions. Groups methods with the same names
together.
If global_funcs is True then output every method into its own file.

Definition at line 547 of file wrapper.py.

◆ wrap_namespace()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_namespace (   self,
  namespace,
  add_mex_file = True 
)
Wrap a namespace by wrapping all of its components.

Args:
    namespace: the interface_parser.namespace instance of the namespace
    add_cpp_file: Flag indicating whether the mex file should be added

Definition at line 1159 of file wrapper.py.

◆ wrap_properties_block()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_properties_block (   self,
  class_name,
  inst_class 
)
Generate Matlab properties block of the class.

E.g.
```
properties
    ptr_gtsamISAM2Params = 0
    relinearizeSkip
end
```

Args:
    class_name: Class name with namespace to assign unique pointer.
    inst_class: The instantiated class whose properties we want to wrap.

Returns:
    str: The `properties` block in a Matlab `classdef`.

Definition at line 726 of file wrapper.py.

◆ wrap_static_methods()

def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_static_methods (   self,
  namespace_name,
  instantiated_class,
  serialize 
)
Wrap the static methods in the class.

Definition at line 940 of file wrapper.py.

Member Data Documentation

◆ data_type

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.data_type

Definition at line 48 of file wrapper.py.

◆ data_type_param

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.data_type_param

Definition at line 60 of file wrapper.py.

◆ global_function_id

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.global_function_id

Definition at line 86 of file wrapper.py.

◆ ignore_classes

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.ignore_classes

Definition at line 42 of file wrapper.py.

◆ module_name

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.module_name

Definition at line 40 of file wrapper.py.

◆ top_module_namespace

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.top_module_namespace

Definition at line 41 of file wrapper.py.

◆ use_boost_serialization

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.use_boost_serialization

Definition at line 44 of file wrapper.py.

◆ verbose

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.verbose

Definition at line 43 of file wrapper.py.

◆ wrapper_file_headers

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrapper_file_headers

Definition at line 93 of file wrapper.py.

◆ wrapper_id

gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrapper_id

Definition at line 74 of file 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