Skip to content

Commit 8534beb

Browse files
committed
small improvements to matlab wrapper main code
1 parent 055fee3 commit 8534beb

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

gtwrap/matlab_wrapper/wrapper.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ def _update_wrapper_id(self,
108108
109109
Args:
110110
collector_function: tuple storing info about the wrapper function
111-
(namespace, class instance, function name, function object)
111+
(namespace, class/function instance,
112+
type of collector function, method object if class instance)
112113
id_diff: constant to add to the id in the map
113114
function_name: Optional custom function_name.
114115
@@ -578,6 +579,7 @@ def wrap_global_function(self, function):
578579
# Get all combinations of parameters
579580
param_wrap = ''
580581

582+
# Iterate through possible overloads of the function
581583
for i, overload in enumerate(function):
582584
param_wrap += ' if' if i == 0 else ' elseif'
583585
param_wrap += ' length(varargin) == '
@@ -1218,7 +1220,7 @@ def wrap_namespace(self, namespace, add_mex_file=True):
12181220
if isinstance(func, parser.GlobalFunction)
12191221
]
12201222

1221-
self.wrap_methods(all_funcs, True, global_ns=namespace)
1223+
self.wrap_methods(all_funcs, global_funcs=True, global_ns=namespace)
12221224

12231225
return wrapped
12241226

@@ -1365,8 +1367,8 @@ def wrap_collector_function_return(self, method, instantiated_class=None):
13651367
method_name += method.original.name
13661368

13671369
elif isinstance(method, parser.GlobalFunction):
1368-
method_name = self._format_global_function(method, '::')
1369-
method_name += method.name
1370+
namespace = self._format_global_function(method, '::')
1371+
method_name = namespace + method.to_cpp()
13701372

13711373
else:
13721374
if isinstance(method.parent, instantiator.InstantiatedClass):
@@ -1624,7 +1626,7 @@ def generate_collector_function(self, func_id):
16241626

16251627
body += self._wrapper_unwrap_arguments(collector_func[1].args)[1]
16261628
body += self.wrap_collector_function_return(
1627-
collector_func[1]) + '\n}\n'
1629+
collector_func[1]) + "\n}\n"
16281630

16291631
collector_function += body
16301632

0 commit comments

Comments
 (0)