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 (self, str namespace_name, InstantiatedClass inst_class) |
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 (self, parser.Variable class_property, InstantiatedClass instantiated_class=None) |
def | wrap_enum (self, enum) |
def | wrap_global_function (self, function) |
def | wrap_instantiated_class (self, instantiated_class, str namespace_name='') |
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 (self, parser.Type arg_type) |
def | is_class_enum (self, parser.Type arg_type, parser.Class class_) |
def | is_enum (self, parser.Type arg_type, parser.Class class_) |
def | is_global_enum (self, parser.Type arg_type, parser.Class class_) |
def | is_ptr (self, parser.Type arg_type) |
def | is_ref (self, parser.Type arg_type) |
def | is_shared_ptr (self, parser.Type arg_type) |
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 (self, str obj, parser.Type ctype, InstantiatedClass instantiated_class=None) |
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 (self, collector_function=None, id_diff=0, str function_name=None) |
def | _wrap_args (self, args) |
def | _wrap_list_variable_arguments (self, args) |
def | _wrap_method_check_statement (self, parser.ArgumentList args) |
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 | |
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.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.__init__ | ( | self, | |
module_name, | |||
top_module_namespace = '' , |
|||
ignore_classes = () , |
|||
use_boost_serialization = False |
|||
) |
Definition at line 33 of file wrapper.py.
|
private |
Helper method to get the final statement before the return in the collector function.
Definition at line 1273 of file wrapper.py.
|
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.
|
private |
Determine format of return and varargout statements
Definition at line 833 of file wrapper.py.
|
private |
Group overloaded methods together
Definition at line 828 of file wrapper.py.
|
private |
Group overloaded methods together
Definition at line 185 of file wrapper.py.
|
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.
|
private |
Definition at line 138 of file wrapper.py.
|
staticprivate |
The amount of objects returned by the given interface_parser.ReturnType.
Definition at line 432 of file wrapper.py.
|
private |
Definition at line 344 of file wrapper.py.
|
private |
Get and define wrapper ids. Generates the map of id -> collector function. Args: collector_function: tuple storing info about the wrapper function (namespace, class instance, function name, function object) id_diff: constant to add to the id in the map function_name: Optional custom function_name. Returns: the current wrapper id
Definition at line 101 of file wrapper.py.
|
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.
|
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.
|
private |
Wrap the given arguments into either just a varargout call or a call in an if statement that checks if the parameters are accurate. TODO Update this method so that default arguments are supported.
Definition at line 290 of file wrapper.py.
|
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.
|
private |
Determine the name of wrapper function.
Definition at line 438 of file wrapper.py.
|
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 381 of file wrapper.py.
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.
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.
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.
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 1419 of file wrapper.py.
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 1852 of file wrapper.py.
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 1683 of file wrapper.py.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.generate_wrapper | ( | self, | |
namespace | |||
) |
Generate the c++ wrapper.
Definition at line 1750 of file wrapper.py.
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 1672 of file wrapper.py.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.mex_function | ( | self | ) |
Generate the wrapped MEX function.
Definition at line 1635 of file wrapper.py.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap | ( | self, | |
files, | |||
path | |||
) |
High level function to wrap the project.
Definition at line 1906 of file wrapper.py.
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 622 of file wrapper.py.
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.
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.
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 844 of file wrapper.py.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_class_properties | ( | self, | |
str | namespace_name, | ||
InstantiatedClass | inst_class | ||
) |
Generate wrappers for the setters & getters of class properties. Args: inst_class: The instantiated class whose properties we wish to wrap.
Definition at line 761 of file wrapper.py.
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 1819 of file wrapper.py.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_deserialize | ( | self, | |
class_name, | |||
full_name = '' , |
|||
namespace = '' |
|||
) |
Wrap the deserizalize collector function.
Definition at line 1842 of file wrapper.py.
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 1340 of file wrapper.py.
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.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_function_serialize | ( | self, | |
class_name, | |||
full_name = '' , |
|||
namespace = '' |
|||
) |
Wrap the serizalize collector function.
Definition at line 1832 of file wrapper.py.
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 1225 of file wrapper.py.
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.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_collector_property_return | ( | self, | |
parser.Variable | class_property, | ||
InstantiatedClass | instantiated_class = None |
||
) |
Get the last collector function statement before return for a property.
Definition at line 1399 of file wrapper.py.
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.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_global_function | ( | self, | |
function | |||
) |
Wrap the given global function.
Definition at line 571 of file wrapper.py.
def gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrap_instantiated_class | ( | self, | |
instantiated_class, | |||
str | namespace_name = '' |
||
) |
Generate comments and code for given class. Args: instantiated_class: template_instantiator.InstantiatedClass instance storing the class to wrap namespace_name: the name of the namespace if there is one
Definition at line 1023 of file wrapper.py.
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.
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.
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.
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.
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 939 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.data_type |
Definition at line 44 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.data_type_param |
Definition at line 56 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.global_function_id |
Definition at line 82 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.ignore_classes |
Definition at line 38 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.module_name |
Definition at line 36 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.top_module_namespace |
Definition at line 37 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.use_boost_serialization |
Definition at line 40 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.verbose |
Definition at line 39 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrapper_file_headers |
Definition at line 89 of file wrapper.py.
gtwrap.matlab_wrapper.wrapper.MatlabWrapper.wrapper_id |
Definition at line 70 of file wrapper.py.