Merging 'master' into 'wrap'
commit
04b9625825
|
@ -78,7 +78,8 @@ class MatlabWrapper(object):
|
|||
|
||||
# Ensure the template file is always picked up from the correct directory.
|
||||
dir_path = osp.dirname(osp.realpath(__file__))
|
||||
wrapper_file_template = osp.join(dir_path, "matlab_wrapper.tpl")
|
||||
with open(osp.join(dir_path, "matlab_wrapper.tpl")) as f:
|
||||
wrapper_file_header = f.read()
|
||||
|
||||
def __init__(self,
|
||||
module,
|
||||
|
@ -668,8 +669,7 @@ class MatlabWrapper(object):
|
|||
"""Generate the C++ file for the wrapper."""
|
||||
file_name = self._wrapper_name() + '.cpp'
|
||||
|
||||
with open(self.wrapper_file_template) as f:
|
||||
wrapper_file = f.read()
|
||||
wrapper_file = self.wrapper_file_header
|
||||
|
||||
return file_name, wrapper_file
|
||||
|
||||
|
@ -1630,13 +1630,11 @@ class MatlabWrapper(object):
|
|||
def generate_wrapper(self, namespace):
|
||||
"""Generate the c++ wrapper."""
|
||||
# Includes
|
||||
wrapper_file = textwrap.dedent('''\
|
||||
#include <gtwrap/matlab.h>
|
||||
#include <map>\n
|
||||
wrapper_file = self.wrapper_file_header + textwrap.dedent("""
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/serialization/export.hpp>\n
|
||||
''')
|
||||
""")
|
||||
|
||||
assert namespace
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ def instantiate_type(ctype: parser.Type,
|
|||
cpp_typename = parser.Typename(
|
||||
namespaces_name,
|
||||
instantiations=instantiated_class.instantiations)
|
||||
|
||||
return parser.Type(
|
||||
typename=cpp_typename,
|
||||
is_const=ctype.is_const,
|
||||
|
@ -92,15 +93,18 @@ def instantiate_args_list(args_list, template_typenames, instantiations,
|
|||
"""
|
||||
instantiated_args = []
|
||||
for arg in args_list:
|
||||
new_type = instantiate_type(
|
||||
arg.ctype, template_typenames, instantiations, cpp_typename)
|
||||
instantiated_args.append(
|
||||
parser.Argument(name=arg.name, ctype=new_type))
|
||||
new_type = instantiate_type(arg.ctype, template_typenames,
|
||||
instantiations, cpp_typename)
|
||||
instantiated_args.append(parser.Argument(name=arg.name,
|
||||
ctype=new_type))
|
||||
return instantiated_args
|
||||
|
||||
|
||||
def instantiate_return_type(return_type, template_typenames, instantiations,
|
||||
cpp_typename, instantiated_class=None):
|
||||
def instantiate_return_type(return_type,
|
||||
template_typenames,
|
||||
instantiations,
|
||||
cpp_typename,
|
||||
instantiated_class=None):
|
||||
"""Instantiate the return type."""
|
||||
new_type1 = instantiate_type(return_type.type1,
|
||||
template_typenames,
|
||||
|
@ -135,6 +139,7 @@ def instantiate_name(original_name, instantiations):
|
|||
|
||||
return "{}{}".format(original_name, "".join(instantiated_names))
|
||||
|
||||
|
||||
class InstantiatedGlobalFunction(parser.GlobalFunction):
|
||||
"""
|
||||
Instantiate global functions.
|
||||
|
@ -183,22 +188,24 @@ class InstantiatedGlobalFunction(parser.GlobalFunction):
|
|||
def to_cpp(self):
|
||||
"""Generate the C++ code for wrapping."""
|
||||
if self.original.template:
|
||||
instantiated_names = [inst.instantiated_name() for inst in self.instantiations]
|
||||
ret = "{}<{}>".format(self.original.name, ",".join(instantiated_names))
|
||||
instantiated_names = [
|
||||
inst.instantiated_name() for inst in self.instantiations
|
||||
]
|
||||
ret = "{}<{}>".format(self.original.name,
|
||||
",".join(instantiated_names))
|
||||
else:
|
||||
ret = self.original.name
|
||||
return ret
|
||||
|
||||
def __repr__(self):
|
||||
return "Instantiated {}".format(
|
||||
super(InstantiatedGlobalFunction, self).__repr__()
|
||||
)
|
||||
super(InstantiatedGlobalFunction, self).__repr__())
|
||||
|
||||
|
||||
class InstantiatedMethod(parser.Method):
|
||||
"""
|
||||
We can only instantiate template methods with a single template parameter.
|
||||
"""
|
||||
|
||||
def __init__(self, original, instantiation=''):
|
||||
self.original = original
|
||||
self.instantiation = instantiation
|
||||
|
@ -251,8 +258,7 @@ class InstantiatedMethod(parser.Method):
|
|||
|
||||
def __repr__(self):
|
||||
return "Instantiated {}".format(
|
||||
super(InstantiatedMethod, self).__repr__()
|
||||
)
|
||||
super(InstantiatedMethod, self).__repr__())
|
||||
|
||||
|
||||
class InstantiatedClass(parser.Class):
|
||||
|
@ -272,28 +278,32 @@ class InstantiatedClass(parser.Class):
|
|||
self.parent_class = original.parent_class
|
||||
self.parent = original.parent
|
||||
|
||||
if not original.template:
|
||||
self.name = original.name
|
||||
self.ctors = list(original.ctors)
|
||||
self.static_methods = list(original.static_methods)
|
||||
class_instantiated_methods = list(original.methods)
|
||||
self.properties = list(original.properties)
|
||||
else:
|
||||
# Check conditions.
|
||||
# If the class is templated, check if the number of provided instantiations
|
||||
# match the number of templates, else it's only a partial instantiation which is bad.
|
||||
if original.template:
|
||||
assert len(original.template.typenames) == len(
|
||||
instantiations), "Typenames and instantiations mismatch!"
|
||||
|
||||
self.name = instantiate_name(
|
||||
original.name, instantiations) if not new_name else new_name
|
||||
self.ctors = self.instantiate_ctors()
|
||||
self.static_methods = self.instantiate_static_methods()
|
||||
class_instantiated_methods = \
|
||||
self.instantiate_class_templates_in_methods()
|
||||
self.properties = self.instantiate_properties()
|
||||
# Get the instantiated name of the class. E.g. FuncDouble
|
||||
self.name = instantiate_name(
|
||||
original.name, instantiations) if not new_name else new_name
|
||||
|
||||
# Second instantiation round to instantiate template methods.
|
||||
# Check for typenames if templated.
|
||||
# By passing in typenames, we can gracefully handle both templated and non-templated classes
|
||||
# This will allow the `This` keyword to be used in both templated and non-templated classes.
|
||||
typenames = self.original.template.typenames if self.original.template else []
|
||||
|
||||
# Instantiate the constructors, static methods, properties and instance methods, respectively.
|
||||
self.ctors = self.instantiate_ctors(typenames)
|
||||
self.static_methods = self.instantiate_static_methods(typenames)
|
||||
self.properties = self.instantiate_properties(typenames)
|
||||
instantiated_methods = self.instantiate_class_templates_in_methods(
|
||||
typenames)
|
||||
|
||||
# Second instantiation round to instantiate templated methods.
|
||||
# This is done in case both the class and the method are templated.
|
||||
self.methods = []
|
||||
for method in class_instantiated_methods:
|
||||
for method in instantiated_methods:
|
||||
if not method.template:
|
||||
self.methods.append(InstantiatedMethod(method, ''))
|
||||
else:
|
||||
|
@ -328,83 +338,114 @@ class InstantiatedClass(parser.Class):
|
|||
for m in self.static_methods]),
|
||||
)
|
||||
|
||||
def instantiate_ctors(self):
|
||||
"""Instantiate the class constructors."""
|
||||
def instantiate_ctors(self, typenames):
|
||||
"""
|
||||
Instantiate the class constructors.
|
||||
|
||||
Args:
|
||||
typenames: List of template types to instantiate.
|
||||
|
||||
Return: List of constructors instantiated with provided template args.
|
||||
"""
|
||||
instantiated_ctors = []
|
||||
|
||||
for ctor in self.original.ctors:
|
||||
instantiated_args = instantiate_args_list(
|
||||
ctor.args.args_list,
|
||||
self.original.template.typenames,
|
||||
typenames,
|
||||
self.instantiations,
|
||||
self.cpp_typename(),
|
||||
)
|
||||
instantiated_ctors.append(parser.Constructor(
|
||||
name=self.name,
|
||||
args=parser.ArgumentList(instantiated_args),
|
||||
parent=self,
|
||||
))
|
||||
instantiated_ctors.append(
|
||||
parser.Constructor(
|
||||
name=self.name,
|
||||
args=parser.ArgumentList(instantiated_args),
|
||||
parent=self,
|
||||
))
|
||||
return instantiated_ctors
|
||||
|
||||
def instantiate_static_methods(self):
|
||||
"""Instantiate static methods in the class."""
|
||||
def instantiate_static_methods(self, typenames):
|
||||
"""
|
||||
Instantiate static methods in the class.
|
||||
|
||||
Args:
|
||||
typenames: List of template types to instantiate.
|
||||
|
||||
Return: List of static methods instantiated with provided template args.
|
||||
"""
|
||||
instantiated_static_methods = []
|
||||
for static_method in self.original.static_methods:
|
||||
instantiated_args = instantiate_args_list(
|
||||
static_method.args.args_list,
|
||||
self.original.template.typenames,
|
||||
self.instantiations,
|
||||
self.cpp_typename()
|
||||
)
|
||||
static_method.args.args_list, typenames, self.instantiations,
|
||||
self.cpp_typename())
|
||||
instantiated_static_methods.append(
|
||||
parser.StaticMethod(
|
||||
name=static_method.name,
|
||||
return_type=instantiate_return_type(
|
||||
static_method.return_type,
|
||||
self.original.template.typenames,
|
||||
typenames,
|
||||
self.instantiations,
|
||||
self.cpp_typename(),
|
||||
instantiated_class=self
|
||||
),
|
||||
instantiated_class=self),
|
||||
args=parser.ArgumentList(instantiated_args),
|
||||
parent=self,
|
||||
)
|
||||
)
|
||||
))
|
||||
return instantiated_static_methods
|
||||
|
||||
def instantiate_class_templates_in_methods(self):
|
||||
def instantiate_class_templates_in_methods(self, typenames):
|
||||
"""
|
||||
This function only instantiates class templates in the methods.
|
||||
This function only instantiates the class-level templates in the methods.
|
||||
Template methods are instantiated in InstantiatedMethod in the second
|
||||
round.
|
||||
|
||||
E.g.
|
||||
```
|
||||
template<T={string}>
|
||||
class Greeter{
|
||||
void sayHello(T& name);
|
||||
};
|
||||
|
||||
Args:
|
||||
typenames: List of template types to instantiate.
|
||||
|
||||
Return: List of methods instantiated with provided template args on the class.
|
||||
"""
|
||||
class_instantiated_methods = []
|
||||
for method in self.original.methods:
|
||||
instantiated_args = instantiate_args_list(
|
||||
method.args.args_list,
|
||||
self.original.template.typenames,
|
||||
typenames,
|
||||
self.instantiations,
|
||||
self.cpp_typename(),
|
||||
)
|
||||
class_instantiated_methods.append(parser.Method(
|
||||
template=method.template,
|
||||
name=method.name,
|
||||
return_type=instantiate_return_type(
|
||||
method.return_type,
|
||||
self.original.template.typenames,
|
||||
self.instantiations,
|
||||
self.cpp_typename(),
|
||||
),
|
||||
args=parser.ArgumentList(instantiated_args),
|
||||
is_const=method.is_const,
|
||||
parent=self,
|
||||
))
|
||||
class_instantiated_methods.append(
|
||||
parser.Method(
|
||||
template=method.template,
|
||||
name=method.name,
|
||||
return_type=instantiate_return_type(
|
||||
method.return_type,
|
||||
typenames,
|
||||
self.instantiations,
|
||||
self.cpp_typename(),
|
||||
),
|
||||
args=parser.ArgumentList(instantiated_args),
|
||||
is_const=method.is_const,
|
||||
parent=self,
|
||||
))
|
||||
return class_instantiated_methods
|
||||
|
||||
def instantiate_properties(self):
|
||||
"""Instantiate the class properties."""
|
||||
def instantiate_properties(self, typenames):
|
||||
"""
|
||||
Instantiate the class properties.
|
||||
|
||||
Args:
|
||||
typenames: List of template types to instantiate.
|
||||
|
||||
Return: List of properties instantiated with provided template args.
|
||||
"""
|
||||
instantiated_properties = instantiate_args_list(
|
||||
self.original.properties,
|
||||
self.original.template.typenames,
|
||||
typenames,
|
||||
self.instantiations,
|
||||
self.cpp_typename(),
|
||||
)
|
||||
|
@ -448,6 +489,8 @@ def instantiate_namespace_inplace(namespace):
|
|||
instantiated_content.append(
|
||||
InstantiatedClass(original_class, []))
|
||||
else:
|
||||
# This case is for when the templates have enumerated instantiations.
|
||||
|
||||
# Use itertools to get all possible combinations of instantiations
|
||||
# Works even if one template does not have an instantiation list
|
||||
for instantiations in itertools.product(
|
||||
|
@ -471,6 +514,8 @@ def instantiate_namespace_inplace(namespace):
|
|||
list(instantiations)))
|
||||
|
||||
elif isinstance(element, parser.TypedefTemplateInstantiation):
|
||||
# This is for the case where `typedef` statements are used
|
||||
# to specify the template parameters.
|
||||
typedef_inst = element
|
||||
top_level = namespace.top_level()
|
||||
original_element = top_level.find_class_or_function(
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# include <${GTWRAP_INCLUDE_NAME}/matlab.h>
|
||||
# include <map>
|
||||
#include <${GTWRAP_INCLUDE_NAME}/matlab.h>
|
||||
#include <map>
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
actual-python/
|
||||
actual-matlab/
|
||||
actual-xml-generation/
|
||||
actual/**
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
%class PrimitiveRef, see Doxygen page for details
|
||||
%at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
%
|
||||
%-------Constructors-------
|
||||
%PrimitiveRef()
|
||||
%
|
||||
%-------Static Methods-------
|
||||
%Brutal(double t) : returns This
|
||||
%
|
||||
%-------Serialization Interface-------
|
||||
%string_serialize() : returns string
|
||||
%string_deserialize(string serialized) : returns PrimitiveRef
|
||||
%
|
||||
classdef PrimitiveRef < handle
|
||||
properties
|
||||
ptr_PrimitiveRef = 0
|
||||
end
|
||||
methods
|
||||
function obj = PrimitiveRef(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(78, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = geometry_wrapper(79);
|
||||
else
|
||||
error('Arguments do not match any overload of PrimitiveRef constructor');
|
||||
end
|
||||
obj.ptr_PrimitiveRef = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(80, obj.ptr_PrimitiveRef);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
function varargout = Brutal(varargin)
|
||||
% BRUTAL usage: Brutal(double t) : returns This
|
||||
% Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(81, varargin{:});
|
||||
return
|
||||
end
|
||||
|
||||
error('Arguments do not match any overload of function PrimitiveRef.Brutal');
|
||||
end
|
||||
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load Diff
|
@ -1,157 +0,0 @@
|
|||
|
||||
|
||||
#include <pybind11/eigen.h>
|
||||
#include <pybind11/stl_bind.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include "gtsam/nonlinear/utilities.h" // for RedirectCout.
|
||||
|
||||
#include "gtsam/geometry/Point2.h"
|
||||
#include "gtsam/geometry/Point3.h"
|
||||
#include "folder/path/to/Test.h"
|
||||
|
||||
#include "wrap/serialization.h"
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
BOOST_CLASS_EXPORT(gtsam::Point2)
|
||||
BOOST_CLASS_EXPORT(gtsam::Point3)
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(geometry_py, m_) {
|
||||
m_.doc() = "pybind11 wrapper of geometry_py";
|
||||
|
||||
pybind11::module m_gtsam = m_.def_submodule("gtsam", "gtsam submodule");
|
||||
|
||||
py::class_<gtsam::Point2, std::shared_ptr<gtsam::Point2>>(m_gtsam, "Point2")
|
||||
.def(py::init<>())
|
||||
.def(py::init<double, double>(), py::arg("x"), py::arg("y"))
|
||||
.def("x",[](gtsam::Point2* self){return self->x();})
|
||||
.def("y",[](gtsam::Point2* self){return self->y();})
|
||||
.def("dim",[](gtsam::Point2* self){return self->dim();})
|
||||
.def("returnChar",[](gtsam::Point2* self){return self->returnChar();})
|
||||
.def("argChar",[](gtsam::Point2* self, char a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, std::shared_ptr<char>& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, char& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, char* a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, const std::shared_ptr<char>& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, const char& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, const char* a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argUChar",[](gtsam::Point2* self, unsigned char a){ self->argUChar(a);}, py::arg("a"))
|
||||
.def("eigenArguments",[](gtsam::Point2* self, const gtsam::Vector& v, const gtsam::Matrix& m){ self->eigenArguments(v, m);}, py::arg("v"), py::arg("m"))
|
||||
.def("vectorConfusion",[](gtsam::Point2* self){return self->vectorConfusion();})
|
||||
.def("serialize", [](gtsam::Point2* self){ return gtsam::serialize(*self); })
|
||||
.def("deserialize", [](gtsam::Point2* self, string serialized){ gtsam::deserialize(serialized, *self); }, py::arg("serialized"))
|
||||
.def(py::pickle(
|
||||
[](const gtsam::Point2 &a){ /* __getstate__: Returns a string that encodes the state of the object */ return py::make_tuple(gtsam::serialize(a)); },
|
||||
[](py::tuple t){ /* __setstate__ */ gtsam::Point2 obj; gtsam::deserialize(t[0].cast<std::string>(), obj); return obj; }));
|
||||
|
||||
py::class_<gtsam::Point3, std::shared_ptr<gtsam::Point3>>(m_gtsam, "Point3")
|
||||
.def(py::init<double, double, double>(), py::arg("x"), py::arg("y"), py::arg("z"))
|
||||
.def("norm",[](gtsam::Point3* self){return self->norm();})
|
||||
.def("serialize", [](gtsam::Point3* self){ return gtsam::serialize(*self); })
|
||||
.def("deserialize", [](gtsam::Point3* self, string serialized){ gtsam::deserialize(serialized, *self); }, py::arg("serialized"))
|
||||
.def(py::pickle(
|
||||
[](const gtsam::Point3 &a){ /* __getstate__: Returns a string that encodes the state of the object */ return py::make_tuple(gtsam::serialize(a)); },
|
||||
[](py::tuple t){ /* __setstate__ */ gtsam::Point3 obj; gtsam::deserialize(t[0].cast<std::string>(), obj); return obj; }))
|
||||
.def_static("staticFunction",[](){return gtsam::Point3::staticFunction();})
|
||||
.def_static("StaticFunctionRet",[](double z){return gtsam::Point3::StaticFunctionRet(z);}, py::arg("z"));
|
||||
|
||||
py::class_<Test, std::shared_ptr<Test>>(m_, "Test")
|
||||
.def(py::init<>())
|
||||
.def(py::init<double, const gtsam::Matrix&>(), py::arg("a"), py::arg("b"))
|
||||
.def("return_pair",[](Test* self, const gtsam::Vector& v, const gtsam::Matrix& A){return self->return_pair(v, A);}, py::arg("v"), py::arg("A"))
|
||||
.def("return_pair",[](Test* self, const gtsam::Vector& v){return self->return_pair(v);}, py::arg("v"))
|
||||
.def("return_bool",[](Test* self, bool value){return self->return_bool(value);}, py::arg("value"))
|
||||
.def("return_size_t",[](Test* self, size_t value){return self->return_size_t(value);}, py::arg("value"))
|
||||
.def("return_int",[](Test* self, int value){return self->return_int(value);}, py::arg("value"))
|
||||
.def("return_double",[](Test* self, double value){return self->return_double(value);}, py::arg("value"))
|
||||
.def("return_string",[](Test* self, string value){return self->return_string(value);}, py::arg("value"))
|
||||
.def("return_vector1",[](Test* self, const gtsam::Vector& value){return self->return_vector1(value);}, py::arg("value"))
|
||||
.def("return_matrix1",[](Test* self, const gtsam::Matrix& value){return self->return_matrix1(value);}, py::arg("value"))
|
||||
.def("return_vector2",[](Test* self, const gtsam::Vector& value){return self->return_vector2(value);}, py::arg("value"))
|
||||
.def("return_matrix2",[](Test* self, const gtsam::Matrix& value){return self->return_matrix2(value);}, py::arg("value"))
|
||||
.def("arg_EigenConstRef",[](Test* self, const gtsam::Matrix& value){ self->arg_EigenConstRef(value);}, py::arg("value"))
|
||||
.def("return_field",[](Test* self, const Test& t){return self->return_field(t);}, py::arg("t"))
|
||||
.def("return_TestPtr",[](Test* self, const std::shared_ptr<Test>& value){return self->return_TestPtr(value);}, py::arg("value"))
|
||||
.def("return_Test",[](Test* self, std::shared_ptr<Test>& value){return self->return_Test(value);}, py::arg("value"))
|
||||
.def("return_Point2Ptr",[](Test* self, bool value){return self->return_Point2Ptr(value);}, py::arg("value"))
|
||||
.def("create_ptrs",[](Test* self){return self->create_ptrs();})
|
||||
.def("create_MixedPtrs",[](Test* self){return self->create_MixedPtrs();})
|
||||
.def("return_ptrs",[](Test* self, std::shared_ptr<Test>& p1, std::shared_ptr<Test>& p2){return self->return_ptrs(p1, p2);}, py::arg("p1"), py::arg("p2"))
|
||||
.def("print_",[](Test* self){ self->print();})
|
||||
.def("__repr__",
|
||||
[](const Test &a) {
|
||||
gtsam::RedirectCout redirect;
|
||||
a.print();
|
||||
return redirect.str();
|
||||
})
|
||||
.def_readwrite("model_ptr", &Test::model_ptr);
|
||||
|
||||
py::class_<MyBase, std::shared_ptr<MyBase>>(m_, "MyBase");
|
||||
|
||||
py::class_<MyTemplate<gtsam::Point2>, MyBase, std::shared_ptr<MyTemplate<gtsam::Point2>>>(m_, "MyTemplatePoint2")
|
||||
.def(py::init<>())
|
||||
.def("templatedMethodPoint2",[](MyTemplate<gtsam::Point2>* self, const gtsam::Point2& t){return self->templatedMethod<gtsam::Point2>(t);}, py::arg("t"))
|
||||
.def("templatedMethodPoint3",[](MyTemplate<gtsam::Point2>* self, const gtsam::Point3& t){return self->templatedMethod<gtsam::Point3>(t);}, py::arg("t"))
|
||||
.def("templatedMethodVector",[](MyTemplate<gtsam::Point2>* self, const gtsam::Vector& t){return self->templatedMethod<gtsam::Vector>(t);}, py::arg("t"))
|
||||
.def("templatedMethodMatrix",[](MyTemplate<gtsam::Point2>* self, const gtsam::Matrix& t){return self->templatedMethod<gtsam::Matrix>(t);}, py::arg("t"))
|
||||
.def("accept_T",[](MyTemplate<gtsam::Point2>* self, const gtsam::Point2& value){ self->accept_T(value);}, py::arg("value"))
|
||||
.def("accept_Tptr",[](MyTemplate<gtsam::Point2>* self, std::shared_ptr<gtsam::Point2>& value){ self->accept_Tptr(value);}, py::arg("value"))
|
||||
.def("return_Tptr",[](MyTemplate<gtsam::Point2>* self, std::shared_ptr<gtsam::Point2>& value){return self->return_Tptr(value);}, py::arg("value"))
|
||||
.def("return_T",[](MyTemplate<gtsam::Point2>* self, gtsam::Point2* value){return self->return_T(value);}, py::arg("value"))
|
||||
.def("create_ptrs",[](MyTemplate<gtsam::Point2>* self){return self->create_ptrs();})
|
||||
.def("create_MixedPtrs",[](MyTemplate<gtsam::Point2>* self){return self->create_MixedPtrs();})
|
||||
.def("return_ptrs",[](MyTemplate<gtsam::Point2>* self, std::shared_ptr<gtsam::Point2>& p1, std::shared_ptr<gtsam::Point2>& p2){return self->return_ptrs(p1, p2);}, py::arg("p1"), py::arg("p2"))
|
||||
.def_static("Level",[](const gtsam::Point2& K){return MyTemplate<gtsam::Point2>::Level(K);}, py::arg("K"));
|
||||
|
||||
py::class_<MyTemplate<gtsam::Matrix>, MyBase, std::shared_ptr<MyTemplate<gtsam::Matrix>>>(m_, "MyTemplateMatrix")
|
||||
.def(py::init<>())
|
||||
.def("templatedMethodPoint2",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Point2& t){return self->templatedMethod<gtsam::Point2>(t);}, py::arg("t"))
|
||||
.def("templatedMethodPoint3",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Point3& t){return self->templatedMethod<gtsam::Point3>(t);}, py::arg("t"))
|
||||
.def("templatedMethodVector",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Vector& t){return self->templatedMethod<gtsam::Vector>(t);}, py::arg("t"))
|
||||
.def("templatedMethodMatrix",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Matrix& t){return self->templatedMethod<gtsam::Matrix>(t);}, py::arg("t"))
|
||||
.def("accept_T",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Matrix& value){ self->accept_T(value);}, py::arg("value"))
|
||||
.def("accept_Tptr",[](MyTemplate<gtsam::Matrix>* self, const std::shared_ptr<gtsam::Matrix>& value){ self->accept_Tptr(value);}, py::arg("value"))
|
||||
.def("return_Tptr",[](MyTemplate<gtsam::Matrix>* self, const std::shared_ptr<gtsam::Matrix>& value){return self->return_Tptr(value);}, py::arg("value"))
|
||||
.def("return_T",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Matrix* value){return self->return_T(value);}, py::arg("value"))
|
||||
.def("create_ptrs",[](MyTemplate<gtsam::Matrix>* self){return self->create_ptrs();})
|
||||
.def("create_MixedPtrs",[](MyTemplate<gtsam::Matrix>* self){return self->create_MixedPtrs();})
|
||||
.def("return_ptrs",[](MyTemplate<gtsam::Matrix>* self, const std::shared_ptr<gtsam::Matrix>& p1, const std::shared_ptr<gtsam::Matrix>& p2){return self->return_ptrs(p1, p2);}, py::arg("p1"), py::arg("p2"))
|
||||
.def_static("Level",[](const gtsam::Matrix& K){return MyTemplate<gtsam::Matrix>::Level(K);}, py::arg("K"));
|
||||
|
||||
py::class_<PrimitiveRef<double>, std::shared_ptr<PrimitiveRef<double>>>(m_, "PrimitiveRefDouble")
|
||||
.def(py::init<>())
|
||||
.def_static("Brutal",[](const double& t){return PrimitiveRef<double>::Brutal(t);}, py::arg("t"));
|
||||
|
||||
py::class_<MyVector<3>, std::shared_ptr<MyVector<3>>>(m_, "MyVector3")
|
||||
.def(py::init<>());
|
||||
|
||||
py::class_<MyVector<12>, std::shared_ptr<MyVector<12>>>(m_, "MyVector12")
|
||||
.def(py::init<>());
|
||||
|
||||
py::class_<MultipleTemplates<int, double>, std::shared_ptr<MultipleTemplates<int, double>>>(m_, "MultipleTemplatesIntDouble");
|
||||
|
||||
py::class_<MultipleTemplates<int, float>, std::shared_ptr<MultipleTemplates<int, float>>>(m_, "MultipleTemplatesIntFloat");
|
||||
|
||||
py::class_<MyFactor<gtsam::Pose2, gtsam::Matrix>, std::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>>>(m_, "MyFactorPosePoint2")
|
||||
.def(py::init<size_t, size_t, double, const std::shared_ptr<gtsam::noiseModel::Base>&>(), py::arg("key1"), py::arg("key2"), py::arg("measured"), py::arg("noiseModel"));
|
||||
|
||||
m_.def("load2D",[](string filename, std::shared_ptr<Test>& model, int maxID, bool addNoise, bool smart){return ::load2D(filename, model, maxID, addNoise, smart);}, py::arg("filename"), py::arg("model"), py::arg("maxID"), py::arg("addNoise"), py::arg("smart"));
|
||||
m_.def("load2D",[](string filename, const std::shared_ptr<gtsam::noiseModel::Diagonal>& model, int maxID, bool addNoise, bool smart){return ::load2D(filename, model, maxID, addNoise, smart);}, py::arg("filename"), py::arg("model"), py::arg("maxID"), py::arg("addNoise"), py::arg("smart"));
|
||||
m_.def("load2D",[](string filename, gtsam::noiseModel::Diagonal* model){return ::load2D(filename, model);}, py::arg("filename"), py::arg("model"));
|
||||
m_.def("aGlobalFunction",[](){return ::aGlobalFunction();});
|
||||
m_.def("overloadedGlobalFunction",[](int a){return ::overloadedGlobalFunction(a);}, py::arg("a"));
|
||||
m_.def("overloadedGlobalFunction",[](int a, double b){return ::overloadedGlobalFunction(a, b);}, py::arg("a"), py::arg("b"));
|
||||
m_.def("MultiTemplatedFunctionStringSize_tDouble",[](const T& x, size_t y){return ::MultiTemplatedFunction<string,size_t,double>(x, y);}, py::arg("x"), py::arg("y"));
|
||||
m_.def("MultiTemplatedFunctionDoubleSize_tDouble",[](const T& x, size_t y){return ::MultiTemplatedFunction<double,size_t,double>(x, y);}, py::arg("x"), py::arg("y"));
|
||||
m_.def("TemplatedFunctionRot3",[](const gtsam::Rot3& t){ ::TemplatedFunction<Rot3>(t);}, py::arg("t"));
|
||||
|
||||
#include "python/specializations.h"
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
%class ClassA, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%ClassA()
|
||||
%
|
||||
classdef ClassA < handle
|
||||
properties
|
||||
ptr_ns1ClassA = 0
|
||||
end
|
||||
methods
|
||||
function obj = ClassA(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
namespaces_wrapper(0, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = namespaces_wrapper(1);
|
||||
else
|
||||
error('Arguments do not match any overload of ns1.ClassA constructor');
|
||||
end
|
||||
obj.ptr_ns1ClassA = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
namespaces_wrapper(2, obj.ptr_ns1ClassA);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
%class ClassB, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%ClassB()
|
||||
%
|
||||
classdef ClassB < handle
|
||||
properties
|
||||
ptr_ns1ClassB = 0
|
||||
end
|
||||
methods
|
||||
function obj = ClassB(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
namespaces_wrapper(3, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = namespaces_wrapper(4);
|
||||
else
|
||||
error('Arguments do not match any overload of ns1.ClassB constructor');
|
||||
end
|
||||
obj.ptr_ns1ClassB = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
namespaces_wrapper(5, obj.ptr_ns1ClassB);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
function varargout = aGlobalFunction(varargin)
|
||||
if length(varargin) == 0
|
||||
varargout{1} = geometry_wrapper(105, varargin{:});
|
||||
varargout{1} = namespaces_wrapper(6, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function aGlobalFunction');
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
%class ClassB, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%ClassB()
|
||||
%
|
||||
classdef ClassB < handle
|
||||
properties
|
||||
ptr_ns2ns3ClassB = 0
|
||||
end
|
||||
methods
|
||||
function obj = ClassB(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
namespaces_wrapper(14, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = namespaces_wrapper(15);
|
||||
else
|
||||
error('Arguments do not match any overload of ns2.ns3.ClassB constructor');
|
||||
end
|
||||
obj.ptr_ns2ns3ClassB = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
namespaces_wrapper(16, obj.ptr_ns2ns3ClassB);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,89 @@
|
|||
%class ClassA, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%ClassA()
|
||||
%
|
||||
%-------Methods-------
|
||||
%memberFunction() : returns double
|
||||
%nsArg(ClassB arg) : returns int
|
||||
%nsReturn(double q) : returns ns2::ns3::ClassB
|
||||
%
|
||||
%-------Static Methods-------
|
||||
%afunction() : returns double
|
||||
%
|
||||
%-------Serialization Interface-------
|
||||
%string_serialize() : returns string
|
||||
%string_deserialize(string serialized) : returns ClassA
|
||||
%
|
||||
classdef ClassA < handle
|
||||
properties
|
||||
ptr_ns2ClassA = 0
|
||||
end
|
||||
methods
|
||||
function obj = ClassA(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
namespaces_wrapper(7, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = namespaces_wrapper(8);
|
||||
else
|
||||
error('Arguments do not match any overload of ns2.ClassA constructor');
|
||||
end
|
||||
obj.ptr_ns2ClassA = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
namespaces_wrapper(9, obj.ptr_ns2ClassA);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
function varargout = memberFunction(this, varargin)
|
||||
% MEMBERFUNCTION usage: memberFunction() : returns double
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
varargout{1} = namespaces_wrapper(10, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function ns2.ClassA.memberFunction');
|
||||
end
|
||||
|
||||
function varargout = nsArg(this, varargin)
|
||||
% NSARG usage: nsArg(ClassB arg) : returns int
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'ns1.ClassB')
|
||||
varargout{1} = namespaces_wrapper(11, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function ns2.ClassA.nsArg');
|
||||
end
|
||||
|
||||
function varargout = nsReturn(this, varargin)
|
||||
% NSRETURN usage: nsReturn(double q) : returns ns2.ns3.ClassB
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = namespaces_wrapper(12, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function ns2.ClassA.nsReturn');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
function varargout = Afunction(varargin)
|
||||
% AFUNCTION usage: afunction() : returns double
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
varargout{1} = namespaces_wrapper(13, varargin{:});
|
||||
return
|
||||
end
|
||||
|
||||
error('Arguments do not match any overload of function ClassA.afunction');
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
%class ClassC, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%ClassC()
|
||||
%
|
||||
classdef ClassC < handle
|
||||
properties
|
||||
ptr_ns2ClassC = 0
|
||||
end
|
||||
methods
|
||||
function obj = ClassC(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
namespaces_wrapper(17, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = namespaces_wrapper(18);
|
||||
else
|
||||
error('Arguments do not match any overload of ns2.ClassC constructor');
|
||||
end
|
||||
obj.ptr_ns2ClassC = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
namespaces_wrapper(19, obj.ptr_ns2ClassC);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
function varargout = aGlobalFunction(varargin)
|
||||
if length(varargin) == 0
|
||||
varargout{1} = namespaces_wrapper(20, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function aGlobalFunction');
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
function varargout = overloadedGlobalFunction(varargin)
|
||||
if length(varargin) == 1 && isa(varargin{1},'ns1.ClassA')
|
||||
varargout{1} = namespaces_wrapper(21, varargin{:});
|
||||
elseif length(varargin) == 2 && isa(varargin{1},'ns1.ClassA') && isa(varargin{2},'double')
|
||||
varargout{1} = namespaces_wrapper(22, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function overloadedGlobalFunction');
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
%class ClassD, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%ClassD()
|
||||
%
|
||||
classdef ClassD < handle
|
||||
properties
|
||||
ptr_ClassD = 0
|
||||
end
|
||||
methods
|
||||
function obj = ClassD(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
namespaces_wrapper(23, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = namespaces_wrapper(24);
|
||||
else
|
||||
error('Arguments do not match any overload of ClassD constructor');
|
||||
end
|
||||
obj.ptr_ClassD = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
namespaces_wrapper(25, obj.ptr_ClassD);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,62 @@
|
|||
%class FunDouble, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Methods-------
|
||||
%dhamaalString(double d, string t) : returns Fun<double>
|
||||
%
|
||||
%-------Static Methods-------
|
||||
%divertido() : returns Fun<double>
|
||||
%
|
||||
%-------Serialization Interface-------
|
||||
%string_serialize() : returns string
|
||||
%string_deserialize(string serialized) : returns FunDouble
|
||||
%
|
||||
classdef FunDouble < handle
|
||||
properties
|
||||
ptr_FunDouble = 0
|
||||
end
|
||||
methods
|
||||
function obj = FunDouble(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
class_wrapper(5, my_ptr);
|
||||
else
|
||||
error('Arguments do not match any overload of FunDouble constructor');
|
||||
end
|
||||
obj.ptr_FunDouble = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
class_wrapper(6, obj.ptr_FunDouble);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
function varargout = dhamaalString(this, varargin)
|
||||
% DHAMAALSTRING usage: dhamaalString(double d, string t) : returns Fun<double>
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 2 && isa(varargin{1},'double') && isa(varargin{2},'char')
|
||||
varargout{1} = class_wrapper(7, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function FunDouble.dhamaalString');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
function varargout = Divertido(varargin)
|
||||
% DIVERTIDO usage: divertido() : returns Fundouble
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
varargout{1} = class_wrapper(8, varargin{:});
|
||||
return
|
||||
end
|
||||
|
||||
error('Arguments do not match any overload of function FunDouble.divertido');
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,67 @@
|
|||
%class FunRange, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%FunRange()
|
||||
%
|
||||
%-------Methods-------
|
||||
%range(double d) : returns FunRange
|
||||
%
|
||||
%-------Static Methods-------
|
||||
%create() : returns FunRange
|
||||
%
|
||||
%-------Serialization Interface-------
|
||||
%string_serialize() : returns string
|
||||
%string_deserialize(string serialized) : returns FunRange
|
||||
%
|
||||
classdef FunRange < handle
|
||||
properties
|
||||
ptr_FunRange = 0
|
||||
end
|
||||
methods
|
||||
function obj = FunRange(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
class_wrapper(0, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = class_wrapper(1);
|
||||
else
|
||||
error('Arguments do not match any overload of FunRange constructor');
|
||||
end
|
||||
obj.ptr_FunRange = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
class_wrapper(2, obj.ptr_FunRange);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
%DISPLAY Calls print on the object
|
||||
function disp(obj), obj.display; end
|
||||
%DISP Calls print on the object
|
||||
function varargout = range(this, varargin)
|
||||
% RANGE usage: range(double d) : returns FunRange
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = class_wrapper(3, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function FunRange.range');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods(Static = true)
|
||||
function varargout = Create(varargin)
|
||||
% CREATE usage: create() : returns FunRange
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
varargout{1} = class_wrapper(4, varargin{:});
|
||||
return
|
||||
end
|
||||
|
||||
error('Arguments do not match any overload of function FunRange.create');
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
function varargout = MultiTemplatedFunctionDoubleSize_tDouble(varargin)
|
||||
if length(varargin) == 2 && isa(varargin{1},'T') && isa(varargin{2},'numeric')
|
||||
varargout{1} = functions_wrapper(7, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function MultiTemplatedFunctionDoubleSize_tDouble');
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
function varargout = MultiTemplatedFunctionStringSize_tDouble(varargin)
|
||||
if length(varargin) == 2 && isa(varargin{1},'T') && isa(varargin{2},'numeric')
|
||||
varargout{1} = functions_wrapper(6, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function MultiTemplatedFunctionStringSize_tDouble');
|
||||
end
|
|
@ -9,7 +9,7 @@ classdef MultipleTemplatesIntDouble < handle
|
|||
function obj = MultipleTemplatesIntDouble(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(89, my_ptr);
|
||||
class_wrapper(43, my_ptr);
|
||||
else
|
||||
error('Arguments do not match any overload of MultipleTemplatesIntDouble constructor');
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ classdef MultipleTemplatesIntDouble < handle
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(90, obj.ptr_MultipleTemplatesIntDouble);
|
||||
class_wrapper(44, obj.ptr_MultipleTemplatesIntDouble);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
|
@ -9,7 +9,7 @@ classdef MultipleTemplatesIntFloat < handle
|
|||
function obj = MultipleTemplatesIntFloat(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(91, my_ptr);
|
||||
class_wrapper(45, my_ptr);
|
||||
else
|
||||
error('Arguments do not match any overload of MultipleTemplatesIntFloat constructor');
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ classdef MultipleTemplatesIntFloat < handle
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(92, obj.ptr_MultipleTemplatesIntFloat);
|
||||
class_wrapper(46, obj.ptr_MultipleTemplatesIntFloat);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
|
@ -11,9 +11,9 @@ classdef MyBase < handle
|
|||
if nargin == 2
|
||||
my_ptr = varargin{2};
|
||||
else
|
||||
my_ptr = geometry_wrapper(51, varargin{2});
|
||||
my_ptr = inheritance_wrapper(1, varargin{2});
|
||||
end
|
||||
geometry_wrapper(50, my_ptr);
|
||||
inheritance_wrapper(0, my_ptr);
|
||||
else
|
||||
error('Arguments do not match any overload of MyBase constructor');
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ classdef MyBase < handle
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(52, obj.ptr_MyBase);
|
||||
inheritance_wrapper(2, obj.ptr_MyBase);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
|
@ -12,9 +12,9 @@ classdef MyFactorPosePoint2 < handle
|
|||
function obj = MyFactorPosePoint2(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(99, my_ptr);
|
||||
class_wrapper(47, my_ptr);
|
||||
elseif nargin == 4 && isa(varargin{1},'numeric') && isa(varargin{2},'numeric') && isa(varargin{3},'double') && isa(varargin{4},'gtsam.noiseModel.Base')
|
||||
my_ptr = geometry_wrapper(100, varargin{1}, varargin{2}, varargin{3}, varargin{4});
|
||||
my_ptr = class_wrapper(48, varargin{1}, varargin{2}, varargin{3}, varargin{4});
|
||||
else
|
||||
error('Arguments do not match any overload of MyFactorPosePoint2 constructor');
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ classdef MyFactorPosePoint2 < handle
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(101, obj.ptr_MyFactorPosePoint2);
|
||||
class_wrapper(49, obj.ptr_MyFactorPosePoint2);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
|
@ -34,11 +34,11 @@ classdef MyTemplateMatrix < MyBase
|
|||
if nargin == 2
|
||||
my_ptr = varargin{2};
|
||||
else
|
||||
my_ptr = geometry_wrapper(70, varargin{2});
|
||||
my_ptr = inheritance_wrapper(20, varargin{2});
|
||||
end
|
||||
base_ptr = geometry_wrapper(69, my_ptr);
|
||||
base_ptr = inheritance_wrapper(19, my_ptr);
|
||||
elseif nargin == 0
|
||||
[ my_ptr, base_ptr ] = geometry_wrapper(71);
|
||||
[ my_ptr, base_ptr ] = inheritance_wrapper(21);
|
||||
else
|
||||
error('Arguments do not match any overload of MyTemplateMatrix constructor');
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(72, obj.ptr_MyTemplateMatrix);
|
||||
inheritance_wrapper(22, obj.ptr_MyTemplateMatrix);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
|
@ -58,7 +58,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% ACCEPT_T usage: accept_T(Matrix value) : returns void
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
geometry_wrapper(73, this, varargin{:});
|
||||
inheritance_wrapper(23, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.accept_T');
|
||||
|
@ -68,7 +68,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% ACCEPT_TPTR usage: accept_Tptr(Matrix value) : returns void
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
geometry_wrapper(74, this, varargin{:});
|
||||
inheritance_wrapper(24, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.accept_Tptr');
|
||||
|
@ -78,7 +78,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% CREATE_MIXEDPTRS usage: create_MixedPtrs() : returns pair< Matrix, Matrix >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(75, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = inheritance_wrapper(25, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.create_MixedPtrs');
|
||||
|
@ -88,7 +88,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% CREATE_PTRS usage: create_ptrs() : returns pair< Matrix, Matrix >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(76, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = inheritance_wrapper(26, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.create_ptrs');
|
||||
|
@ -98,7 +98,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% RETURN_T usage: return_T(Matrix value) : returns Matrix
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(77, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(27, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.return_T');
|
||||
|
@ -108,7 +108,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% RETURN_TPTR usage: return_Tptr(Matrix value) : returns Matrix
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(78, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(28, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.return_Tptr');
|
||||
|
@ -118,7 +118,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% RETURN_PTRS usage: return_ptrs(Matrix p1, Matrix p2) : returns pair< Matrix, Matrix >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 2 && isa(varargin{1},'double') && isa(varargin{2},'double')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(79, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = inheritance_wrapper(29, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.return_ptrs');
|
||||
|
@ -128,7 +128,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% TEMPLATEDMETHODMATRIX usage: templatedMethodMatrix(Matrix t) : returns Matrix
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(80, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(30, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.templatedMethodMatrix');
|
||||
|
@ -138,7 +138,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% TEMPLATEDMETHODPOINT2 usage: templatedMethodPoint2(Point2 t) : returns Point2
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(81, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(31, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.templatedMethodPoint2');
|
||||
|
@ -148,7 +148,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% TEMPLATEDMETHODPOINT3 usage: templatedMethodPoint3(Point3 t) : returns Point3
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==3 && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(82, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(32, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.templatedMethodPoint3');
|
||||
|
@ -158,7 +158,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% TEMPLATEDMETHODVECTOR usage: templatedMethodVector(Vector t) : returns Vector
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(83, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(33, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplateMatrix.templatedMethodVector');
|
||||
|
@ -171,7 +171,7 @@ classdef MyTemplateMatrix < MyBase
|
|||
% LEVEL usage: Level(Matrix K) : returns MyTemplateMatrix
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(84, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(34, varargin{:});
|
||||
return
|
||||
end
|
||||
|
|
@ -34,11 +34,11 @@ classdef MyTemplatePoint2 < MyBase
|
|||
if nargin == 2
|
||||
my_ptr = varargin{2};
|
||||
else
|
||||
my_ptr = geometry_wrapper(54, varargin{2});
|
||||
my_ptr = inheritance_wrapper(4, varargin{2});
|
||||
end
|
||||
base_ptr = geometry_wrapper(53, my_ptr);
|
||||
base_ptr = inheritance_wrapper(3, my_ptr);
|
||||
elseif nargin == 0
|
||||
[ my_ptr, base_ptr ] = geometry_wrapper(55);
|
||||
[ my_ptr, base_ptr ] = inheritance_wrapper(5);
|
||||
else
|
||||
error('Arguments do not match any overload of MyTemplatePoint2 constructor');
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(56, obj.ptr_MyTemplatePoint2);
|
||||
inheritance_wrapper(6, obj.ptr_MyTemplatePoint2);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
|
@ -58,7 +58,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% ACCEPT_T usage: accept_T(Point2 value) : returns void
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1
|
||||
geometry_wrapper(57, this, varargin{:});
|
||||
inheritance_wrapper(7, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.accept_T');
|
||||
|
@ -68,7 +68,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% ACCEPT_TPTR usage: accept_Tptr(Point2 value) : returns void
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1
|
||||
geometry_wrapper(58, this, varargin{:});
|
||||
inheritance_wrapper(8, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.accept_Tptr');
|
||||
|
@ -78,7 +78,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% CREATE_MIXEDPTRS usage: create_MixedPtrs() : returns pair< Point2, Point2 >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(59, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = inheritance_wrapper(9, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.create_MixedPtrs');
|
||||
|
@ -88,7 +88,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% CREATE_PTRS usage: create_ptrs() : returns pair< Point2, Point2 >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(60, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = inheritance_wrapper(10, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.create_ptrs');
|
||||
|
@ -98,7 +98,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% RETURN_T usage: return_T(Point2 value) : returns Point2
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(61, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(11, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.return_T');
|
||||
|
@ -108,7 +108,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% RETURN_TPTR usage: return_Tptr(Point2 value) : returns Point2
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(62, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(12, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.return_Tptr');
|
||||
|
@ -118,7 +118,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% RETURN_PTRS usage: return_ptrs(Point2 p1, Point2 p2) : returns pair< Point2, Point2 >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 2 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1 && isa(varargin{2},'double') && size(varargin{2},1)==2 && size(varargin{2},2)==1
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(63, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = inheritance_wrapper(13, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.return_ptrs');
|
||||
|
@ -128,7 +128,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% TEMPLATEDMETHODMATRIX usage: templatedMethodMatrix(Matrix t) : returns Matrix
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(64, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(14, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.templatedMethodMatrix');
|
||||
|
@ -138,7 +138,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% TEMPLATEDMETHODPOINT2 usage: templatedMethodPoint2(Point2 t) : returns Point2
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(65, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(15, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.templatedMethodPoint2');
|
||||
|
@ -148,7 +148,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% TEMPLATEDMETHODPOINT3 usage: templatedMethodPoint3(Point3 t) : returns Point3
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==3 && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(66, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(16, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.templatedMethodPoint3');
|
||||
|
@ -158,7 +158,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% TEMPLATEDMETHODVECTOR usage: templatedMethodVector(Vector t) : returns Vector
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(67, this, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(17, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function MyTemplatePoint2.templatedMethodVector');
|
||||
|
@ -171,7 +171,7 @@ classdef MyTemplatePoint2 < MyBase
|
|||
% LEVEL usage: Level(Point2 K) : returns MyTemplatePoint2
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},1)==2 && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(68, varargin{:});
|
||||
varargout{1} = inheritance_wrapper(18, varargin{:});
|
||||
return
|
||||
end
|
||||
|
|
@ -12,9 +12,9 @@ classdef MyVector12 < handle
|
|||
function obj = MyVector12(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(92, my_ptr);
|
||||
class_wrapper(40, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = geometry_wrapper(93);
|
||||
my_ptr = class_wrapper(41);
|
||||
else
|
||||
error('Arguments do not match any overload of MyVector12 constructor');
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ classdef MyVector12 < handle
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(94, obj.ptr_MyVector12);
|
||||
class_wrapper(42, obj.ptr_MyVector12);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
|
@ -12,9 +12,9 @@ classdef MyVector3 < handle
|
|||
function obj = MyVector3(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(89, my_ptr);
|
||||
class_wrapper(37, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = geometry_wrapper(90);
|
||||
my_ptr = class_wrapper(38);
|
||||
else
|
||||
error('Arguments do not match any overload of MyVector3 constructor');
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ classdef MyVector3 < handle
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(91, obj.ptr_MyVector3);
|
||||
class_wrapper(39, obj.ptr_MyVector3);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
|
@ -1,35 +1,35 @@
|
|||
%class PrimitiveRefdouble, see Doxygen page for details
|
||||
%class PrimitiveRefDouble, see Doxygen page for details
|
||||
%at https://gtsam.org/doxygen/
|
||||
%
|
||||
%-------Constructors-------
|
||||
%PrimitiveRefdouble()
|
||||
%PrimitiveRefDouble()
|
||||
%
|
||||
%-------Static Methods-------
|
||||
%Brutal(double t) : returns PrimitiveRef<double>
|
||||
%
|
||||
%-------Serialization Interface-------
|
||||
%string_serialize() : returns string
|
||||
%string_deserialize(string serialized) : returns PrimitiveRefdouble
|
||||
%string_deserialize(string serialized) : returns PrimitiveRefDouble
|
||||
%
|
||||
classdef PrimitiveRefdouble < handle
|
||||
classdef PrimitiveRefDouble < handle
|
||||
properties
|
||||
ptr_PrimitiveRefdouble = 0
|
||||
ptr_PrimitiveRefDouble = 0
|
||||
end
|
||||
methods
|
||||
function obj = PrimitiveRefdouble(varargin)
|
||||
function obj = PrimitiveRefDouble(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(79, my_ptr);
|
||||
class_wrapper(33, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = geometry_wrapper(80);
|
||||
my_ptr = class_wrapper(34);
|
||||
else
|
||||
error('Arguments do not match any overload of PrimitiveRefdouble constructor');
|
||||
error('Arguments do not match any overload of PrimitiveRefDouble constructor');
|
||||
end
|
||||
obj.ptr_PrimitiveRefdouble = my_ptr;
|
||||
obj.ptr_PrimitiveRefDouble = my_ptr;
|
||||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(81, obj.ptr_PrimitiveRefdouble);
|
||||
class_wrapper(35, obj.ptr_PrimitiveRefDouble);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
|
@ -43,11 +43,11 @@ classdef PrimitiveRefdouble < handle
|
|||
% BRUTAL usage: Brutal(double t) : returns PrimitiveRefdouble
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(82, varargin{:});
|
||||
varargout{1} = class_wrapper(36, varargin{:});
|
||||
return
|
||||
end
|
||||
|
||||
error('Arguments do not match any overload of function PrimitiveRefdouble.Brutal');
|
||||
error('Arguments do not match any overload of function PrimitiveRefDouble.Brutal');
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
function varargout = TemplatedFunctionRot3(varargin)
|
||||
if length(varargin) == 1 && isa(varargin{1},'gtsam.Rot3')
|
||||
functions_wrapper(8, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function TemplatedFunctionRot3');
|
||||
end
|
|
@ -35,11 +35,11 @@ classdef Test < handle
|
|||
function obj = Test(varargin)
|
||||
if nargin == 2 && isa(varargin{1}, 'uint64') && varargin{1} == uint64(5139824614673773682)
|
||||
my_ptr = varargin{2};
|
||||
geometry_wrapper(26, my_ptr);
|
||||
class_wrapper(9, my_ptr);
|
||||
elseif nargin == 0
|
||||
my_ptr = geometry_wrapper(27);
|
||||
my_ptr = class_wrapper(10);
|
||||
elseif nargin == 2 && isa(varargin{1},'double') && isa(varargin{2},'double')
|
||||
my_ptr = geometry_wrapper(28, varargin{1}, varargin{2});
|
||||
my_ptr = class_wrapper(11, varargin{1}, varargin{2});
|
||||
else
|
||||
error('Arguments do not match any overload of Test constructor');
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ classdef Test < handle
|
|||
end
|
||||
|
||||
function delete(obj)
|
||||
geometry_wrapper(29, obj.ptr_Test);
|
||||
class_wrapper(12, obj.ptr_Test);
|
||||
end
|
||||
|
||||
function display(obj), obj.print(''); end
|
||||
|
@ -58,7 +58,7 @@ classdef Test < handle
|
|||
% ARG_EIGENCONSTREF usage: arg_EigenConstRef(Matrix value) : returns void
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
geometry_wrapper(30, this, varargin{:});
|
||||
class_wrapper(13, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.arg_EigenConstRef');
|
||||
|
@ -68,7 +68,7 @@ classdef Test < handle
|
|||
% CREATE_MIXEDPTRS usage: create_MixedPtrs() : returns pair< Test, Test >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(31, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = class_wrapper(14, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.create_MixedPtrs');
|
||||
|
@ -78,7 +78,7 @@ classdef Test < handle
|
|||
% CREATE_PTRS usage: create_ptrs() : returns pair< Test, Test >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(32, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = class_wrapper(15, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.create_ptrs');
|
||||
|
@ -88,7 +88,7 @@ classdef Test < handle
|
|||
% PRINT usage: print() : returns void
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 0
|
||||
geometry_wrapper(33, this, varargin{:});
|
||||
class_wrapper(16, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.print');
|
||||
|
@ -98,7 +98,7 @@ classdef Test < handle
|
|||
% RETURN_POINT2PTR usage: return_Point2Ptr(bool value) : returns Point2
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'logical')
|
||||
varargout{1} = geometry_wrapper(34, this, varargin{:});
|
||||
varargout{1} = class_wrapper(17, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_Point2Ptr');
|
||||
|
@ -108,7 +108,7 @@ classdef Test < handle
|
|||
% RETURN_TEST usage: return_Test(Test value) : returns Test
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'Test')
|
||||
varargout{1} = geometry_wrapper(35, this, varargin{:});
|
||||
varargout{1} = class_wrapper(18, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_Test');
|
||||
|
@ -118,7 +118,7 @@ classdef Test < handle
|
|||
% RETURN_TESTPTR usage: return_TestPtr(Test value) : returns Test
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'Test')
|
||||
varargout{1} = geometry_wrapper(36, this, varargin{:});
|
||||
varargout{1} = class_wrapper(19, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_TestPtr');
|
||||
|
@ -128,7 +128,7 @@ classdef Test < handle
|
|||
% RETURN_BOOL usage: return_bool(bool value) : returns bool
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'logical')
|
||||
varargout{1} = geometry_wrapper(37, this, varargin{:});
|
||||
varargout{1} = class_wrapper(20, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_bool');
|
||||
|
@ -138,7 +138,7 @@ classdef Test < handle
|
|||
% RETURN_DOUBLE usage: return_double(double value) : returns double
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(38, this, varargin{:});
|
||||
varargout{1} = class_wrapper(21, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_double');
|
||||
|
@ -148,7 +148,7 @@ classdef Test < handle
|
|||
% RETURN_FIELD usage: return_field(Test t) : returns bool
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'Test')
|
||||
varargout{1} = geometry_wrapper(39, this, varargin{:});
|
||||
varargout{1} = class_wrapper(22, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_field');
|
||||
|
@ -158,7 +158,7 @@ classdef Test < handle
|
|||
% RETURN_INT usage: return_int(int value) : returns int
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'numeric')
|
||||
varargout{1} = geometry_wrapper(40, this, varargin{:});
|
||||
varargout{1} = class_wrapper(23, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_int');
|
||||
|
@ -168,7 +168,7 @@ classdef Test < handle
|
|||
% RETURN_MATRIX1 usage: return_matrix1(Matrix value) : returns Matrix
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(41, this, varargin{:});
|
||||
varargout{1} = class_wrapper(24, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_matrix1');
|
||||
|
@ -178,7 +178,7 @@ classdef Test < handle
|
|||
% RETURN_MATRIX2 usage: return_matrix2(Matrix value) : returns Matrix
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double')
|
||||
varargout{1} = geometry_wrapper(42, this, varargin{:});
|
||||
varargout{1} = class_wrapper(25, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_matrix2');
|
||||
|
@ -188,13 +188,13 @@ classdef Test < handle
|
|||
% RETURN_PAIR usage: return_pair(Vector v, Matrix A) : returns pair< Vector, Matrix >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 2 && isa(varargin{1},'double') && size(varargin{1},2)==1 && isa(varargin{2},'double')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(43, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = class_wrapper(26, this, varargin{:});
|
||||
return
|
||||
end
|
||||
% RETURN_PAIR usage: return_pair(Vector v) : returns pair< Vector, Matrix >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(44, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = class_wrapper(27, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_pair');
|
||||
|
@ -204,7 +204,7 @@ classdef Test < handle
|
|||
% RETURN_PTRS usage: return_ptrs(Test p1, Test p2) : returns pair< Test, Test >
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 2 && isa(varargin{1},'Test') && isa(varargin{2},'Test')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(45, this, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = class_wrapper(28, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_ptrs');
|
||||
|
@ -214,7 +214,7 @@ classdef Test < handle
|
|||
% RETURN_SIZE_T usage: return_size_t(size_t value) : returns size_t
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'numeric')
|
||||
varargout{1} = geometry_wrapper(46, this, varargin{:});
|
||||
varargout{1} = class_wrapper(29, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_size_t');
|
||||
|
@ -224,7 +224,7 @@ classdef Test < handle
|
|||
% RETURN_STRING usage: return_string(string value) : returns string
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'char')
|
||||
varargout{1} = geometry_wrapper(47, this, varargin{:});
|
||||
varargout{1} = class_wrapper(30, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_string');
|
||||
|
@ -234,7 +234,7 @@ classdef Test < handle
|
|||
% RETURN_VECTOR1 usage: return_vector1(Vector value) : returns Vector
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(48, this, varargin{:});
|
||||
varargout{1} = class_wrapper(31, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_vector1');
|
||||
|
@ -244,7 +244,7 @@ classdef Test < handle
|
|||
% RETURN_VECTOR2 usage: return_vector2(Vector value) : returns Vector
|
||||
% Doxygen can be found at https://gtsam.org/doxygen/
|
||||
if length(varargin) == 1 && isa(varargin{1},'double') && size(varargin{1},2)==1
|
||||
varargout{1} = geometry_wrapper(49, this, varargin{:});
|
||||
varargout{1} = class_wrapper(32, this, varargin{:});
|
||||
return
|
||||
end
|
||||
error('Arguments do not match any overload of function Test.return_vector2');
|
|
@ -0,0 +1,6 @@
|
|||
function varargout = aGlobalFunction(varargin)
|
||||
if length(varargin) == 0
|
||||
varargout{1} = functions_wrapper(3, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function aGlobalFunction');
|
||||
end
|
|
@ -0,0 +1,791 @@
|
|||
#include <gtwrap/matlab.h>
|
||||
#include <map>
|
||||
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
#include <folder/path/to/Test.h>
|
||||
|
||||
|
||||
typedef Fun<double> FunDouble;
|
||||
typedef PrimitiveRef<double> PrimitiveRefDouble;
|
||||
typedef MyVector<3> MyVector3;
|
||||
typedef MyVector<12> MyVector12;
|
||||
typedef MultipleTemplates<int, double> MultipleTemplatesIntDouble;
|
||||
typedef MultipleTemplates<int, float> MultipleTemplatesIntFloat;
|
||||
typedef MyFactor<gtsam::Pose2, gtsam::Matrix> MyFactorPosePoint2;
|
||||
|
||||
|
||||
typedef std::set<boost::shared_ptr<FunRange>*> Collector_FunRange;
|
||||
static Collector_FunRange collector_FunRange;
|
||||
typedef std::set<boost::shared_ptr<FunDouble>*> Collector_FunDouble;
|
||||
static Collector_FunDouble collector_FunDouble;
|
||||
typedef std::set<boost::shared_ptr<Test>*> Collector_Test;
|
||||
static Collector_Test collector_Test;
|
||||
typedef std::set<boost::shared_ptr<PrimitiveRefDouble>*> Collector_PrimitiveRefDouble;
|
||||
static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble;
|
||||
typedef std::set<boost::shared_ptr<MyVector3>*> Collector_MyVector3;
|
||||
static Collector_MyVector3 collector_MyVector3;
|
||||
typedef std::set<boost::shared_ptr<MyVector12>*> Collector_MyVector12;
|
||||
static Collector_MyVector12 collector_MyVector12;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntDouble>*> Collector_MultipleTemplatesIntDouble;
|
||||
static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntFloat>*> Collector_MultipleTemplatesIntFloat;
|
||||
static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat;
|
||||
typedef std::set<boost::shared_ptr<MyFactorPosePoint2>*> Collector_MyFactorPosePoint2;
|
||||
static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2;
|
||||
|
||||
void _deleteAllObjects()
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
bool anyDeleted = false;
|
||||
{ for(Collector_FunRange::iterator iter = collector_FunRange.begin();
|
||||
iter != collector_FunRange.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunRange.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_FunDouble::iterator iter = collector_FunDouble.begin();
|
||||
iter != collector_FunDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_Test::iterator iter = collector_Test.begin();
|
||||
iter != collector_Test.end(); ) {
|
||||
delete *iter;
|
||||
collector_Test.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_PrimitiveRefDouble::iterator iter = collector_PrimitiveRefDouble.begin();
|
||||
iter != collector_PrimitiveRefDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_PrimitiveRefDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector3::iterator iter = collector_MyVector3.begin();
|
||||
iter != collector_MyVector3.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector12::iterator iter = collector_MyVector12.begin();
|
||||
iter != collector_MyVector12.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector12.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntDouble::iterator iter = collector_MultipleTemplatesIntDouble.begin();
|
||||
iter != collector_MultipleTemplatesIntDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntFloat::iterator iter = collector_MultipleTemplatesIntFloat.begin();
|
||||
iter != collector_MultipleTemplatesIntFloat.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntFloat.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyFactorPosePoint2::iterator iter = collector_MyFactorPosePoint2.begin();
|
||||
iter != collector_MyFactorPosePoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyFactorPosePoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
if(anyDeleted)
|
||||
cout <<
|
||||
"WARNING: Wrap modules with variables in the workspace have been reloaded due to\n"
|
||||
"calling destructors, call 'clear all' again if you plan to now recompile a wrap\n"
|
||||
"module, so that your recompiled module is used instead of the old one." << endl;
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
||||
|
||||
void _class_RTTIRegister() {
|
||||
const mxArray *alreadyCreated = mexGetVariablePtr("global", "gtsam_class_rttiRegistry_created");
|
||||
if(!alreadyCreated) {
|
||||
std::map<std::string, std::string> types;
|
||||
|
||||
mxArray *registry = mexGetVariable("global", "gtsamwrap_rttiRegistry");
|
||||
if(!registry)
|
||||
registry = mxCreateStructMatrix(1, 1, 0, NULL);
|
||||
typedef std::pair<std::string, std::string> StringPair;
|
||||
for(const StringPair& rtti_matlab: types) {
|
||||
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
|
||||
if(fieldId < 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
|
||||
mxSetFieldByNumber(registry, 0, fieldId, matlabName);
|
||||
}
|
||||
if(mexPutVariable("global", "gtsamwrap_rttiRegistry", registry) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(registry);
|
||||
|
||||
mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
|
||||
if(mexPutVariable("global", "gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(newAlreadyCreated);
|
||||
}
|
||||
}
|
||||
|
||||
void FunRange_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<FunRange> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_FunRange.insert(self);
|
||||
}
|
||||
|
||||
void FunRange_constructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<FunRange> Shared;
|
||||
|
||||
Shared *self = new Shared(new FunRange());
|
||||
collector_FunRange.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void FunRange_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<FunRange> Shared;
|
||||
checkArguments("delete_FunRange",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_FunRange::iterator item;
|
||||
item = collector_FunRange.find(self);
|
||||
if(item != collector_FunRange.end()) {
|
||||
delete self;
|
||||
collector_FunRange.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void FunRange_range_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("range",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<FunRange>(in[0], "ptr_FunRange");
|
||||
double d = unwrap< double >(in[1]);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<FunRange>(obj->range(d)),"FunRange", false);
|
||||
}
|
||||
|
||||
void FunRange_create_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("FunRange.create",nargout,nargin,0);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<FunRange>(FunRange::create()),"FunRange", false);
|
||||
}
|
||||
|
||||
void FunDouble_collectorInsertAndMakeBase_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<Fun<double>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_FunDouble.insert(self);
|
||||
}
|
||||
|
||||
void FunDouble_deconstructor_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<Fun<double>> Shared;
|
||||
checkArguments("delete_FunDouble",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_FunDouble::iterator item;
|
||||
item = collector_FunDouble.find(self);
|
||||
if(item != collector_FunDouble.end()) {
|
||||
delete self;
|
||||
collector_FunDouble.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void FunDouble_dhamaal_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("dhamaalString",nargout,nargin-1,2);
|
||||
auto obj = unwrap_shared_ptr<Fun<double>>(in[0], "ptr_FunDouble");
|
||||
double d = unwrap< double >(in[1]);
|
||||
string t = unwrap< string >(in[2]);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<Fun<double>>(obj->dhamaal<string>(d,t)),"Fun<double>", false);
|
||||
}
|
||||
|
||||
void FunDouble_divertido_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("FunDouble.divertido",nargout,nargin,0);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<Fun<double>>(Fun<double>::divertido()),"Fundouble", false);
|
||||
}
|
||||
|
||||
void Test_collectorInsertAndMakeBase_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<Test> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_Test.insert(self);
|
||||
}
|
||||
|
||||
void Test_constructor_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<Test> Shared;
|
||||
|
||||
Shared *self = new Shared(new Test());
|
||||
collector_Test.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void Test_constructor_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<Test> Shared;
|
||||
|
||||
double a = unwrap< double >(in[0]);
|
||||
Matrix b = unwrap< Matrix >(in[1]);
|
||||
Shared *self = new Shared(new Test(a,b));
|
||||
collector_Test.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void Test_deconstructor_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<Test> Shared;
|
||||
checkArguments("delete_Test",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_Test::iterator item;
|
||||
item = collector_Test.find(self);
|
||||
if(item != collector_Test.end()) {
|
||||
delete self;
|
||||
collector_Test.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void Test_arg_EigenConstRef_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("arg_EigenConstRef",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
obj->arg_EigenConstRef(value);
|
||||
}
|
||||
|
||||
void Test_create_MixedPtrs_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("create_MixedPtrs",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
auto pairResult = obj->create_MixedPtrs();
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<Test>(pairResult.first),"Test", false);
|
||||
out[1] = wrap_shared_ptr(pairResult.second,"Test", false);
|
||||
}
|
||||
|
||||
void Test_create_ptrs_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("create_ptrs",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
auto pairResult = obj->create_ptrs();
|
||||
out[0] = wrap_shared_ptr(pairResult.first,"Test", false);
|
||||
out[1] = wrap_shared_ptr(pairResult.second,"Test", false);
|
||||
}
|
||||
|
||||
void Test_print_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("print",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
obj->print();
|
||||
}
|
||||
|
||||
void Test_return_Point2Ptr_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_Point2Ptr",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
bool value = unwrap< bool >(in[1]);
|
||||
{
|
||||
boost::shared_ptr<Point2> shared(obj->return_Point2Ptr(value));
|
||||
out[0] = wrap_shared_ptr(shared,"Point2");
|
||||
}
|
||||
}
|
||||
|
||||
void Test_return_Test_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_Test",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
boost::shared_ptr<Test> value = unwrap_shared_ptr< Test >(in[1], "ptr_Test");
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<Test>(obj->return_Test(value)),"Test", false);
|
||||
}
|
||||
|
||||
void Test_return_TestPtr_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_TestPtr",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
boost::shared_ptr<Test> value = unwrap_shared_ptr< Test >(in[1], "ptr_Test");
|
||||
out[0] = wrap_shared_ptr(obj->return_TestPtr(value),"Test", false);
|
||||
}
|
||||
|
||||
void Test_return_bool_20(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_bool",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
bool value = unwrap< bool >(in[1]);
|
||||
out[0] = wrap< bool >(obj->return_bool(value));
|
||||
}
|
||||
|
||||
void Test_return_double_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_double",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
double value = unwrap< double >(in[1]);
|
||||
out[0] = wrap< double >(obj->return_double(value));
|
||||
}
|
||||
|
||||
void Test_return_field_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_field",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Test& t = *unwrap_shared_ptr< Test >(in[1], "ptr_Test");
|
||||
out[0] = wrap< bool >(obj->return_field(t));
|
||||
}
|
||||
|
||||
void Test_return_int_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_int",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
int value = unwrap< int >(in[1]);
|
||||
out[0] = wrap< int >(obj->return_int(value));
|
||||
}
|
||||
|
||||
void Test_return_matrix1_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_matrix1",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
out[0] = wrap< Matrix >(obj->return_matrix1(value));
|
||||
}
|
||||
|
||||
void Test_return_matrix2_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_matrix2",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
out[0] = wrap< Matrix >(obj->return_matrix2(value));
|
||||
}
|
||||
|
||||
void Test_return_pair_26(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_pair",nargout,nargin-1,2);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Vector v = unwrap< Vector >(in[1]);
|
||||
Matrix A = unwrap< Matrix >(in[2]);
|
||||
auto pairResult = obj->return_pair(v,A);
|
||||
out[0] = wrap< Vector >(pairResult.first);
|
||||
out[1] = wrap< Matrix >(pairResult.second);
|
||||
}
|
||||
|
||||
void Test_return_pair_27(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_pair",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Vector v = unwrap< Vector >(in[1]);
|
||||
auto pairResult = obj->return_pair(v);
|
||||
out[0] = wrap< Vector >(pairResult.first);
|
||||
out[1] = wrap< Matrix >(pairResult.second);
|
||||
}
|
||||
|
||||
void Test_return_ptrs_28(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_ptrs",nargout,nargin-1,2);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
boost::shared_ptr<Test> p1 = unwrap_shared_ptr< Test >(in[1], "ptr_Test");
|
||||
boost::shared_ptr<Test> p2 = unwrap_shared_ptr< Test >(in[2], "ptr_Test");
|
||||
auto pairResult = obj->return_ptrs(p1,p2);
|
||||
out[0] = wrap_shared_ptr(pairResult.first,"Test", false);
|
||||
out[1] = wrap_shared_ptr(pairResult.second,"Test", false);
|
||||
}
|
||||
|
||||
void Test_return_size_t_29(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_size_t",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
size_t value = unwrap< size_t >(in[1]);
|
||||
out[0] = wrap< size_t >(obj->return_size_t(value));
|
||||
}
|
||||
|
||||
void Test_return_string_30(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_string",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
string value = unwrap< string >(in[1]);
|
||||
out[0] = wrap< string >(obj->return_string(value));
|
||||
}
|
||||
|
||||
void Test_return_vector1_31(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_vector1",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Vector value = unwrap< Vector >(in[1]);
|
||||
out[0] = wrap< Vector >(obj->return_vector1(value));
|
||||
}
|
||||
|
||||
void Test_return_vector2_32(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_vector2",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<Test>(in[0], "ptr_Test");
|
||||
Vector value = unwrap< Vector >(in[1]);
|
||||
out[0] = wrap< Vector >(obj->return_vector2(value));
|
||||
}
|
||||
|
||||
void PrimitiveRefDouble_collectorInsertAndMakeBase_33(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<PrimitiveRef<double>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_PrimitiveRefDouble.insert(self);
|
||||
}
|
||||
|
||||
void PrimitiveRefDouble_constructor_34(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<PrimitiveRef<double>> Shared;
|
||||
|
||||
Shared *self = new Shared(new PrimitiveRef<double>());
|
||||
collector_PrimitiveRefDouble.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void PrimitiveRefDouble_deconstructor_35(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<PrimitiveRef<double>> Shared;
|
||||
checkArguments("delete_PrimitiveRefDouble",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_PrimitiveRefDouble::iterator item;
|
||||
item = collector_PrimitiveRefDouble.find(self);
|
||||
if(item != collector_PrimitiveRefDouble.end()) {
|
||||
delete self;
|
||||
collector_PrimitiveRefDouble.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void PrimitiveRefDouble_Brutal_36(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("PrimitiveRefDouble.Brutal",nargout,nargin,1);
|
||||
double t = unwrap< double >(in[0]);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<PrimitiveRef<double>>(PrimitiveRef<double>::Brutal(t)),"PrimitiveRefdouble", false);
|
||||
}
|
||||
|
||||
void MyVector3_collectorInsertAndMakeBase_37(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyVector<3>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MyVector3.insert(self);
|
||||
}
|
||||
|
||||
void MyVector3_constructor_38(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyVector<3>> Shared;
|
||||
|
||||
Shared *self = new Shared(new MyVector<3>());
|
||||
collector_MyVector3.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void MyVector3_deconstructor_39(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyVector<3>> Shared;
|
||||
checkArguments("delete_MyVector3",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MyVector3::iterator item;
|
||||
item = collector_MyVector3.find(self);
|
||||
if(item != collector_MyVector3.end()) {
|
||||
delete self;
|
||||
collector_MyVector3.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MyVector12_collectorInsertAndMakeBase_40(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyVector<12>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MyVector12.insert(self);
|
||||
}
|
||||
|
||||
void MyVector12_constructor_41(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyVector<12>> Shared;
|
||||
|
||||
Shared *self = new Shared(new MyVector<12>());
|
||||
collector_MyVector12.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void MyVector12_deconstructor_42(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyVector<12>> Shared;
|
||||
checkArguments("delete_MyVector12",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MyVector12::iterator item;
|
||||
item = collector_MyVector12.find(self);
|
||||
if(item != collector_MyVector12.end()) {
|
||||
delete self;
|
||||
collector_MyVector12.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MultipleTemplatesIntDouble_collectorInsertAndMakeBase_43(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MultipleTemplates<int, double>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MultipleTemplatesIntDouble.insert(self);
|
||||
}
|
||||
|
||||
void MultipleTemplatesIntDouble_deconstructor_44(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MultipleTemplates<int, double>> Shared;
|
||||
checkArguments("delete_MultipleTemplatesIntDouble",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MultipleTemplatesIntDouble::iterator item;
|
||||
item = collector_MultipleTemplatesIntDouble.find(self);
|
||||
if(item != collector_MultipleTemplatesIntDouble.end()) {
|
||||
delete self;
|
||||
collector_MultipleTemplatesIntDouble.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MultipleTemplatesIntFloat_collectorInsertAndMakeBase_45(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MultipleTemplates<int, float>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MultipleTemplatesIntFloat.insert(self);
|
||||
}
|
||||
|
||||
void MultipleTemplatesIntFloat_deconstructor_46(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MultipleTemplates<int, float>> Shared;
|
||||
checkArguments("delete_MultipleTemplatesIntFloat",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MultipleTemplatesIntFloat::iterator item;
|
||||
item = collector_MultipleTemplatesIntFloat.find(self);
|
||||
if(item != collector_MultipleTemplatesIntFloat.end()) {
|
||||
delete self;
|
||||
collector_MultipleTemplatesIntFloat.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MyFactorPosePoint2_collectorInsertAndMakeBase_47(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MyFactorPosePoint2.insert(self);
|
||||
}
|
||||
|
||||
void MyFactorPosePoint2_constructor_48(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>> Shared;
|
||||
|
||||
size_t key1 = unwrap< size_t >(in[0]);
|
||||
size_t key2 = unwrap< size_t >(in[1]);
|
||||
double measured = unwrap< double >(in[2]);
|
||||
boost::shared_ptr<gtsam::noiseModel::Base> noiseModel = unwrap_shared_ptr< gtsam::noiseModel::Base >(in[3], "ptr_gtsamnoiseModelBase");
|
||||
Shared *self = new Shared(new MyFactor<gtsam::Pose2, gtsam::Matrix>(key1,key2,measured,noiseModel));
|
||||
collector_MyFactorPosePoint2.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void MyFactorPosePoint2_deconstructor_49(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>> Shared;
|
||||
checkArguments("delete_MyFactorPosePoint2",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MyFactorPosePoint2::iterator item;
|
||||
item = collector_MyFactorPosePoint2.find(self);
|
||||
if(item != collector_MyFactorPosePoint2.end()) {
|
||||
delete self;
|
||||
collector_MyFactorPosePoint2.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
_class_RTTIRegister();
|
||||
|
||||
int id = unwrap<int>(in[0]);
|
||||
|
||||
try {
|
||||
switch(id) {
|
||||
case 0:
|
||||
FunRange_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 1:
|
||||
FunRange_constructor_1(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 2:
|
||||
FunRange_deconstructor_2(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 3:
|
||||
FunRange_range_3(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 4:
|
||||
FunRange_create_4(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 5:
|
||||
FunDouble_collectorInsertAndMakeBase_5(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 6:
|
||||
FunDouble_deconstructor_6(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 7:
|
||||
FunDouble_dhamaal_7(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 8:
|
||||
FunDouble_divertido_8(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 9:
|
||||
Test_collectorInsertAndMakeBase_9(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 10:
|
||||
Test_constructor_10(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 11:
|
||||
Test_constructor_11(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 12:
|
||||
Test_deconstructor_12(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 13:
|
||||
Test_arg_EigenConstRef_13(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 14:
|
||||
Test_create_MixedPtrs_14(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 15:
|
||||
Test_create_ptrs_15(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 16:
|
||||
Test_print_16(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 17:
|
||||
Test_return_Point2Ptr_17(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 18:
|
||||
Test_return_Test_18(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 19:
|
||||
Test_return_TestPtr_19(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 20:
|
||||
Test_return_bool_20(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 21:
|
||||
Test_return_double_21(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 22:
|
||||
Test_return_field_22(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 23:
|
||||
Test_return_int_23(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 24:
|
||||
Test_return_matrix1_24(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 25:
|
||||
Test_return_matrix2_25(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 26:
|
||||
Test_return_pair_26(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 27:
|
||||
Test_return_pair_27(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 28:
|
||||
Test_return_ptrs_28(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 29:
|
||||
Test_return_size_t_29(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 30:
|
||||
Test_return_string_30(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 31:
|
||||
Test_return_vector1_31(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 32:
|
||||
Test_return_vector2_32(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 33:
|
||||
PrimitiveRefDouble_collectorInsertAndMakeBase_33(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 34:
|
||||
PrimitiveRefDouble_constructor_34(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 35:
|
||||
PrimitiveRefDouble_deconstructor_35(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 36:
|
||||
PrimitiveRefDouble_Brutal_36(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 37:
|
||||
MyVector3_collectorInsertAndMakeBase_37(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 38:
|
||||
MyVector3_constructor_38(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 39:
|
||||
MyVector3_deconstructor_39(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 40:
|
||||
MyVector12_collectorInsertAndMakeBase_40(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 41:
|
||||
MyVector12_constructor_41(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 42:
|
||||
MyVector12_deconstructor_42(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 43:
|
||||
MultipleTemplatesIntDouble_collectorInsertAndMakeBase_43(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 44:
|
||||
MultipleTemplatesIntDouble_deconstructor_44(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 45:
|
||||
MultipleTemplatesIntFloat_collectorInsertAndMakeBase_45(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 46:
|
||||
MultipleTemplatesIntFloat_deconstructor_46(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 47:
|
||||
MyFactorPosePoint2_collectorInsertAndMakeBase_47(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 48:
|
||||
MyFactorPosePoint2_constructor_48(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 49:
|
||||
MyFactorPosePoint2_deconstructor_49(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
}
|
||||
} catch(const std::exception& e) {
|
||||
mexErrMsgTxt(("Exception from gtsam:\n" + std::string(e.what()) + "\n").c_str());
|
||||
}
|
||||
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
|
@ -0,0 +1,250 @@
|
|||
#include <gtwrap/matlab.h>
|
||||
#include <map>
|
||||
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
#include <folder/path/to/Test.h>
|
||||
|
||||
|
||||
typedef Fun<double> FunDouble;
|
||||
typedef PrimitiveRef<double> PrimitiveRefDouble;
|
||||
typedef MyVector<3> MyVector3;
|
||||
typedef MyVector<12> MyVector12;
|
||||
typedef MultipleTemplates<int, double> MultipleTemplatesIntDouble;
|
||||
typedef MultipleTemplates<int, float> MultipleTemplatesIntFloat;
|
||||
typedef MyFactor<gtsam::Pose2, gtsam::Matrix> MyFactorPosePoint2;
|
||||
|
||||
|
||||
typedef std::set<boost::shared_ptr<FunRange>*> Collector_FunRange;
|
||||
static Collector_FunRange collector_FunRange;
|
||||
typedef std::set<boost::shared_ptr<FunDouble>*> Collector_FunDouble;
|
||||
static Collector_FunDouble collector_FunDouble;
|
||||
typedef std::set<boost::shared_ptr<Test>*> Collector_Test;
|
||||
static Collector_Test collector_Test;
|
||||
typedef std::set<boost::shared_ptr<PrimitiveRefDouble>*> Collector_PrimitiveRefDouble;
|
||||
static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble;
|
||||
typedef std::set<boost::shared_ptr<MyVector3>*> Collector_MyVector3;
|
||||
static Collector_MyVector3 collector_MyVector3;
|
||||
typedef std::set<boost::shared_ptr<MyVector12>*> Collector_MyVector12;
|
||||
static Collector_MyVector12 collector_MyVector12;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntDouble>*> Collector_MultipleTemplatesIntDouble;
|
||||
static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntFloat>*> Collector_MultipleTemplatesIntFloat;
|
||||
static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat;
|
||||
typedef std::set<boost::shared_ptr<MyFactorPosePoint2>*> Collector_MyFactorPosePoint2;
|
||||
static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2;
|
||||
|
||||
void _deleteAllObjects()
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
bool anyDeleted = false;
|
||||
{ for(Collector_FunRange::iterator iter = collector_FunRange.begin();
|
||||
iter != collector_FunRange.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunRange.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_FunDouble::iterator iter = collector_FunDouble.begin();
|
||||
iter != collector_FunDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_Test::iterator iter = collector_Test.begin();
|
||||
iter != collector_Test.end(); ) {
|
||||
delete *iter;
|
||||
collector_Test.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_PrimitiveRefDouble::iterator iter = collector_PrimitiveRefDouble.begin();
|
||||
iter != collector_PrimitiveRefDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_PrimitiveRefDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector3::iterator iter = collector_MyVector3.begin();
|
||||
iter != collector_MyVector3.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector12::iterator iter = collector_MyVector12.begin();
|
||||
iter != collector_MyVector12.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector12.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntDouble::iterator iter = collector_MultipleTemplatesIntDouble.begin();
|
||||
iter != collector_MultipleTemplatesIntDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntFloat::iterator iter = collector_MultipleTemplatesIntFloat.begin();
|
||||
iter != collector_MultipleTemplatesIntFloat.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntFloat.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyFactorPosePoint2::iterator iter = collector_MyFactorPosePoint2.begin();
|
||||
iter != collector_MyFactorPosePoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyFactorPosePoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
if(anyDeleted)
|
||||
cout <<
|
||||
"WARNING: Wrap modules with variables in the workspace have been reloaded due to\n"
|
||||
"calling destructors, call 'clear all' again if you plan to now recompile a wrap\n"
|
||||
"module, so that your recompiled module is used instead of the old one." << endl;
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
||||
|
||||
void _functions_RTTIRegister() {
|
||||
const mxArray *alreadyCreated = mexGetVariablePtr("global", "gtsam_functions_rttiRegistry_created");
|
||||
if(!alreadyCreated) {
|
||||
std::map<std::string, std::string> types;
|
||||
|
||||
mxArray *registry = mexGetVariable("global", "gtsamwrap_rttiRegistry");
|
||||
if(!registry)
|
||||
registry = mxCreateStructMatrix(1, 1, 0, NULL);
|
||||
typedef std::pair<std::string, std::string> StringPair;
|
||||
for(const StringPair& rtti_matlab: types) {
|
||||
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
|
||||
if(fieldId < 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
|
||||
mxSetFieldByNumber(registry, 0, fieldId, matlabName);
|
||||
}
|
||||
if(mexPutVariable("global", "gtsamwrap_rttiRegistry", registry) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(registry);
|
||||
|
||||
mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
|
||||
if(mexPutVariable("global", "gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(newAlreadyCreated);
|
||||
}
|
||||
}
|
||||
|
||||
void load2D_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("load2D",nargout,nargin,5);
|
||||
string filename = unwrap< string >(in[0]);
|
||||
boost::shared_ptr<Test> model = unwrap_shared_ptr< Test >(in[1], "ptr_Test");
|
||||
int maxID = unwrap< int >(in[2]);
|
||||
bool addNoise = unwrap< bool >(in[3]);
|
||||
bool smart = unwrap< bool >(in[4]);
|
||||
auto pairResult = load2D(filename,model,maxID,addNoise,smart);
|
||||
out[0] = wrap_shared_ptr(pairResult.first,"gtsam.NonlinearFactorGraph", false);
|
||||
out[1] = wrap_shared_ptr(pairResult.second,"gtsam.Values", false);
|
||||
}
|
||||
void load2D_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("load2D",nargout,nargin,5);
|
||||
string filename = unwrap< string >(in[0]);
|
||||
boost::shared_ptr<gtsam::noiseModel::Diagonal> model = unwrap_shared_ptr< gtsam::noiseModel::Diagonal >(in[1], "ptr_gtsamnoiseModelDiagonal");
|
||||
int maxID = unwrap< int >(in[2]);
|
||||
bool addNoise = unwrap< bool >(in[3]);
|
||||
bool smart = unwrap< bool >(in[4]);
|
||||
auto pairResult = load2D(filename,model,maxID,addNoise,smart);
|
||||
out[0] = wrap_shared_ptr(pairResult.first,"gtsam.NonlinearFactorGraph", false);
|
||||
out[1] = wrap_shared_ptr(pairResult.second,"gtsam.Values", false);
|
||||
}
|
||||
void load2D_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("load2D",nargout,nargin,2);
|
||||
string filename = unwrap< string >(in[0]);
|
||||
boost::shared_ptr<gtsam::noiseModel::Diagonal> model = unwrap_shared_ptr< gtsam::noiseModel::Diagonal >(in[1], "ptr_gtsamnoiseModelDiagonal");
|
||||
auto pairResult = load2D(filename,model);
|
||||
out[0] = wrap_shared_ptr(pairResult.first,"gtsam.NonlinearFactorGraph", false);
|
||||
out[1] = wrap_shared_ptr(pairResult.second,"gtsam.Values", false);
|
||||
}
|
||||
void aGlobalFunction_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("aGlobalFunction",nargout,nargin,0);
|
||||
out[0] = wrap< Vector >(aGlobalFunction());
|
||||
}
|
||||
void overloadedGlobalFunction_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("overloadedGlobalFunction",nargout,nargin,1);
|
||||
int a = unwrap< int >(in[0]);
|
||||
out[0] = wrap< Vector >(overloadedGlobalFunction(a));
|
||||
}
|
||||
void overloadedGlobalFunction_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("overloadedGlobalFunction",nargout,nargin,2);
|
||||
int a = unwrap< int >(in[0]);
|
||||
double b = unwrap< double >(in[1]);
|
||||
out[0] = wrap< Vector >(overloadedGlobalFunction(a,b));
|
||||
}
|
||||
void MultiTemplatedFunctionStringSize_tDouble_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("MultiTemplatedFunctionStringSize_tDouble",nargout,nargin,2);
|
||||
T& x = *unwrap_shared_ptr< T >(in[0], "ptr_T");
|
||||
size_t y = unwrap< size_t >(in[1]);
|
||||
out[0] = wrap< double >(MultiTemplatedFunctionStringSize_tDouble(x,y));
|
||||
}
|
||||
void MultiTemplatedFunctionDoubleSize_tDouble_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("MultiTemplatedFunctionDoubleSize_tDouble",nargout,nargin,2);
|
||||
T& x = *unwrap_shared_ptr< T >(in[0], "ptr_T");
|
||||
size_t y = unwrap< size_t >(in[1]);
|
||||
out[0] = wrap< double >(MultiTemplatedFunctionDoubleSize_tDouble(x,y));
|
||||
}
|
||||
void TemplatedFunctionRot3_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("TemplatedFunctionRot3",nargout,nargin,1);
|
||||
gtsam::Rot3& t = *unwrap_shared_ptr< gtsam::Rot3 >(in[0], "ptr_gtsamRot3");
|
||||
TemplatedFunctionRot3(t);
|
||||
}
|
||||
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
_functions_RTTIRegister();
|
||||
|
||||
int id = unwrap<int>(in[0]);
|
||||
|
||||
try {
|
||||
switch(id) {
|
||||
case 0:
|
||||
load2D_0(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 1:
|
||||
load2D_1(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 2:
|
||||
load2D_2(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 3:
|
||||
aGlobalFunction_3(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 4:
|
||||
overloadedGlobalFunction_4(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 5:
|
||||
overloadedGlobalFunction_5(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 6:
|
||||
MultiTemplatedFunctionStringSize_tDouble_6(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 7:
|
||||
MultiTemplatedFunctionDoubleSize_tDouble_7(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 8:
|
||||
TemplatedFunctionRot3_8(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
}
|
||||
} catch(const std::exception& e) {
|
||||
mexErrMsgTxt(("Exception from gtsam:\n" + std::string(e.what()) + "\n").c_str());
|
||||
}
|
||||
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
|
@ -0,0 +1,480 @@
|
|||
#include <gtwrap/matlab.h>
|
||||
#include <map>
|
||||
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
#include <folder/path/to/Test.h>
|
||||
#include <gtsam/geometry/Point2.h>
|
||||
#include <gtsam/geometry/Point3.h>
|
||||
|
||||
typedef Fun<double> FunDouble;
|
||||
typedef PrimitiveRef<double> PrimitiveRefDouble;
|
||||
typedef MyVector<3> MyVector3;
|
||||
typedef MyVector<12> MyVector12;
|
||||
typedef MultipleTemplates<int, double> MultipleTemplatesIntDouble;
|
||||
typedef MultipleTemplates<int, float> MultipleTemplatesIntFloat;
|
||||
typedef MyFactor<gtsam::Pose2, gtsam::Matrix> MyFactorPosePoint2;
|
||||
|
||||
BOOST_CLASS_EXPORT_GUID(gtsam::Point2, "gtsamPoint2");
|
||||
BOOST_CLASS_EXPORT_GUID(gtsam::Point3, "gtsamPoint3");
|
||||
|
||||
typedef std::set<boost::shared_ptr<FunRange>*> Collector_FunRange;
|
||||
static Collector_FunRange collector_FunRange;
|
||||
typedef std::set<boost::shared_ptr<FunDouble>*> Collector_FunDouble;
|
||||
static Collector_FunDouble collector_FunDouble;
|
||||
typedef std::set<boost::shared_ptr<Test>*> Collector_Test;
|
||||
static Collector_Test collector_Test;
|
||||
typedef std::set<boost::shared_ptr<PrimitiveRefDouble>*> Collector_PrimitiveRefDouble;
|
||||
static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble;
|
||||
typedef std::set<boost::shared_ptr<MyVector3>*> Collector_MyVector3;
|
||||
static Collector_MyVector3 collector_MyVector3;
|
||||
typedef std::set<boost::shared_ptr<MyVector12>*> Collector_MyVector12;
|
||||
static Collector_MyVector12 collector_MyVector12;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntDouble>*> Collector_MultipleTemplatesIntDouble;
|
||||
static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntFloat>*> Collector_MultipleTemplatesIntFloat;
|
||||
static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat;
|
||||
typedef std::set<boost::shared_ptr<MyFactorPosePoint2>*> Collector_MyFactorPosePoint2;
|
||||
static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2;
|
||||
typedef std::set<boost::shared_ptr<gtsam::Point2>*> Collector_gtsamPoint2;
|
||||
static Collector_gtsamPoint2 collector_gtsamPoint2;
|
||||
typedef std::set<boost::shared_ptr<gtsam::Point3>*> Collector_gtsamPoint3;
|
||||
static Collector_gtsamPoint3 collector_gtsamPoint3;
|
||||
|
||||
void _deleteAllObjects()
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
bool anyDeleted = false;
|
||||
{ for(Collector_FunRange::iterator iter = collector_FunRange.begin();
|
||||
iter != collector_FunRange.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunRange.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_FunDouble::iterator iter = collector_FunDouble.begin();
|
||||
iter != collector_FunDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_Test::iterator iter = collector_Test.begin();
|
||||
iter != collector_Test.end(); ) {
|
||||
delete *iter;
|
||||
collector_Test.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_PrimitiveRefDouble::iterator iter = collector_PrimitiveRefDouble.begin();
|
||||
iter != collector_PrimitiveRefDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_PrimitiveRefDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector3::iterator iter = collector_MyVector3.begin();
|
||||
iter != collector_MyVector3.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector12::iterator iter = collector_MyVector12.begin();
|
||||
iter != collector_MyVector12.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector12.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntDouble::iterator iter = collector_MultipleTemplatesIntDouble.begin();
|
||||
iter != collector_MultipleTemplatesIntDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntFloat::iterator iter = collector_MultipleTemplatesIntFloat.begin();
|
||||
iter != collector_MultipleTemplatesIntFloat.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntFloat.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyFactorPosePoint2::iterator iter = collector_MyFactorPosePoint2.begin();
|
||||
iter != collector_MyFactorPosePoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyFactorPosePoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_gtsamPoint2::iterator iter = collector_gtsamPoint2.begin();
|
||||
iter != collector_gtsamPoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_gtsamPoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_gtsamPoint3::iterator iter = collector_gtsamPoint3.begin();
|
||||
iter != collector_gtsamPoint3.end(); ) {
|
||||
delete *iter;
|
||||
collector_gtsamPoint3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
if(anyDeleted)
|
||||
cout <<
|
||||
"WARNING: Wrap modules with variables in the workspace have been reloaded due to\n"
|
||||
"calling destructors, call 'clear all' again if you plan to now recompile a wrap\n"
|
||||
"module, so that your recompiled module is used instead of the old one." << endl;
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
||||
|
||||
void _geometry_RTTIRegister() {
|
||||
const mxArray *alreadyCreated = mexGetVariablePtr("global", "gtsam_geometry_rttiRegistry_created");
|
||||
if(!alreadyCreated) {
|
||||
std::map<std::string, std::string> types;
|
||||
|
||||
mxArray *registry = mexGetVariable("global", "gtsamwrap_rttiRegistry");
|
||||
if(!registry)
|
||||
registry = mxCreateStructMatrix(1, 1, 0, NULL);
|
||||
typedef std::pair<std::string, std::string> StringPair;
|
||||
for(const StringPair& rtti_matlab: types) {
|
||||
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
|
||||
if(fieldId < 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
|
||||
mxSetFieldByNumber(registry, 0, fieldId, matlabName);
|
||||
}
|
||||
if(mexPutVariable("global", "gtsamwrap_rttiRegistry", registry) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(registry);
|
||||
|
||||
mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
|
||||
if(mexPutVariable("global", "gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(newAlreadyCreated);
|
||||
}
|
||||
}
|
||||
|
||||
void gtsamPoint2_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<gtsam::Point2> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_gtsamPoint2.insert(self);
|
||||
}
|
||||
|
||||
void gtsamPoint2_constructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<gtsam::Point2> Shared;
|
||||
|
||||
Shared *self = new Shared(new gtsam::Point2());
|
||||
collector_gtsamPoint2.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void gtsamPoint2_constructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<gtsam::Point2> Shared;
|
||||
|
||||
double x = unwrap< double >(in[0]);
|
||||
double y = unwrap< double >(in[1]);
|
||||
Shared *self = new Shared(new gtsam::Point2(x,y));
|
||||
collector_gtsamPoint2.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void gtsamPoint2_deconstructor_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<gtsam::Point2> Shared;
|
||||
checkArguments("delete_gtsamPoint2",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_gtsamPoint2::iterator item;
|
||||
item = collector_gtsamPoint2.find(self);
|
||||
if(item != collector_gtsamPoint2.end()) {
|
||||
delete self;
|
||||
collector_gtsamPoint2.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void gtsamPoint2_argChar_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
char a = unwrap< char >(in[1]);
|
||||
obj->argChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_argChar_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
boost::shared_ptr<char> a = unwrap_shared_ptr< char >(in[1], "ptr_char");
|
||||
obj->argChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_argChar_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
char a = unwrap< char >(in[1]);
|
||||
obj->argChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_argChar_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
boost::shared_ptr<char> a = unwrap_shared_ptr< char >(in[1], "ptr_char");
|
||||
obj->argChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_argChar_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
boost::shared_ptr<char> a = unwrap_shared_ptr< char >(in[1], "ptr_char");
|
||||
obj->argChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_argChar_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
char a = unwrap< char >(in[1]);
|
||||
obj->argChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_argChar_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
boost::shared_ptr<char> a = unwrap_shared_ptr< char >(in[1], "ptr_char");
|
||||
obj->argChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_argUChar_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("argUChar",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
unsigned char a = unwrap< unsigned char >(in[1]);
|
||||
obj->argUChar(a);
|
||||
}
|
||||
|
||||
void gtsamPoint2_dim_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("dim",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
out[0] = wrap< int >(obj->dim());
|
||||
}
|
||||
|
||||
void gtsamPoint2_eigenArguments_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("eigenArguments",nargout,nargin-1,2);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
Vector v = unwrap< Vector >(in[1]);
|
||||
Matrix m = unwrap< Matrix >(in[2]);
|
||||
obj->eigenArguments(v,m);
|
||||
}
|
||||
|
||||
void gtsamPoint2_returnChar_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("returnChar",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
out[0] = wrap< char >(obj->returnChar());
|
||||
}
|
||||
|
||||
void gtsamPoint2_vectorConfusion_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("vectorConfusion",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<VectorNotEigen>(obj->vectorConfusion()),"VectorNotEigen", false);
|
||||
}
|
||||
|
||||
void gtsamPoint2_x_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("x",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
out[0] = wrap< double >(obj->x());
|
||||
}
|
||||
|
||||
void gtsamPoint2_y_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("y",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point2>(in[0], "ptr_gtsamPoint2");
|
||||
out[0] = wrap< double >(obj->y());
|
||||
}
|
||||
|
||||
void gtsamPoint3_collectorInsertAndMakeBase_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<gtsam::Point3> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_gtsamPoint3.insert(self);
|
||||
}
|
||||
|
||||
void gtsamPoint3_constructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<gtsam::Point3> Shared;
|
||||
|
||||
double x = unwrap< double >(in[0]);
|
||||
double y = unwrap< double >(in[1]);
|
||||
double z = unwrap< double >(in[2]);
|
||||
Shared *self = new Shared(new gtsam::Point3(x,y,z));
|
||||
collector_gtsamPoint3.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void gtsamPoint3_deconstructor_20(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<gtsam::Point3> Shared;
|
||||
checkArguments("delete_gtsamPoint3",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_gtsamPoint3::iterator item;
|
||||
item = collector_gtsamPoint3.find(self);
|
||||
if(item != collector_gtsamPoint3.end()) {
|
||||
delete self;
|
||||
collector_gtsamPoint3.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void gtsamPoint3_norm_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("norm",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<gtsam::Point3>(in[0], "ptr_gtsamPoint3");
|
||||
out[0] = wrap< double >(obj->norm());
|
||||
}
|
||||
|
||||
void gtsamPoint3_string_serialize_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<gtsam::Point3> Shared;
|
||||
checkArguments("string_serialize",nargout,nargin-1,0);
|
||||
Shared obj = unwrap_shared_ptr<gtsam::Point3>(in[0], "ptr_gtsamPoint3");
|
||||
ostringstream out_archive_stream;
|
||||
boost::archive::text_oarchive out_archive(out_archive_stream);
|
||||
out_archive << *obj;
|
||||
out[0] = wrap< string >(out_archive_stream.str());
|
||||
}
|
||||
void gtsamPoint3_StaticFunctionRet_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("gtsamPoint3.StaticFunctionRet",nargout,nargin,1);
|
||||
double z = unwrap< double >(in[0]);
|
||||
out[0] = wrap< Point3 >(gtsam::Point3::StaticFunctionRet(z));
|
||||
}
|
||||
|
||||
void gtsamPoint3_staticFunction_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("gtsamPoint3.staticFunction",nargout,nargin,0);
|
||||
out[0] = wrap< double >(gtsam::Point3::staticFunction());
|
||||
}
|
||||
|
||||
void gtsamPoint3_string_deserialize_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<gtsam::Point3> Shared;
|
||||
checkArguments("gtsamPoint3.string_deserialize",nargout,nargin,1);
|
||||
string serialized = unwrap< string >(in[0]);
|
||||
istringstream in_archive_stream(serialized);
|
||||
boost::archive::text_iarchive in_archive(in_archive_stream);
|
||||
Shared output(new gtsam::Point3());
|
||||
in_archive >> *output;
|
||||
out[0] = wrap_shared_ptr(output,"gtsam.Point3", false);
|
||||
}
|
||||
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
_geometry_RTTIRegister();
|
||||
|
||||
int id = unwrap<int>(in[0]);
|
||||
|
||||
try {
|
||||
switch(id) {
|
||||
case 0:
|
||||
gtsamPoint2_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 1:
|
||||
gtsamPoint2_constructor_1(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 2:
|
||||
gtsamPoint2_constructor_2(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 3:
|
||||
gtsamPoint2_deconstructor_3(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 4:
|
||||
gtsamPoint2_argChar_4(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 5:
|
||||
gtsamPoint2_argChar_5(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 6:
|
||||
gtsamPoint2_argChar_6(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 7:
|
||||
gtsamPoint2_argChar_7(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 8:
|
||||
gtsamPoint2_argChar_8(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 9:
|
||||
gtsamPoint2_argChar_9(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 10:
|
||||
gtsamPoint2_argChar_10(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 11:
|
||||
gtsamPoint2_argUChar_11(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 12:
|
||||
gtsamPoint2_dim_12(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 13:
|
||||
gtsamPoint2_eigenArguments_13(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 14:
|
||||
gtsamPoint2_returnChar_14(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 15:
|
||||
gtsamPoint2_vectorConfusion_15(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 16:
|
||||
gtsamPoint2_x_16(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 17:
|
||||
gtsamPoint2_y_17(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 18:
|
||||
gtsamPoint3_collectorInsertAndMakeBase_18(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 19:
|
||||
gtsamPoint3_constructor_19(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 20:
|
||||
gtsamPoint3_deconstructor_20(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 21:
|
||||
gtsamPoint3_norm_21(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 22:
|
||||
gtsamPoint3_string_serialize_22(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 23:
|
||||
gtsamPoint3_StaticFunctionRet_23(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 24:
|
||||
gtsamPoint3_staticFunction_24(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 25:
|
||||
gtsamPoint3_string_deserialize_25(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
}
|
||||
} catch(const std::exception& e) {
|
||||
mexErrMsgTxt(("Exception from gtsam:\n" + std::string(e.what()) + "\n").c_str());
|
||||
}
|
||||
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
|
@ -0,0 +1,681 @@
|
|||
#include <gtwrap/matlab.h>
|
||||
#include <map>
|
||||
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
#include <folder/path/to/Test.h>
|
||||
#include <gtsam/geometry/Point2.h>
|
||||
#include <gtsam/geometry/Point3.h>
|
||||
|
||||
typedef Fun<double> FunDouble;
|
||||
typedef PrimitiveRef<double> PrimitiveRefDouble;
|
||||
typedef MyVector<3> MyVector3;
|
||||
typedef MyVector<12> MyVector12;
|
||||
typedef MultipleTemplates<int, double> MultipleTemplatesIntDouble;
|
||||
typedef MultipleTemplates<int, float> MultipleTemplatesIntFloat;
|
||||
typedef MyFactor<gtsam::Pose2, gtsam::Matrix> MyFactorPosePoint2;
|
||||
typedef MyTemplate<gtsam::Point2> MyTemplatePoint2;
|
||||
typedef MyTemplate<gtsam::Matrix> MyTemplateMatrix;
|
||||
|
||||
BOOST_CLASS_EXPORT_GUID(gtsam::Point2, "gtsamPoint2");
|
||||
BOOST_CLASS_EXPORT_GUID(gtsam::Point3, "gtsamPoint3");
|
||||
|
||||
typedef std::set<boost::shared_ptr<FunRange>*> Collector_FunRange;
|
||||
static Collector_FunRange collector_FunRange;
|
||||
typedef std::set<boost::shared_ptr<FunDouble>*> Collector_FunDouble;
|
||||
static Collector_FunDouble collector_FunDouble;
|
||||
typedef std::set<boost::shared_ptr<Test>*> Collector_Test;
|
||||
static Collector_Test collector_Test;
|
||||
typedef std::set<boost::shared_ptr<PrimitiveRefDouble>*> Collector_PrimitiveRefDouble;
|
||||
static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble;
|
||||
typedef std::set<boost::shared_ptr<MyVector3>*> Collector_MyVector3;
|
||||
static Collector_MyVector3 collector_MyVector3;
|
||||
typedef std::set<boost::shared_ptr<MyVector12>*> Collector_MyVector12;
|
||||
static Collector_MyVector12 collector_MyVector12;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntDouble>*> Collector_MultipleTemplatesIntDouble;
|
||||
static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntFloat>*> Collector_MultipleTemplatesIntFloat;
|
||||
static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat;
|
||||
typedef std::set<boost::shared_ptr<MyFactorPosePoint2>*> Collector_MyFactorPosePoint2;
|
||||
static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2;
|
||||
typedef std::set<boost::shared_ptr<gtsam::Point2>*> Collector_gtsamPoint2;
|
||||
static Collector_gtsamPoint2 collector_gtsamPoint2;
|
||||
typedef std::set<boost::shared_ptr<gtsam::Point3>*> Collector_gtsamPoint3;
|
||||
static Collector_gtsamPoint3 collector_gtsamPoint3;
|
||||
typedef std::set<boost::shared_ptr<MyBase>*> Collector_MyBase;
|
||||
static Collector_MyBase collector_MyBase;
|
||||
typedef std::set<boost::shared_ptr<MyTemplatePoint2>*> Collector_MyTemplatePoint2;
|
||||
static Collector_MyTemplatePoint2 collector_MyTemplatePoint2;
|
||||
typedef std::set<boost::shared_ptr<MyTemplateMatrix>*> Collector_MyTemplateMatrix;
|
||||
static Collector_MyTemplateMatrix collector_MyTemplateMatrix;
|
||||
|
||||
void _deleteAllObjects()
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
bool anyDeleted = false;
|
||||
{ for(Collector_FunRange::iterator iter = collector_FunRange.begin();
|
||||
iter != collector_FunRange.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunRange.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_FunDouble::iterator iter = collector_FunDouble.begin();
|
||||
iter != collector_FunDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_Test::iterator iter = collector_Test.begin();
|
||||
iter != collector_Test.end(); ) {
|
||||
delete *iter;
|
||||
collector_Test.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_PrimitiveRefDouble::iterator iter = collector_PrimitiveRefDouble.begin();
|
||||
iter != collector_PrimitiveRefDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_PrimitiveRefDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector3::iterator iter = collector_MyVector3.begin();
|
||||
iter != collector_MyVector3.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector12::iterator iter = collector_MyVector12.begin();
|
||||
iter != collector_MyVector12.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector12.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntDouble::iterator iter = collector_MultipleTemplatesIntDouble.begin();
|
||||
iter != collector_MultipleTemplatesIntDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntFloat::iterator iter = collector_MultipleTemplatesIntFloat.begin();
|
||||
iter != collector_MultipleTemplatesIntFloat.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntFloat.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyFactorPosePoint2::iterator iter = collector_MyFactorPosePoint2.begin();
|
||||
iter != collector_MyFactorPosePoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyFactorPosePoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_gtsamPoint2::iterator iter = collector_gtsamPoint2.begin();
|
||||
iter != collector_gtsamPoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_gtsamPoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_gtsamPoint3::iterator iter = collector_gtsamPoint3.begin();
|
||||
iter != collector_gtsamPoint3.end(); ) {
|
||||
delete *iter;
|
||||
collector_gtsamPoint3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyBase::iterator iter = collector_MyBase.begin();
|
||||
iter != collector_MyBase.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyBase.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyTemplatePoint2::iterator iter = collector_MyTemplatePoint2.begin();
|
||||
iter != collector_MyTemplatePoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyTemplatePoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyTemplateMatrix::iterator iter = collector_MyTemplateMatrix.begin();
|
||||
iter != collector_MyTemplateMatrix.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyTemplateMatrix.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
if(anyDeleted)
|
||||
cout <<
|
||||
"WARNING: Wrap modules with variables in the workspace have been reloaded due to\n"
|
||||
"calling destructors, call 'clear all' again if you plan to now recompile a wrap\n"
|
||||
"module, so that your recompiled module is used instead of the old one." << endl;
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
||||
|
||||
void _inheritance_RTTIRegister() {
|
||||
const mxArray *alreadyCreated = mexGetVariablePtr("global", "gtsam_inheritance_rttiRegistry_created");
|
||||
if(!alreadyCreated) {
|
||||
std::map<std::string, std::string> types;
|
||||
types.insert(std::make_pair(typeid(MyBase).name(), "MyBase"));
|
||||
types.insert(std::make_pair(typeid(MyTemplatePoint2).name(), "MyTemplatePoint2"));
|
||||
types.insert(std::make_pair(typeid(MyTemplateMatrix).name(), "MyTemplateMatrix"));
|
||||
|
||||
mxArray *registry = mexGetVariable("global", "gtsamwrap_rttiRegistry");
|
||||
if(!registry)
|
||||
registry = mxCreateStructMatrix(1, 1, 0, NULL);
|
||||
typedef std::pair<std::string, std::string> StringPair;
|
||||
for(const StringPair& rtti_matlab: types) {
|
||||
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
|
||||
if(fieldId < 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
|
||||
mxSetFieldByNumber(registry, 0, fieldId, matlabName);
|
||||
}
|
||||
if(mexPutVariable("global", "gtsamwrap_rttiRegistry", registry) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(registry);
|
||||
|
||||
mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
|
||||
if(mexPutVariable("global", "gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(newAlreadyCreated);
|
||||
}
|
||||
}
|
||||
|
||||
void gtsamPoint2_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<gtsam::Point2> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_gtsamPoint2.insert(self);
|
||||
}
|
||||
|
||||
void MyBase_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyBase> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MyBase.insert(self);
|
||||
}
|
||||
|
||||
void MyBase_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyBase> Shared;
|
||||
checkArguments("delete_MyBase",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MyBase::iterator item;
|
||||
item = collector_MyBase.find(self);
|
||||
if(item != collector_MyBase.end()) {
|
||||
delete self;
|
||||
collector_MyBase.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void gtsamPoint2_deconstructor_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<gtsam::Point2> Shared;
|
||||
checkArguments("delete_gtsamPoint2",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_gtsamPoint2::iterator item;
|
||||
item = collector_gtsamPoint2.find(self);
|
||||
if(item != collector_gtsamPoint2.end()) {
|
||||
delete self;
|
||||
collector_gtsamPoint2.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MyTemplatePoint2.insert(self);
|
||||
|
||||
typedef boost::shared_ptr<MyBase> SharedBase;
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self);
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_constructor_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared;
|
||||
|
||||
Shared *self = new Shared(new MyTemplate<gtsam::Point2>());
|
||||
collector_MyTemplatePoint2.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
|
||||
typedef boost::shared_ptr<MyBase> SharedBase;
|
||||
out[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<SharedBase**>(mxGetData(out[1])) = new SharedBase(*self);
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_deconstructor_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyTemplate<gtsam::Point2>> Shared;
|
||||
checkArguments("delete_MyTemplatePoint2",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MyTemplatePoint2::iterator item;
|
||||
item = collector_MyTemplatePoint2.find(self);
|
||||
if(item != collector_MyTemplatePoint2.end()) {
|
||||
delete self;
|
||||
collector_MyTemplatePoint2.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_accept_T_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("accept_T",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Point2 value = unwrap< Point2 >(in[1]);
|
||||
obj->accept_T(value);
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_accept_Tptr_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("accept_Tptr",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Point2 value = unwrap< Point2 >(in[1]);
|
||||
obj->accept_Tptr(value);
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_create_MixedPtrs_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("create_MixedPtrs",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
auto pairResult = obj->create_MixedPtrs();
|
||||
out[0] = wrap< Point2 >(pairResult.first);
|
||||
{
|
||||
boost::shared_ptr<Point2> shared(pairResult.second);
|
||||
out[1] = wrap_shared_ptr(shared,"Point2");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_create_ptrs_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("create_ptrs",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
auto pairResult = obj->create_ptrs();
|
||||
{
|
||||
boost::shared_ptr<Point2> shared(pairResult.first);
|
||||
out[0] = wrap_shared_ptr(shared,"Point2");
|
||||
}
|
||||
{
|
||||
boost::shared_ptr<Point2> shared(pairResult.second);
|
||||
out[1] = wrap_shared_ptr(shared,"Point2");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_return_T_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_T",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Point2 value = unwrap< Point2 >(in[1]);
|
||||
out[0] = wrap< Point2 >(obj->return_T(value));
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_return_Tptr_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_Tptr",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Point2 value = unwrap< Point2 >(in[1]);
|
||||
{
|
||||
boost::shared_ptr<Point2> shared(obj->return_Tptr(value));
|
||||
out[0] = wrap_shared_ptr(shared,"Point2");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_return_ptrs_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_ptrs",nargout,nargin-1,2);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Point2 p1 = unwrap< Point2 >(in[1]);
|
||||
Point2 p2 = unwrap< Point2 >(in[2]);
|
||||
auto pairResult = obj->return_ptrs(p1,p2);
|
||||
{
|
||||
boost::shared_ptr<Point2> shared(pairResult.first);
|
||||
out[0] = wrap_shared_ptr(shared,"Point2");
|
||||
}
|
||||
{
|
||||
boost::shared_ptr<Point2> shared(pairResult.second);
|
||||
out[1] = wrap_shared_ptr(shared,"Point2");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_templatedMethod_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodMatrix",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Matrix t = unwrap< Matrix >(in[1]);
|
||||
out[0] = wrap< Matrix >(obj->templatedMethod<gtsam::Matrix>(t));
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_templatedMethod_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodPoint2",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Point2 t = unwrap< Point2 >(in[1]);
|
||||
out[0] = wrap< Point2 >(obj->templatedMethod<gtsam::Point2>(t));
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_templatedMethod_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodPoint3",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Point3 t = unwrap< Point3 >(in[1]);
|
||||
out[0] = wrap< Point3 >(obj->templatedMethod<gtsam::Point3>(t));
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_templatedMethod_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodVector",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Point2>>(in[0], "ptr_MyTemplatePoint2");
|
||||
Vector t = unwrap< Vector >(in[1]);
|
||||
out[0] = wrap< Vector >(obj->templatedMethod<gtsam::Vector>(t));
|
||||
}
|
||||
|
||||
void MyTemplatePoint2_Level_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("MyTemplatePoint2.Level",nargout,nargin,1);
|
||||
Point2 K = unwrap< Point2 >(in[0]);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<MyTemplate<Point2>>(MyTemplate<gtsam::Point2>::Level(K)),"MyTemplatePoint2", false);
|
||||
}
|
||||
|
||||
void gtsamPoint3_constructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<gtsam::Point3> Shared;
|
||||
|
||||
double x = unwrap< double >(in[0]);
|
||||
double y = unwrap< double >(in[1]);
|
||||
double z = unwrap< double >(in[2]);
|
||||
Shared *self = new Shared(new gtsam::Point3(x,y,z));
|
||||
collector_gtsamPoint3.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_collectorInsertAndMakeBase_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_MyTemplateMatrix.insert(self);
|
||||
|
||||
typedef boost::shared_ptr<MyBase> SharedBase;
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<SharedBase**>(mxGetData(out[0])) = new SharedBase(*self);
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_constructor_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared;
|
||||
|
||||
Shared *self = new Shared(new MyTemplate<gtsam::Matrix>());
|
||||
collector_MyTemplateMatrix.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
|
||||
typedef boost::shared_ptr<MyBase> SharedBase;
|
||||
out[1] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<SharedBase**>(mxGetData(out[1])) = new SharedBase(*self);
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_deconstructor_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<MyTemplate<gtsam::Matrix>> Shared;
|
||||
checkArguments("delete_MyTemplateMatrix",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_MyTemplateMatrix::iterator item;
|
||||
item = collector_MyTemplateMatrix.find(self);
|
||||
if(item != collector_MyTemplateMatrix.end()) {
|
||||
delete self;
|
||||
collector_MyTemplateMatrix.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_accept_T_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("accept_T",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
obj->accept_T(value);
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_accept_Tptr_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("accept_Tptr",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
obj->accept_Tptr(value);
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_create_MixedPtrs_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("create_MixedPtrs",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
auto pairResult = obj->create_MixedPtrs();
|
||||
out[0] = wrap< Matrix >(pairResult.first);
|
||||
{
|
||||
boost::shared_ptr<Matrix> shared(pairResult.second);
|
||||
out[1] = wrap_shared_ptr(shared,"Matrix");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_create_ptrs_26(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("create_ptrs",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
auto pairResult = obj->create_ptrs();
|
||||
{
|
||||
boost::shared_ptr<Matrix> shared(pairResult.first);
|
||||
out[0] = wrap_shared_ptr(shared,"Matrix");
|
||||
}
|
||||
{
|
||||
boost::shared_ptr<Matrix> shared(pairResult.second);
|
||||
out[1] = wrap_shared_ptr(shared,"Matrix");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_return_T_27(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_T",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
out[0] = wrap< Matrix >(obj->return_T(value));
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_return_Tptr_28(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_Tptr",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Matrix value = unwrap< Matrix >(in[1]);
|
||||
{
|
||||
boost::shared_ptr<Matrix> shared(obj->return_Tptr(value));
|
||||
out[0] = wrap_shared_ptr(shared,"Matrix");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_return_ptrs_29(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("return_ptrs",nargout,nargin-1,2);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Matrix p1 = unwrap< Matrix >(in[1]);
|
||||
Matrix p2 = unwrap< Matrix >(in[2]);
|
||||
auto pairResult = obj->return_ptrs(p1,p2);
|
||||
{
|
||||
boost::shared_ptr<Matrix> shared(pairResult.first);
|
||||
out[0] = wrap_shared_ptr(shared,"Matrix");
|
||||
}
|
||||
{
|
||||
boost::shared_ptr<Matrix> shared(pairResult.second);
|
||||
out[1] = wrap_shared_ptr(shared,"Matrix");
|
||||
}
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_templatedMethod_30(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodMatrix",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Matrix t = unwrap< Matrix >(in[1]);
|
||||
out[0] = wrap< Matrix >(obj->templatedMethod<gtsam::Matrix>(t));
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_templatedMethod_31(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodPoint2",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Point2 t = unwrap< Point2 >(in[1]);
|
||||
out[0] = wrap< Point2 >(obj->templatedMethod<gtsam::Point2>(t));
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_templatedMethod_32(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodPoint3",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Point3 t = unwrap< Point3 >(in[1]);
|
||||
out[0] = wrap< Point3 >(obj->templatedMethod<gtsam::Point3>(t));
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_templatedMethod_33(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("templatedMethodVector",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<MyTemplate<gtsam::Matrix>>(in[0], "ptr_MyTemplateMatrix");
|
||||
Vector t = unwrap< Vector >(in[1]);
|
||||
out[0] = wrap< Vector >(obj->templatedMethod<gtsam::Vector>(t));
|
||||
}
|
||||
|
||||
void MyTemplateMatrix_Level_34(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("MyTemplateMatrix.Level",nargout,nargin,1);
|
||||
Matrix K = unwrap< Matrix >(in[0]);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<MyTemplate<Matrix>>(MyTemplate<gtsam::Matrix>::Level(K)),"MyTemplateMatrix", false);
|
||||
}
|
||||
|
||||
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
_inheritance_RTTIRegister();
|
||||
|
||||
int id = unwrap<int>(in[0]);
|
||||
|
||||
try {
|
||||
switch(id) {
|
||||
case 0:
|
||||
gtsamPoint2_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 1:
|
||||
MyBase_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 2:
|
||||
MyBase_deconstructor_2(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 3:
|
||||
gtsamPoint2_deconstructor_3(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 4:
|
||||
MyTemplatePoint2_collectorInsertAndMakeBase_3(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 5:
|
||||
MyTemplatePoint2_constructor_5(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 6:
|
||||
MyTemplatePoint2_deconstructor_6(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 7:
|
||||
MyTemplatePoint2_accept_T_7(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 8:
|
||||
MyTemplatePoint2_accept_Tptr_8(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 9:
|
||||
MyTemplatePoint2_create_MixedPtrs_9(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 10:
|
||||
MyTemplatePoint2_create_ptrs_10(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 11:
|
||||
MyTemplatePoint2_return_T_11(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 12:
|
||||
MyTemplatePoint2_return_Tptr_12(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 13:
|
||||
MyTemplatePoint2_return_ptrs_13(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 14:
|
||||
MyTemplatePoint2_templatedMethod_14(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 15:
|
||||
MyTemplatePoint2_templatedMethod_15(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 16:
|
||||
MyTemplatePoint2_templatedMethod_16(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 17:
|
||||
MyTemplatePoint2_templatedMethod_17(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 18:
|
||||
MyTemplatePoint2_Level_18(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 19:
|
||||
gtsamPoint3_constructor_19(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 20:
|
||||
MyTemplateMatrix_collectorInsertAndMakeBase_19(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 21:
|
||||
MyTemplateMatrix_constructor_21(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 22:
|
||||
MyTemplateMatrix_deconstructor_22(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 23:
|
||||
MyTemplateMatrix_accept_T_23(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 24:
|
||||
MyTemplateMatrix_accept_Tptr_24(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 25:
|
||||
MyTemplateMatrix_create_MixedPtrs_25(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 26:
|
||||
MyTemplateMatrix_create_ptrs_26(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 27:
|
||||
MyTemplateMatrix_return_T_27(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 28:
|
||||
MyTemplateMatrix_return_Tptr_28(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 29:
|
||||
MyTemplateMatrix_return_ptrs_29(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 30:
|
||||
MyTemplateMatrix_templatedMethod_30(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 31:
|
||||
MyTemplateMatrix_templatedMethod_31(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 32:
|
||||
MyTemplateMatrix_templatedMethod_32(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 33:
|
||||
MyTemplateMatrix_templatedMethod_33(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 34:
|
||||
MyTemplateMatrix_Level_34(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
}
|
||||
} catch(const std::exception& e) {
|
||||
mexErrMsgTxt(("Exception from gtsam:\n" + std::string(e.what()) + "\n").c_str());
|
||||
}
|
||||
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
function varargout = load2D(varargin)
|
||||
if length(varargin) == 5 && isa(varargin{1},'char') && isa(varargin{2},'Test') && isa(varargin{3},'numeric') && isa(varargin{4},'logical') && isa(varargin{5},'logical')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(102, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = functions_wrapper(0, varargin{:});
|
||||
elseif length(varargin) == 5 && isa(varargin{1},'char') && isa(varargin{2},'gtsam.noiseModel.Diagonal') && isa(varargin{3},'numeric') && isa(varargin{4},'logical') && isa(varargin{5},'logical')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(103, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = functions_wrapper(1, varargin{:});
|
||||
elseif length(varargin) == 2 && isa(varargin{1},'char') && isa(varargin{2},'gtsam.noiseModel.Diagonal')
|
||||
[ varargout{1} varargout{2} ] = geometry_wrapper(104, varargin{:});
|
||||
[ varargout{1} varargout{2} ] = functions_wrapper(2, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function load2D');
|
||||
end
|
|
@ -0,0 +1,581 @@
|
|||
#include <gtwrap/matlab.h>
|
||||
#include <map>
|
||||
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
#include <folder/path/to/Test.h>
|
||||
#include <gtsam/geometry/Point2.h>
|
||||
#include <gtsam/geometry/Point3.h>
|
||||
#include <path/to/ns1.h>
|
||||
#include <path/to/ns1/ClassB.h>
|
||||
#include <path/to/ns2.h>
|
||||
#include <path/to/ns2/ClassA.h>
|
||||
#include <path/to/ns3.h>
|
||||
|
||||
typedef Fun<double> FunDouble;
|
||||
typedef PrimitiveRef<double> PrimitiveRefDouble;
|
||||
typedef MyVector<3> MyVector3;
|
||||
typedef MyVector<12> MyVector12;
|
||||
typedef MultipleTemplates<int, double> MultipleTemplatesIntDouble;
|
||||
typedef MultipleTemplates<int, float> MultipleTemplatesIntFloat;
|
||||
typedef MyFactor<gtsam::Pose2, gtsam::Matrix> MyFactorPosePoint2;
|
||||
typedef MyTemplate<gtsam::Point2> MyTemplatePoint2;
|
||||
typedef MyTemplate<gtsam::Matrix> MyTemplateMatrix;
|
||||
|
||||
BOOST_CLASS_EXPORT_GUID(gtsam::Point2, "gtsamPoint2");
|
||||
BOOST_CLASS_EXPORT_GUID(gtsam::Point3, "gtsamPoint3");
|
||||
|
||||
typedef std::set<boost::shared_ptr<FunRange>*> Collector_FunRange;
|
||||
static Collector_FunRange collector_FunRange;
|
||||
typedef std::set<boost::shared_ptr<FunDouble>*> Collector_FunDouble;
|
||||
static Collector_FunDouble collector_FunDouble;
|
||||
typedef std::set<boost::shared_ptr<Test>*> Collector_Test;
|
||||
static Collector_Test collector_Test;
|
||||
typedef std::set<boost::shared_ptr<PrimitiveRefDouble>*> Collector_PrimitiveRefDouble;
|
||||
static Collector_PrimitiveRefDouble collector_PrimitiveRefDouble;
|
||||
typedef std::set<boost::shared_ptr<MyVector3>*> Collector_MyVector3;
|
||||
static Collector_MyVector3 collector_MyVector3;
|
||||
typedef std::set<boost::shared_ptr<MyVector12>*> Collector_MyVector12;
|
||||
static Collector_MyVector12 collector_MyVector12;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntDouble>*> Collector_MultipleTemplatesIntDouble;
|
||||
static Collector_MultipleTemplatesIntDouble collector_MultipleTemplatesIntDouble;
|
||||
typedef std::set<boost::shared_ptr<MultipleTemplatesIntFloat>*> Collector_MultipleTemplatesIntFloat;
|
||||
static Collector_MultipleTemplatesIntFloat collector_MultipleTemplatesIntFloat;
|
||||
typedef std::set<boost::shared_ptr<MyFactorPosePoint2>*> Collector_MyFactorPosePoint2;
|
||||
static Collector_MyFactorPosePoint2 collector_MyFactorPosePoint2;
|
||||
typedef std::set<boost::shared_ptr<gtsam::Point2>*> Collector_gtsamPoint2;
|
||||
static Collector_gtsamPoint2 collector_gtsamPoint2;
|
||||
typedef std::set<boost::shared_ptr<gtsam::Point3>*> Collector_gtsamPoint3;
|
||||
static Collector_gtsamPoint3 collector_gtsamPoint3;
|
||||
typedef std::set<boost::shared_ptr<MyBase>*> Collector_MyBase;
|
||||
static Collector_MyBase collector_MyBase;
|
||||
typedef std::set<boost::shared_ptr<MyTemplatePoint2>*> Collector_MyTemplatePoint2;
|
||||
static Collector_MyTemplatePoint2 collector_MyTemplatePoint2;
|
||||
typedef std::set<boost::shared_ptr<MyTemplateMatrix>*> Collector_MyTemplateMatrix;
|
||||
static Collector_MyTemplateMatrix collector_MyTemplateMatrix;
|
||||
typedef std::set<boost::shared_ptr<ns1::ClassA>*> Collector_ns1ClassA;
|
||||
static Collector_ns1ClassA collector_ns1ClassA;
|
||||
typedef std::set<boost::shared_ptr<ns1::ClassB>*> Collector_ns1ClassB;
|
||||
static Collector_ns1ClassB collector_ns1ClassB;
|
||||
typedef std::set<boost::shared_ptr<ns2::ClassA>*> Collector_ns2ClassA;
|
||||
static Collector_ns2ClassA collector_ns2ClassA;
|
||||
typedef std::set<boost::shared_ptr<ns2::ns3::ClassB>*> Collector_ns2ns3ClassB;
|
||||
static Collector_ns2ns3ClassB collector_ns2ns3ClassB;
|
||||
typedef std::set<boost::shared_ptr<ns2::ClassC>*> Collector_ns2ClassC;
|
||||
static Collector_ns2ClassC collector_ns2ClassC;
|
||||
typedef std::set<boost::shared_ptr<ClassD>*> Collector_ClassD;
|
||||
static Collector_ClassD collector_ClassD;
|
||||
|
||||
void _deleteAllObjects()
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
bool anyDeleted = false;
|
||||
{ for(Collector_FunRange::iterator iter = collector_FunRange.begin();
|
||||
iter != collector_FunRange.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunRange.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_FunDouble::iterator iter = collector_FunDouble.begin();
|
||||
iter != collector_FunDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_FunDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_Test::iterator iter = collector_Test.begin();
|
||||
iter != collector_Test.end(); ) {
|
||||
delete *iter;
|
||||
collector_Test.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_PrimitiveRefDouble::iterator iter = collector_PrimitiveRefDouble.begin();
|
||||
iter != collector_PrimitiveRefDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_PrimitiveRefDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector3::iterator iter = collector_MyVector3.begin();
|
||||
iter != collector_MyVector3.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyVector12::iterator iter = collector_MyVector12.begin();
|
||||
iter != collector_MyVector12.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyVector12.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntDouble::iterator iter = collector_MultipleTemplatesIntDouble.begin();
|
||||
iter != collector_MultipleTemplatesIntDouble.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntDouble.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MultipleTemplatesIntFloat::iterator iter = collector_MultipleTemplatesIntFloat.begin();
|
||||
iter != collector_MultipleTemplatesIntFloat.end(); ) {
|
||||
delete *iter;
|
||||
collector_MultipleTemplatesIntFloat.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyFactorPosePoint2::iterator iter = collector_MyFactorPosePoint2.begin();
|
||||
iter != collector_MyFactorPosePoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyFactorPosePoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_gtsamPoint2::iterator iter = collector_gtsamPoint2.begin();
|
||||
iter != collector_gtsamPoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_gtsamPoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_gtsamPoint3::iterator iter = collector_gtsamPoint3.begin();
|
||||
iter != collector_gtsamPoint3.end(); ) {
|
||||
delete *iter;
|
||||
collector_gtsamPoint3.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyBase::iterator iter = collector_MyBase.begin();
|
||||
iter != collector_MyBase.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyBase.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyTemplatePoint2::iterator iter = collector_MyTemplatePoint2.begin();
|
||||
iter != collector_MyTemplatePoint2.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyTemplatePoint2.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_MyTemplateMatrix::iterator iter = collector_MyTemplateMatrix.begin();
|
||||
iter != collector_MyTemplateMatrix.end(); ) {
|
||||
delete *iter;
|
||||
collector_MyTemplateMatrix.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_ns1ClassA::iterator iter = collector_ns1ClassA.begin();
|
||||
iter != collector_ns1ClassA.end(); ) {
|
||||
delete *iter;
|
||||
collector_ns1ClassA.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_ns1ClassB::iterator iter = collector_ns1ClassB.begin();
|
||||
iter != collector_ns1ClassB.end(); ) {
|
||||
delete *iter;
|
||||
collector_ns1ClassB.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_ns2ClassA::iterator iter = collector_ns2ClassA.begin();
|
||||
iter != collector_ns2ClassA.end(); ) {
|
||||
delete *iter;
|
||||
collector_ns2ClassA.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_ns2ns3ClassB::iterator iter = collector_ns2ns3ClassB.begin();
|
||||
iter != collector_ns2ns3ClassB.end(); ) {
|
||||
delete *iter;
|
||||
collector_ns2ns3ClassB.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_ns2ClassC::iterator iter = collector_ns2ClassC.begin();
|
||||
iter != collector_ns2ClassC.end(); ) {
|
||||
delete *iter;
|
||||
collector_ns2ClassC.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
{ for(Collector_ClassD::iterator iter = collector_ClassD.begin();
|
||||
iter != collector_ClassD.end(); ) {
|
||||
delete *iter;
|
||||
collector_ClassD.erase(iter++);
|
||||
anyDeleted = true;
|
||||
} }
|
||||
if(anyDeleted)
|
||||
cout <<
|
||||
"WARNING: Wrap modules with variables in the workspace have been reloaded due to\n"
|
||||
"calling destructors, call 'clear all' again if you plan to now recompile a wrap\n"
|
||||
"module, so that your recompiled module is used instead of the old one." << endl;
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
||||
|
||||
void _namespaces_RTTIRegister() {
|
||||
const mxArray *alreadyCreated = mexGetVariablePtr("global", "gtsam_namespaces_rttiRegistry_created");
|
||||
if(!alreadyCreated) {
|
||||
std::map<std::string, std::string> types;
|
||||
types.insert(std::make_pair(typeid(MyBase).name(), "MyBase"));
|
||||
types.insert(std::make_pair(typeid(MyTemplatePoint2).name(), "MyTemplatePoint2"));
|
||||
types.insert(std::make_pair(typeid(MyTemplateMatrix).name(), "MyTemplateMatrix"));
|
||||
|
||||
mxArray *registry = mexGetVariable("global", "gtsamwrap_rttiRegistry");
|
||||
if(!registry)
|
||||
registry = mxCreateStructMatrix(1, 1, 0, NULL);
|
||||
typedef std::pair<std::string, std::string> StringPair;
|
||||
for(const StringPair& rtti_matlab: types) {
|
||||
int fieldId = mxAddField(registry, rtti_matlab.first.c_str());
|
||||
if(fieldId < 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxArray *matlabName = mxCreateString(rtti_matlab.second.c_str());
|
||||
mxSetFieldByNumber(registry, 0, fieldId, matlabName);
|
||||
}
|
||||
if(mexPutVariable("global", "gtsamwrap_rttiRegistry", registry) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(registry);
|
||||
|
||||
mxArray *newAlreadyCreated = mxCreateNumericMatrix(0, 0, mxINT8_CLASS, mxREAL);
|
||||
if(mexPutVariable("global", "gtsam_geometry_rttiRegistry_created", newAlreadyCreated) != 0)
|
||||
mexErrMsgTxt("gtsam wrap: Error indexing RTTI types, inheritance will not work correctly");
|
||||
mxDestroyArray(newAlreadyCreated);
|
||||
}
|
||||
}
|
||||
|
||||
void ns1ClassA_collectorInsertAndMakeBase_0(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns1::ClassA> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_ns1ClassA.insert(self);
|
||||
}
|
||||
|
||||
void ns1ClassA_constructor_1(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns1::ClassA> Shared;
|
||||
|
||||
Shared *self = new Shared(new ns1::ClassA());
|
||||
collector_ns1ClassA.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void ns1ClassA_deconstructor_2(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<ns1::ClassA> Shared;
|
||||
checkArguments("delete_ns1ClassA",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_ns1ClassA::iterator item;
|
||||
item = collector_ns1ClassA.find(self);
|
||||
if(item != collector_ns1ClassA.end()) {
|
||||
delete self;
|
||||
collector_ns1ClassA.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ns1ClassB_collectorInsertAndMakeBase_3(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns1::ClassB> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_ns1ClassB.insert(self);
|
||||
}
|
||||
|
||||
void ns1ClassB_constructor_4(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns1::ClassB> Shared;
|
||||
|
||||
Shared *self = new Shared(new ns1::ClassB());
|
||||
collector_ns1ClassB.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void ns1ClassB_deconstructor_5(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<ns1::ClassB> Shared;
|
||||
checkArguments("delete_ns1ClassB",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_ns1ClassB::iterator item;
|
||||
item = collector_ns1ClassB.find(self);
|
||||
if(item != collector_ns1ClassB.end()) {
|
||||
delete self;
|
||||
collector_ns1ClassB.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void aGlobalFunction_6(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("aGlobalFunction",nargout,nargin,0);
|
||||
out[0] = wrap< Vector >(ns1::aGlobalFunction());
|
||||
}
|
||||
void ns2ClassA_collectorInsertAndMakeBase_7(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns2::ClassA> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_ns2ClassA.insert(self);
|
||||
}
|
||||
|
||||
void ns2ClassA_constructor_8(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns2::ClassA> Shared;
|
||||
|
||||
Shared *self = new Shared(new ns2::ClassA());
|
||||
collector_ns2ClassA.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void ns2ClassA_deconstructor_9(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<ns2::ClassA> Shared;
|
||||
checkArguments("delete_ns2ClassA",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_ns2ClassA::iterator item;
|
||||
item = collector_ns2ClassA.find(self);
|
||||
if(item != collector_ns2ClassA.end()) {
|
||||
delete self;
|
||||
collector_ns2ClassA.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ns2ClassA_memberFunction_10(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("memberFunction",nargout,nargin-1,0);
|
||||
auto obj = unwrap_shared_ptr<ns2::ClassA>(in[0], "ptr_ns2ClassA");
|
||||
out[0] = wrap< double >(obj->memberFunction());
|
||||
}
|
||||
|
||||
void ns2ClassA_nsArg_11(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("nsArg",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<ns2::ClassA>(in[0], "ptr_ns2ClassA");
|
||||
ns1::ClassB& arg = *unwrap_shared_ptr< ns1::ClassB >(in[1], "ptr_ns1ClassB");
|
||||
out[0] = wrap< int >(obj->nsArg(arg));
|
||||
}
|
||||
|
||||
void ns2ClassA_nsReturn_12(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("nsReturn",nargout,nargin-1,1);
|
||||
auto obj = unwrap_shared_ptr<ns2::ClassA>(in[0], "ptr_ns2ClassA");
|
||||
double q = unwrap< double >(in[1]);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<ns2::ns3::ClassB>(obj->nsReturn(q)),"ns2.ns3.ClassB", false);
|
||||
}
|
||||
|
||||
void ns2ClassA_afunction_13(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("ns2ClassA.afunction",nargout,nargin,0);
|
||||
out[0] = wrap< double >(ns2::ClassA::afunction());
|
||||
}
|
||||
|
||||
void ns2ns3ClassB_collectorInsertAndMakeBase_14(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns2::ns3::ClassB> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_ns2ns3ClassB.insert(self);
|
||||
}
|
||||
|
||||
void ns2ns3ClassB_constructor_15(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns2::ns3::ClassB> Shared;
|
||||
|
||||
Shared *self = new Shared(new ns2::ns3::ClassB());
|
||||
collector_ns2ns3ClassB.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void ns2ns3ClassB_deconstructor_16(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<ns2::ns3::ClassB> Shared;
|
||||
checkArguments("delete_ns2ns3ClassB",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_ns2ns3ClassB::iterator item;
|
||||
item = collector_ns2ns3ClassB.find(self);
|
||||
if(item != collector_ns2ns3ClassB.end()) {
|
||||
delete self;
|
||||
collector_ns2ns3ClassB.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ns2ClassC_collectorInsertAndMakeBase_17(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns2::ClassC> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_ns2ClassC.insert(self);
|
||||
}
|
||||
|
||||
void ns2ClassC_constructor_18(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ns2::ClassC> Shared;
|
||||
|
||||
Shared *self = new Shared(new ns2::ClassC());
|
||||
collector_ns2ClassC.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void ns2ClassC_deconstructor_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<ns2::ClassC> Shared;
|
||||
checkArguments("delete_ns2ClassC",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_ns2ClassC::iterator item;
|
||||
item = collector_ns2ClassC.find(self);
|
||||
if(item != collector_ns2ClassC.end()) {
|
||||
delete self;
|
||||
collector_ns2ClassC.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
void aGlobalFunction_20(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("aGlobalFunction",nargout,nargin,0);
|
||||
out[0] = wrap< Vector >(ns2::aGlobalFunction());
|
||||
}
|
||||
void overloadedGlobalFunction_21(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("overloadedGlobalFunction",nargout,nargin,1);
|
||||
ns1::ClassA& a = *unwrap_shared_ptr< ns1::ClassA >(in[0], "ptr_ns1ClassA");
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<ns1::ClassA>(ns2::overloadedGlobalFunction(a)),"ns1.ClassA", false);
|
||||
}
|
||||
void overloadedGlobalFunction_22(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
checkArguments("overloadedGlobalFunction",nargout,nargin,2);
|
||||
ns1::ClassA& a = *unwrap_shared_ptr< ns1::ClassA >(in[0], "ptr_ns1ClassA");
|
||||
double b = unwrap< double >(in[1]);
|
||||
out[0] = wrap_shared_ptr(boost::make_shared<ns1::ClassA>(ns2::overloadedGlobalFunction(a,b)),"ns1.ClassA", false);
|
||||
}
|
||||
void ClassD_collectorInsertAndMakeBase_23(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ClassD> Shared;
|
||||
|
||||
Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
|
||||
collector_ClassD.insert(self);
|
||||
}
|
||||
|
||||
void ClassD_constructor_24(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mexAtExit(&_deleteAllObjects);
|
||||
typedef boost::shared_ptr<ClassD> Shared;
|
||||
|
||||
Shared *self = new Shared(new ClassD());
|
||||
collector_ClassD.insert(self);
|
||||
out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
|
||||
*reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
|
||||
}
|
||||
|
||||
void ClassD_deconstructor_25(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
typedef boost::shared_ptr<ClassD> Shared;
|
||||
checkArguments("delete_ClassD",nargout,nargin,1);
|
||||
Shared *self = *reinterpret_cast<Shared**>(mxGetData(in[0]));
|
||||
Collector_ClassD::iterator item;
|
||||
item = collector_ClassD.find(self);
|
||||
if(item != collector_ClassD.end()) {
|
||||
delete self;
|
||||
collector_ClassD.erase(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
|
||||
{
|
||||
mstream mout;
|
||||
std::streambuf *outbuf = std::cout.rdbuf(&mout);
|
||||
|
||||
_namespaces_RTTIRegister();
|
||||
|
||||
int id = unwrap<int>(in[0]);
|
||||
|
||||
try {
|
||||
switch(id) {
|
||||
case 0:
|
||||
ns1ClassA_collectorInsertAndMakeBase_0(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 1:
|
||||
ns1ClassA_constructor_1(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 2:
|
||||
ns1ClassA_deconstructor_2(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 3:
|
||||
ns1ClassB_collectorInsertAndMakeBase_3(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 4:
|
||||
ns1ClassB_constructor_4(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 5:
|
||||
ns1ClassB_deconstructor_5(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 6:
|
||||
aGlobalFunction_6(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 7:
|
||||
ns2ClassA_collectorInsertAndMakeBase_7(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 8:
|
||||
ns2ClassA_constructor_8(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 9:
|
||||
ns2ClassA_deconstructor_9(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 10:
|
||||
ns2ClassA_memberFunction_10(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 11:
|
||||
ns2ClassA_nsArg_11(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 12:
|
||||
ns2ClassA_nsReturn_12(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 13:
|
||||
ns2ClassA_afunction_13(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 14:
|
||||
ns2ns3ClassB_collectorInsertAndMakeBase_14(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 15:
|
||||
ns2ns3ClassB_constructor_15(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 16:
|
||||
ns2ns3ClassB_deconstructor_16(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 17:
|
||||
ns2ClassC_collectorInsertAndMakeBase_17(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 18:
|
||||
ns2ClassC_constructor_18(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 19:
|
||||
ns2ClassC_deconstructor_19(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 20:
|
||||
aGlobalFunction_20(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 21:
|
||||
overloadedGlobalFunction_21(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 22:
|
||||
overloadedGlobalFunction_22(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 23:
|
||||
ClassD_collectorInsertAndMakeBase_23(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 24:
|
||||
ClassD_constructor_24(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
case 25:
|
||||
ClassD_deconstructor_25(nargout, out, nargin-1, in+1);
|
||||
break;
|
||||
}
|
||||
} catch(const std::exception& e) {
|
||||
mexErrMsgTxt(("Exception from gtsam:\n" + std::string(e.what()) + "\n").c_str());
|
||||
}
|
||||
|
||||
std::cout.rdbuf(outbuf);
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
function varargout = overloadedGlobalFunction(varargin)
|
||||
if length(varargin) == 1 && isa(varargin{1},'numeric')
|
||||
varargout{1} = geometry_wrapper(106, varargin{:});
|
||||
varargout{1} = functions_wrapper(4, varargin{:});
|
||||
elseif length(varargin) == 2 && isa(varargin{1},'numeric') && isa(varargin{2},'double')
|
||||
varargout{1} = geometry_wrapper(107, varargin{:});
|
||||
varargout{1} = functions_wrapper(5, varargin{:});
|
||||
else
|
||||
error('Arguments do not match any overload of function overloadedGlobalFunction');
|
||||
end
|
|
@ -0,0 +1,86 @@
|
|||
|
||||
|
||||
#include <pybind11/eigen.h>
|
||||
#include <pybind11/stl_bind.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include "gtsam/nonlinear/utilities.h" // for RedirectCout.
|
||||
|
||||
#include "folder/path/to/Test.h"
|
||||
|
||||
#include "wrap/serialization.h"
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(class_py, m_) {
|
||||
m_.doc() = "pybind11 wrapper of class_py";
|
||||
|
||||
|
||||
py::class_<FunRange, std::shared_ptr<FunRange>>(m_, "FunRange")
|
||||
.def(py::init<>())
|
||||
.def("range",[](FunRange* self, double d){return self->range(d);}, py::arg("d"))
|
||||
.def_static("create",[](){return FunRange::create();});
|
||||
|
||||
py::class_<Fun<double>, std::shared_ptr<Fun<double>>>(m_, "FunDouble")
|
||||
.def("dhamaalString",[](Fun<double>* self, double d, string t){return self->dhamaal<string>(d, t);}, py::arg("d"), py::arg("t"))
|
||||
.def_static("divertido",[](){return Fun<double>::divertido();});
|
||||
|
||||
py::class_<Test, std::shared_ptr<Test>>(m_, "Test")
|
||||
.def(py::init<>())
|
||||
.def(py::init<double, const gtsam::Matrix&>(), py::arg("a"), py::arg("b"))
|
||||
.def("return_pair",[](Test* self, const gtsam::Vector& v, const gtsam::Matrix& A){return self->return_pair(v, A);}, py::arg("v"), py::arg("A"))
|
||||
.def("return_pair",[](Test* self, const gtsam::Vector& v){return self->return_pair(v);}, py::arg("v"))
|
||||
.def("return_bool",[](Test* self, bool value){return self->return_bool(value);}, py::arg("value"))
|
||||
.def("return_size_t",[](Test* self, size_t value){return self->return_size_t(value);}, py::arg("value"))
|
||||
.def("return_int",[](Test* self, int value){return self->return_int(value);}, py::arg("value"))
|
||||
.def("return_double",[](Test* self, double value){return self->return_double(value);}, py::arg("value"))
|
||||
.def("return_string",[](Test* self, string value){return self->return_string(value);}, py::arg("value"))
|
||||
.def("return_vector1",[](Test* self, const gtsam::Vector& value){return self->return_vector1(value);}, py::arg("value"))
|
||||
.def("return_matrix1",[](Test* self, const gtsam::Matrix& value){return self->return_matrix1(value);}, py::arg("value"))
|
||||
.def("return_vector2",[](Test* self, const gtsam::Vector& value){return self->return_vector2(value);}, py::arg("value"))
|
||||
.def("return_matrix2",[](Test* self, const gtsam::Matrix& value){return self->return_matrix2(value);}, py::arg("value"))
|
||||
.def("arg_EigenConstRef",[](Test* self, const gtsam::Matrix& value){ self->arg_EigenConstRef(value);}, py::arg("value"))
|
||||
.def("return_field",[](Test* self, const Test& t){return self->return_field(t);}, py::arg("t"))
|
||||
.def("return_TestPtr",[](Test* self, const std::shared_ptr<Test>& value){return self->return_TestPtr(value);}, py::arg("value"))
|
||||
.def("return_Test",[](Test* self, std::shared_ptr<Test>& value){return self->return_Test(value);}, py::arg("value"))
|
||||
.def("return_Point2Ptr",[](Test* self, bool value){return self->return_Point2Ptr(value);}, py::arg("value"))
|
||||
.def("create_ptrs",[](Test* self){return self->create_ptrs();})
|
||||
.def("create_MixedPtrs",[](Test* self){return self->create_MixedPtrs();})
|
||||
.def("return_ptrs",[](Test* self, std::shared_ptr<Test>& p1, std::shared_ptr<Test>& p2){return self->return_ptrs(p1, p2);}, py::arg("p1"), py::arg("p2"))
|
||||
.def("print_",[](Test* self){ self->print();})
|
||||
.def("__repr__",
|
||||
[](const Test &a) {
|
||||
gtsam::RedirectCout redirect;
|
||||
a.print();
|
||||
return redirect.str();
|
||||
})
|
||||
.def_readwrite("model_ptr", &Test::model_ptr);
|
||||
|
||||
py::class_<PrimitiveRef<double>, std::shared_ptr<PrimitiveRef<double>>>(m_, "PrimitiveRefDouble")
|
||||
.def(py::init<>())
|
||||
.def_static("Brutal",[](const double& t){return PrimitiveRef<double>::Brutal(t);}, py::arg("t"));
|
||||
|
||||
py::class_<MyVector<3>, std::shared_ptr<MyVector<3>>>(m_, "MyVector3")
|
||||
.def(py::init<>());
|
||||
|
||||
py::class_<MyVector<12>, std::shared_ptr<MyVector<12>>>(m_, "MyVector12")
|
||||
.def(py::init<>());
|
||||
|
||||
py::class_<MultipleTemplates<int, double>, std::shared_ptr<MultipleTemplates<int, double>>>(m_, "MultipleTemplatesIntDouble");
|
||||
|
||||
py::class_<MultipleTemplates<int, float>, std::shared_ptr<MultipleTemplates<int, float>>>(m_, "MultipleTemplatesIntFloat");
|
||||
|
||||
py::class_<MyFactor<gtsam::Pose2, gtsam::Matrix>, std::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>>>(m_, "MyFactorPosePoint2")
|
||||
.def(py::init<size_t, size_t, double, const std::shared_ptr<gtsam::noiseModel::Base>&>(), py::arg("key1"), py::arg("key2"), py::arg("measured"), py::arg("noiseModel"));
|
||||
|
||||
|
||||
#include "python/specializations.h"
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
|
||||
#include <pybind11/eigen.h>
|
||||
#include <pybind11/stl_bind.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include "gtsam/nonlinear/utilities.h" // for RedirectCout.
|
||||
|
||||
|
||||
#include "wrap/serialization.h"
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(functions_py, m_) {
|
||||
m_.doc() = "pybind11 wrapper of functions_py";
|
||||
|
||||
|
||||
m_.def("load2D",[](string filename, std::shared_ptr<Test>& model, int maxID, bool addNoise, bool smart){return ::load2D(filename, model, maxID, addNoise, smart);}, py::arg("filename"), py::arg("model"), py::arg("maxID"), py::arg("addNoise"), py::arg("smart"));
|
||||
m_.def("load2D",[](string filename, const std::shared_ptr<gtsam::noiseModel::Diagonal>& model, int maxID, bool addNoise, bool smart){return ::load2D(filename, model, maxID, addNoise, smart);}, py::arg("filename"), py::arg("model"), py::arg("maxID"), py::arg("addNoise"), py::arg("smart"));
|
||||
m_.def("load2D",[](string filename, gtsam::noiseModel::Diagonal* model){return ::load2D(filename, model);}, py::arg("filename"), py::arg("model"));
|
||||
m_.def("aGlobalFunction",[](){return ::aGlobalFunction();});
|
||||
m_.def("overloadedGlobalFunction",[](int a){return ::overloadedGlobalFunction(a);}, py::arg("a"));
|
||||
m_.def("overloadedGlobalFunction",[](int a, double b){return ::overloadedGlobalFunction(a, b);}, py::arg("a"), py::arg("b"));
|
||||
m_.def("MultiTemplatedFunctionStringSize_tDouble",[](const T& x, size_t y){return ::MultiTemplatedFunction<string,size_t,double>(x, y);}, py::arg("x"), py::arg("y"));
|
||||
m_.def("MultiTemplatedFunctionDoubleSize_tDouble",[](const T& x, size_t y){return ::MultiTemplatedFunction<double,size_t,double>(x, y);}, py::arg("x"), py::arg("y"));
|
||||
m_.def("TemplatedFunctionRot3",[](const gtsam::Rot3& t){ ::TemplatedFunction<Rot3>(t);}, py::arg("t"));
|
||||
|
||||
#include "python/specializations.h"
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
|
||||
|
||||
#include <pybind11/eigen.h>
|
||||
#include <pybind11/stl_bind.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include "gtsam/nonlinear/utilities.h" // for RedirectCout.
|
||||
|
||||
#include "gtsam/geometry/Point2.h"
|
||||
#include "gtsam/geometry/Point3.h"
|
||||
|
||||
#include "wrap/serialization.h"
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
BOOST_CLASS_EXPORT(gtsam::Point2)
|
||||
BOOST_CLASS_EXPORT(gtsam::Point3)
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(geometry_py, m_) {
|
||||
m_.doc() = "pybind11 wrapper of geometry_py";
|
||||
|
||||
pybind11::module m_gtsam = m_.def_submodule("gtsam", "gtsam submodule");
|
||||
|
||||
py::class_<gtsam::Point2, std::shared_ptr<gtsam::Point2>>(m_gtsam, "Point2")
|
||||
.def(py::init<>())
|
||||
.def(py::init<double, double>(), py::arg("x"), py::arg("y"))
|
||||
.def("x",[](gtsam::Point2* self){return self->x();})
|
||||
.def("y",[](gtsam::Point2* self){return self->y();})
|
||||
.def("dim",[](gtsam::Point2* self){return self->dim();})
|
||||
.def("returnChar",[](gtsam::Point2* self){return self->returnChar();})
|
||||
.def("argChar",[](gtsam::Point2* self, char a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, std::shared_ptr<char>& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, char& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, char* a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, const std::shared_ptr<char>& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, const char& a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argChar",[](gtsam::Point2* self, const char* a){ self->argChar(a);}, py::arg("a"))
|
||||
.def("argUChar",[](gtsam::Point2* self, unsigned char a){ self->argUChar(a);}, py::arg("a"))
|
||||
.def("eigenArguments",[](gtsam::Point2* self, const gtsam::Vector& v, const gtsam::Matrix& m){ self->eigenArguments(v, m);}, py::arg("v"), py::arg("m"))
|
||||
.def("vectorConfusion",[](gtsam::Point2* self){return self->vectorConfusion();})
|
||||
.def("serialize", [](gtsam::Point2* self){ return gtsam::serialize(*self); })
|
||||
.def("deserialize", [](gtsam::Point2* self, string serialized){ gtsam::deserialize(serialized, *self); }, py::arg("serialized"))
|
||||
.def(py::pickle(
|
||||
[](const gtsam::Point2 &a){ /* __getstate__: Returns a string that encodes the state of the object */ return py::make_tuple(gtsam::serialize(a)); },
|
||||
[](py::tuple t){ /* __setstate__ */ gtsam::Point2 obj; gtsam::deserialize(t[0].cast<std::string>(), obj); return obj; }));
|
||||
|
||||
py::class_<gtsam::Point3, std::shared_ptr<gtsam::Point3>>(m_gtsam, "Point3")
|
||||
.def(py::init<double, double, double>(), py::arg("x"), py::arg("y"), py::arg("z"))
|
||||
.def("norm",[](gtsam::Point3* self){return self->norm();})
|
||||
.def("serialize", [](gtsam::Point3* self){ return gtsam::serialize(*self); })
|
||||
.def("deserialize", [](gtsam::Point3* self, string serialized){ gtsam::deserialize(serialized, *self); }, py::arg("serialized"))
|
||||
.def(py::pickle(
|
||||
[](const gtsam::Point3 &a){ /* __getstate__: Returns a string that encodes the state of the object */ return py::make_tuple(gtsam::serialize(a)); },
|
||||
[](py::tuple t){ /* __setstate__ */ gtsam::Point3 obj; gtsam::deserialize(t[0].cast<std::string>(), obj); return obj; }))
|
||||
.def_static("staticFunction",[](){return gtsam::Point3::staticFunction();})
|
||||
.def_static("StaticFunctionRet",[](double z){return gtsam::Point3::StaticFunctionRet(z);}, py::arg("z"));
|
||||
|
||||
|
||||
#include "python/specializations.h"
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
|
||||
#include <pybind11/eigen.h>
|
||||
#include <pybind11/stl_bind.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include "gtsam/nonlinear/utilities.h" // for RedirectCout.
|
||||
|
||||
|
||||
#include "wrap/serialization.h"
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(inheritance_py, m_) {
|
||||
m_.doc() = "pybind11 wrapper of inheritance_py";
|
||||
|
||||
|
||||
py::class_<MyBase, std::shared_ptr<MyBase>>(m_, "MyBase");
|
||||
|
||||
py::class_<MyTemplate<gtsam::Point2>, MyBase, std::shared_ptr<MyTemplate<gtsam::Point2>>>(m_, "MyTemplatePoint2")
|
||||
.def(py::init<>())
|
||||
.def("templatedMethodPoint2",[](MyTemplate<gtsam::Point2>* self, const gtsam::Point2& t){return self->templatedMethod<gtsam::Point2>(t);}, py::arg("t"))
|
||||
.def("templatedMethodPoint3",[](MyTemplate<gtsam::Point2>* self, const gtsam::Point3& t){return self->templatedMethod<gtsam::Point3>(t);}, py::arg("t"))
|
||||
.def("templatedMethodVector",[](MyTemplate<gtsam::Point2>* self, const gtsam::Vector& t){return self->templatedMethod<gtsam::Vector>(t);}, py::arg("t"))
|
||||
.def("templatedMethodMatrix",[](MyTemplate<gtsam::Point2>* self, const gtsam::Matrix& t){return self->templatedMethod<gtsam::Matrix>(t);}, py::arg("t"))
|
||||
.def("accept_T",[](MyTemplate<gtsam::Point2>* self, const gtsam::Point2& value){ self->accept_T(value);}, py::arg("value"))
|
||||
.def("accept_Tptr",[](MyTemplate<gtsam::Point2>* self, std::shared_ptr<gtsam::Point2>& value){ self->accept_Tptr(value);}, py::arg("value"))
|
||||
.def("return_Tptr",[](MyTemplate<gtsam::Point2>* self, std::shared_ptr<gtsam::Point2>& value){return self->return_Tptr(value);}, py::arg("value"))
|
||||
.def("return_T",[](MyTemplate<gtsam::Point2>* self, gtsam::Point2* value){return self->return_T(value);}, py::arg("value"))
|
||||
.def("create_ptrs",[](MyTemplate<gtsam::Point2>* self){return self->create_ptrs();})
|
||||
.def("create_MixedPtrs",[](MyTemplate<gtsam::Point2>* self){return self->create_MixedPtrs();})
|
||||
.def("return_ptrs",[](MyTemplate<gtsam::Point2>* self, std::shared_ptr<gtsam::Point2>& p1, std::shared_ptr<gtsam::Point2>& p2){return self->return_ptrs(p1, p2);}, py::arg("p1"), py::arg("p2"))
|
||||
.def_static("Level",[](const gtsam::Point2& K){return MyTemplate<gtsam::Point2>::Level(K);}, py::arg("K"));
|
||||
|
||||
py::class_<MyTemplate<gtsam::Matrix>, MyBase, std::shared_ptr<MyTemplate<gtsam::Matrix>>>(m_, "MyTemplateMatrix")
|
||||
.def(py::init<>())
|
||||
.def("templatedMethodPoint2",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Point2& t){return self->templatedMethod<gtsam::Point2>(t);}, py::arg("t"))
|
||||
.def("templatedMethodPoint3",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Point3& t){return self->templatedMethod<gtsam::Point3>(t);}, py::arg("t"))
|
||||
.def("templatedMethodVector",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Vector& t){return self->templatedMethod<gtsam::Vector>(t);}, py::arg("t"))
|
||||
.def("templatedMethodMatrix",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Matrix& t){return self->templatedMethod<gtsam::Matrix>(t);}, py::arg("t"))
|
||||
.def("accept_T",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Matrix& value){ self->accept_T(value);}, py::arg("value"))
|
||||
.def("accept_Tptr",[](MyTemplate<gtsam::Matrix>* self, const std::shared_ptr<gtsam::Matrix>& value){ self->accept_Tptr(value);}, py::arg("value"))
|
||||
.def("return_Tptr",[](MyTemplate<gtsam::Matrix>* self, const std::shared_ptr<gtsam::Matrix>& value){return self->return_Tptr(value);}, py::arg("value"))
|
||||
.def("return_T",[](MyTemplate<gtsam::Matrix>* self, const gtsam::Matrix* value){return self->return_T(value);}, py::arg("value"))
|
||||
.def("create_ptrs",[](MyTemplate<gtsam::Matrix>* self){return self->create_ptrs();})
|
||||
.def("create_MixedPtrs",[](MyTemplate<gtsam::Matrix>* self){return self->create_MixedPtrs();})
|
||||
.def("return_ptrs",[](MyTemplate<gtsam::Matrix>* self, const std::shared_ptr<gtsam::Matrix>& p1, const std::shared_ptr<gtsam::Matrix>& p2){return self->return_ptrs(p1, p2);}, py::arg("p1"), py::arg("p2"))
|
||||
.def_static("Level",[](const gtsam::Matrix& K){return MyTemplate<gtsam::Matrix>::Level(K);}, py::arg("K"));
|
||||
|
||||
|
||||
#include "python/specializations.h"
|
||||
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@ using namespace std;
|
|||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(testNamespaces_py, m_) {
|
||||
m_.doc() = "pybind11 wrapper of testNamespaces_py";
|
||||
PYBIND11_MODULE(namespaces_py, m_) {
|
||||
m_.doc() = "pybind11 wrapper of namespaces_py";
|
||||
|
||||
pybind11::module m_ns1 = m_.def_submodule("ns1", "ns1 submodule");
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
class FunRange {
|
||||
FunRange();
|
||||
This range(double d);
|
||||
|
||||
static This create();
|
||||
};
|
||||
|
||||
template<M={double}>
|
||||
class Fun {
|
||||
static This divertido();
|
||||
|
||||
template<T={string}>
|
||||
This dhamaal(double d, T t);
|
||||
|
||||
// template<T={string}, U={size_t}>
|
||||
// This pret(double d, T t, U u);
|
||||
};
|
||||
|
||||
|
||||
// An include! Can go anywhere outside of a class, in any order
|
||||
#include <folder/path/to/Test.h>
|
||||
|
||||
class Test {
|
||||
|
||||
/* a comment! */
|
||||
// another comment
|
||||
Test();
|
||||
|
||||
// Test a shared ptr property
|
||||
gtsam::noiseModel::Base* model_ptr;
|
||||
|
||||
pair<Vector,Matrix> return_pair (Vector v, Matrix A) const; // intentionally the first method
|
||||
pair<Vector,Matrix> return_pair (Vector v) const; // overload
|
||||
|
||||
bool return_bool (bool value) const; // comment after a line!
|
||||
size_t return_size_t (size_t value) const;
|
||||
int return_int (int value) const;
|
||||
double return_double (double value) const;
|
||||
|
||||
Test(double a, Matrix b); // a constructor in the middle of a class
|
||||
|
||||
// comments in the middle!
|
||||
|
||||
// (more) comments in the middle!
|
||||
|
||||
string return_string (string value) const;
|
||||
Vector return_vector1(Vector value) const;
|
||||
Matrix return_matrix1(Matrix value) const;
|
||||
Vector return_vector2(Vector value) const;
|
||||
Matrix return_matrix2(Matrix value) const;
|
||||
void arg_EigenConstRef(const Matrix& value) const;
|
||||
|
||||
bool return_field(const Test& t) const;
|
||||
|
||||
Test* return_TestPtr(const Test* value) const;
|
||||
Test return_Test(Test* value) const;
|
||||
|
||||
gtsam::Point2* return_Point2Ptr(bool value) const;
|
||||
|
||||
pair<Test*,Test*> create_ptrs () const;
|
||||
pair<Test ,Test*> create_MixedPtrs () const;
|
||||
pair<Test*,Test*> return_ptrs (Test* p1, Test* p2) const;
|
||||
|
||||
void print() const;
|
||||
|
||||
// comments at the end!
|
||||
|
||||
// even more comments at the end!
|
||||
};
|
||||
|
||||
virtual class ns::OtherClass;
|
||||
|
||||
// A doubly templated class
|
||||
template<POSE, POINT>
|
||||
class MyFactor {
|
||||
MyFactor(size_t key1, size_t key2, double measured, const gtsam::noiseModel::Base* noiseModel);
|
||||
};
|
||||
|
||||
// and a typedef specializing it
|
||||
typedef MyFactor<gtsam::Pose2, Matrix> MyFactorPosePoint2;
|
||||
|
||||
template<T = {double}>
|
||||
class PrimitiveRef {
|
||||
PrimitiveRef();
|
||||
|
||||
static This Brutal(const T& t);
|
||||
};
|
||||
|
||||
// A class with integer template arguments
|
||||
template<N = {3,12}>
|
||||
class MyVector {
|
||||
MyVector();
|
||||
};
|
||||
|
||||
// comments at the end!
|
||||
|
||||
// even more comments at the end!
|
||||
|
||||
// Class with multiple instantiated templates
|
||||
template<T = {int}, U = {double, float}>
|
||||
class MultipleTemplates {};
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* A multi-line comment!
|
||||
*/
|
||||
// another comment
|
||||
|
||||
class gtsam::NonlinearFactorGraph;
|
||||
class gtsam::Values;
|
||||
class gtsam::noiseModel::Diagonal;
|
||||
|
||||
pair<gtsam::NonlinearFactorGraph*, gtsam::Values*> load2D(string filename, Test* model, int maxID, bool addNoise, bool smart);
|
||||
pair<gtsam::NonlinearFactorGraph*, gtsam::Values*> load2D(string filename, const gtsam::noiseModel::Diagonal* model, int maxID, bool addNoise, bool smart);
|
||||
pair<gtsam::NonlinearFactorGraph*, gtsam::Values*> load2D(string filename, gtsam::noiseModel::Diagonal@ model);
|
||||
|
||||
Vector aGlobalFunction();
|
||||
|
||||
// An overloaded global function
|
||||
Vector overloadedGlobalFunction(int a);
|
||||
Vector overloadedGlobalFunction(int a, double b);
|
||||
|
||||
// A templated free/global function. Multiple templates supported.
|
||||
template<T1 = {string, double}, T2 = {size_t}, R = {double}>
|
||||
R MultiTemplatedFunction(const T& x, T2 y);
|
||||
|
||||
// Check if we can typedef the templated function
|
||||
template<T>
|
||||
void TemplatedFunction(const T& t);
|
||||
|
||||
typedef TemplatedFunction<gtsam::Rot3> TemplatedFunctionRot3;
|
|
@ -0,0 +1,49 @@
|
|||
// comments!
|
||||
|
||||
class VectorNotEigen;
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
#include <gtsam/geometry/Point2.h>
|
||||
class Point2 {
|
||||
Point2();
|
||||
Point2(double x, double y);
|
||||
double x() const;
|
||||
double y() const;
|
||||
int dim() const;
|
||||
char returnChar() const;
|
||||
void argChar(char a) const;
|
||||
void argChar(char* a) const;
|
||||
void argChar(char& a) const;
|
||||
void argChar(char@ a) const;
|
||||
void argChar(const char* a) const;
|
||||
void argChar(const char& a) const;
|
||||
void argChar(const char@ a) const;
|
||||
void argUChar(unsigned char a) const;
|
||||
void eigenArguments(Vector v, Matrix m) const;
|
||||
VectorNotEigen vectorConfusion();
|
||||
|
||||
void serializable() const; // Sets flag and creates export, but does not make serialization functions
|
||||
|
||||
// enable pickling in python
|
||||
void pickle() const;
|
||||
};
|
||||
|
||||
#include <gtsam/geometry/Point3.h>
|
||||
class Point3 {
|
||||
Point3(double x, double y, double z);
|
||||
double norm() const;
|
||||
|
||||
// static functions - use static keyword and uppercase
|
||||
static double staticFunction();
|
||||
static gtsam::Point3 StaticFunctionRet(double z);
|
||||
|
||||
// enabling serialization functionality
|
||||
void serialize() const; // Just triggers a flag internally and removes actual function
|
||||
|
||||
// enable pickling in python
|
||||
void pickle() const;
|
||||
};
|
||||
|
||||
}
|
||||
// another comment
|
|
@ -0,0 +1,24 @@
|
|||
// A base class
|
||||
virtual class MyBase {
|
||||
|
||||
};
|
||||
|
||||
// A templated class
|
||||
template<T = {gtsam::Point2, Matrix}>
|
||||
virtual class MyTemplate : MyBase {
|
||||
MyTemplate();
|
||||
|
||||
template<ARG = {gtsam::Point2, gtsam::Point3, Vector, Matrix}>
|
||||
ARG templatedMethod(const ARG& t);
|
||||
|
||||
// Stress test templates and pointer combinations
|
||||
void accept_T(const T& value) const;
|
||||
void accept_Tptr(T* value) const;
|
||||
T* return_Tptr(T* value) const;
|
||||
T return_T(T@ value) const;
|
||||
pair<T*,T*> create_ptrs () const;
|
||||
pair<T ,T*> create_MixedPtrs () const;
|
||||
pair<T*,T*> return_ptrs (T* p1, T* p2) const;
|
||||
|
||||
static This Level(const T& K);
|
||||
};
|
|
@ -1,185 +0,0 @@
|
|||
// comments!
|
||||
|
||||
class VectorNotEigen;
|
||||
virtual class ns::OtherClass;
|
||||
class gtsam::NonlinearFactorGraph;
|
||||
class gtsam::Values;
|
||||
class gtsam::noiseModel::Diagonal;
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
#include <gtsam/geometry/Point2.h>
|
||||
class Point2 {
|
||||
Point2();
|
||||
Point2(double x, double y);
|
||||
double x() const;
|
||||
double y() const;
|
||||
int dim() const;
|
||||
char returnChar() const;
|
||||
void argChar(char a) const;
|
||||
void argChar(char* a) const;
|
||||
void argChar(char& a) const;
|
||||
void argChar(char@ a) const;
|
||||
void argChar(const char* a) const;
|
||||
void argChar(const char& a) const;
|
||||
void argChar(const char@ a) const;
|
||||
void argUChar(unsigned char a) const;
|
||||
void eigenArguments(Vector v, Matrix m) const;
|
||||
VectorNotEigen vectorConfusion();
|
||||
|
||||
void serializable() const; // Sets flag and creates export, but does not make serialization functions
|
||||
|
||||
// enable pickling in python
|
||||
void pickle() const;
|
||||
};
|
||||
|
||||
#include <gtsam/geometry/Point3.h>
|
||||
class Point3 {
|
||||
Point3(double x, double y, double z);
|
||||
double norm() const;
|
||||
|
||||
// static functions - use static keyword and uppercase
|
||||
static double staticFunction();
|
||||
static gtsam::Point3 StaticFunctionRet(double z);
|
||||
|
||||
// enabling serialization functionality
|
||||
void serialize() const; // Just triggers a flag internally and removes actual function
|
||||
|
||||
// enable pickling in python
|
||||
void pickle() const;
|
||||
};
|
||||
|
||||
}
|
||||
// another comment
|
||||
|
||||
// another comment
|
||||
|
||||
/**
|
||||
* A multi-line comment!
|
||||
*/
|
||||
|
||||
// An include! Can go anywhere outside of a class, in any order
|
||||
#include <folder/path/to/Test.h>
|
||||
|
||||
class Test {
|
||||
|
||||
/* a comment! */
|
||||
// another comment
|
||||
Test();
|
||||
|
||||
// Test a shared ptr property
|
||||
gtsam::noiseModel::Base* model_ptr;
|
||||
|
||||
pair<Vector,Matrix> return_pair (Vector v, Matrix A) const; // intentionally the first method
|
||||
pair<Vector,Matrix> return_pair (Vector v) const; // overload
|
||||
|
||||
bool return_bool (bool value) const; // comment after a line!
|
||||
size_t return_size_t (size_t value) const;
|
||||
int return_int (int value) const;
|
||||
double return_double (double value) const;
|
||||
|
||||
Test(double a, Matrix b); // a constructor in the middle of a class
|
||||
|
||||
// comments in the middle!
|
||||
|
||||
// (more) comments in the middle!
|
||||
|
||||
string return_string (string value) const;
|
||||
Vector return_vector1(Vector value) const;
|
||||
Matrix return_matrix1(Matrix value) const;
|
||||
Vector return_vector2(Vector value) const;
|
||||
Matrix return_matrix2(Matrix value) const;
|
||||
void arg_EigenConstRef(const Matrix& value) const;
|
||||
|
||||
bool return_field(const Test& t) const;
|
||||
|
||||
Test* return_TestPtr(const Test* value) const;
|
||||
Test return_Test(Test* value) const;
|
||||
|
||||
gtsam::Point2* return_Point2Ptr(bool value) const;
|
||||
|
||||
pair<Test*,Test*> create_ptrs () const;
|
||||
pair<Test ,Test*> create_MixedPtrs () const;
|
||||
pair<Test*,Test*> return_ptrs (Test* p1, Test* p2) const;
|
||||
|
||||
void print() const;
|
||||
|
||||
// comments at the end!
|
||||
|
||||
// even more comments at the end!
|
||||
};
|
||||
|
||||
pair<gtsam::NonlinearFactorGraph*, gtsam::Values*> load2D(string filename, Test* model, int maxID, bool addNoise, bool smart);
|
||||
pair<gtsam::NonlinearFactorGraph*, gtsam::Values*> load2D(string filename, const gtsam::noiseModel::Diagonal* model, int maxID, bool addNoise, bool smart);
|
||||
pair<gtsam::NonlinearFactorGraph*, gtsam::Values*> load2D(string filename, gtsam::noiseModel::Diagonal@ model);
|
||||
|
||||
Vector aGlobalFunction();
|
||||
|
||||
// An overloaded global function
|
||||
Vector overloadedGlobalFunction(int a);
|
||||
Vector overloadedGlobalFunction(int a, double b);
|
||||
|
||||
// A base class
|
||||
virtual class MyBase {
|
||||
|
||||
};
|
||||
|
||||
// A templated class
|
||||
template<T = {gtsam::Point2, Matrix}>
|
||||
virtual class MyTemplate : MyBase {
|
||||
MyTemplate();
|
||||
|
||||
template<ARG = {gtsam::Point2, gtsam::Point3, Vector, Matrix}>
|
||||
ARG templatedMethod(const ARG& t);
|
||||
|
||||
// Stress test templates and pointer combinations
|
||||
void accept_T(const T& value) const;
|
||||
void accept_Tptr(T* value) const;
|
||||
T* return_Tptr(T* value) const;
|
||||
T return_T(T@ value) const;
|
||||
pair<T*,T*> create_ptrs () const;
|
||||
pair<T ,T*> create_MixedPtrs () const;
|
||||
pair<T*,T*> return_ptrs (T* p1, T* p2) const;
|
||||
|
||||
static This Level(const T& K);
|
||||
};
|
||||
|
||||
// A doubly templated class
|
||||
template<POSE, POINT>
|
||||
class MyFactor {
|
||||
MyFactor(size_t key1, size_t key2, double measured, const gtsam::noiseModel::Base* noiseModel);
|
||||
};
|
||||
|
||||
// and a typedef specializing it
|
||||
typedef MyFactor<gtsam::Pose2, Matrix> MyFactorPosePoint2;
|
||||
|
||||
template<T = {double}>
|
||||
class PrimitiveRef {
|
||||
PrimitiveRef();
|
||||
|
||||
static This Brutal(const T& t);
|
||||
};
|
||||
|
||||
// A class with integer template arguments
|
||||
template<N = {3,12}>
|
||||
class MyVector {
|
||||
MyVector();
|
||||
};
|
||||
|
||||
// comments at the end!
|
||||
|
||||
// even more comments at the end!
|
||||
|
||||
// Class with multiple instantiated templates
|
||||
template<T = {int}, U = {double, float}>
|
||||
class MultipleTemplates {};
|
||||
|
||||
// A templated free/global function. Multiple templates supported.
|
||||
template<T1 = {string, double}, T2 = {size_t}, R = {double}>
|
||||
R MultiTemplatedFunction(const T& x, T2 y);
|
||||
|
||||
// Check if we can typedef the templated function
|
||||
template<T>
|
||||
void TemplatedFunction(const T& t);
|
||||
|
||||
typedef TemplatedFunction<gtsam::Rot3> TemplatedFunctionRot3;
|
|
@ -5,7 +5,7 @@ Date: May 2019
|
|||
"""
|
||||
import filecmp
|
||||
import os
|
||||
import os.path as path
|
||||
from os import path
|
||||
import shutil
|
||||
import sys
|
||||
import unittest
|
||||
|
@ -34,24 +34,26 @@ class TestDocument(unittest.TestCase):
|
|||
DIR_NAME = path.dirname(__file__)
|
||||
|
||||
DOC_DIR = 'doc-test-files'
|
||||
OUTPUT_XML_DIR = 'actual-xml-generation'
|
||||
EXPECTED_XML_DIR = 'expected-xml-generation'
|
||||
OUTPUT_XML_DIR = 'actual/xml'
|
||||
EXPECTED_XML_DIR = 'expected/xml'
|
||||
|
||||
DOC_DIR_PATH = path.abspath(path.join(DIR_NAME, DOC_DIR))
|
||||
OUTPUT_XML_DIR_PATH = path.abspath(path.join(DIR_NAME, OUTPUT_XML_DIR))
|
||||
EXPECTED_XML_DIR_PATH = path.abspath(path.join(DIR_NAME, EXPECTED_XML_DIR))
|
||||
|
||||
@unittest.skip("DOC_DIR_PATH doesn't exist")
|
||||
def test_generate_xml(self):
|
||||
"""Test parse_xml.generate_xml"""
|
||||
if path.exists(self.OUTPUT_XML_DIR_PATH):
|
||||
shutil.rmtree(self.OUTPUT_XML_DIR_PATH, ignore_errors=True)
|
||||
|
||||
parser.generate_xml(self.DOC_DIR_PATH,
|
||||
self.OUTPUT_XML_DIR_PATH,
|
||||
quiet=True)
|
||||
|
||||
self.assertTrue(os.path.isdir(self.OUTPUT_XML_DIR_PATH))
|
||||
|
||||
xml_path = path.join(self.OUTPUT_XML_DIR_PATH, 'xml')
|
||||
xml_path = self.OUTPUT_XML_DIR_PATH
|
||||
if path.exists(xml_path):
|
||||
shutil.rmtree(xml_path)
|
||||
parser.generate_xml(self.DOC_DIR_PATH,
|
||||
|
@ -63,6 +65,7 @@ class TestDocument(unittest.TestCase):
|
|||
|
||||
self.assertTrue(not dircmp.diff_files and not dircmp.funny_files)
|
||||
|
||||
@unittest.skip("DOC_DIR_PATH doesn't exist")
|
||||
def test_parse(self):
|
||||
"""Test the parsing of the XML generated by Doxygen."""
|
||||
docs = parser.ParseDoxygenXML(self.DOC_DIR_PATH,
|
||||
|
|
|
@ -3,16 +3,17 @@ Unit tests for Matlab wrap program
|
|||
Author: Matthew Sklar, Varun Agrawal
|
||||
Date: March 2019
|
||||
"""
|
||||
# pylint: disable=import-error, wrong-import-position, too-many-branches
|
||||
# pylint: disable=import-error, wrong-import-position
|
||||
|
||||
import filecmp
|
||||
import os
|
||||
import os.path as osp
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from loguru import logger
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
|
||||
|
||||
import gtwrap.interface_parser as parser
|
||||
import gtwrap.template_instantiator as instantiator
|
||||
|
@ -23,9 +24,13 @@ class TestWrap(unittest.TestCase):
|
|||
"""
|
||||
Test the Matlab wrapper
|
||||
"""
|
||||
TEST_DIR = os.path.dirname(os.path.realpath(__file__)) + "/"
|
||||
MATLAB_TEST_DIR = TEST_DIR + "expected-matlab/"
|
||||
MATLAB_ACTUAL_DIR = TEST_DIR + "actual-matlab/"
|
||||
TEST_DIR = osp.dirname(osp.realpath(__file__))
|
||||
INTERFACE_DIR = osp.join(TEST_DIR, "fixtures")
|
||||
MATLAB_TEST_DIR = osp.join(TEST_DIR, "expected", "matlab")
|
||||
MATLAB_ACTUAL_DIR = osp.join(TEST_DIR, "actual", "matlab")
|
||||
|
||||
# Create the `actual/matlab` directory
|
||||
os.makedirs(MATLAB_ACTUAL_DIR, exist_ok=True)
|
||||
|
||||
# set the log level to INFO by default
|
||||
logger.remove() # remove the default sink
|
||||
|
@ -48,9 +53,9 @@ class TestWrap(unittest.TestCase):
|
|||
if len(c) == 0:
|
||||
continue
|
||||
logger.debug("c object: {}".format(c[0][0]))
|
||||
path_to_folder = path + '/' + c[0][0]
|
||||
path_to_folder = osp.join(path, c[0][0])
|
||||
|
||||
if not os.path.isdir(path_to_folder):
|
||||
if not osp.isdir(path_to_folder):
|
||||
try:
|
||||
os.makedirs(path_to_folder, exist_ok=True)
|
||||
except OSError:
|
||||
|
@ -61,26 +66,27 @@ class TestWrap(unittest.TestCase):
|
|||
self.generate_content(sub_content[1], path_to_folder)
|
||||
|
||||
elif isinstance(c[1], list):
|
||||
path_to_folder = path + '/' + c[0]
|
||||
path_to_folder = osp.join(path, c[0])
|
||||
|
||||
logger.debug("[generate_content_global]: {}".format(path_to_folder))
|
||||
if not os.path.isdir(path_to_folder):
|
||||
logger.debug(
|
||||
"[generate_content_global]: {}".format(path_to_folder))
|
||||
if not osp.isdir(path_to_folder):
|
||||
try:
|
||||
os.makedirs(path_to_folder, exist_ok=True)
|
||||
except OSError:
|
||||
pass
|
||||
for sub_content in c[1]:
|
||||
path_to_file = path_to_folder + '/' + sub_content[0]
|
||||
path_to_file = osp.join(path_to_folder, sub_content[0])
|
||||
logger.debug(
|
||||
"[generate_global_method]: {}".format(path_to_file))
|
||||
with open(path_to_file, 'w') as f:
|
||||
f.write(sub_content[1])
|
||||
|
||||
else:
|
||||
path_to_file = path + '/' + c[0]
|
||||
path_to_file = osp.join(path, c[0])
|
||||
|
||||
logger.debug("[generate_content]: {}".format(path_to_file))
|
||||
if not os.path.isdir(path_to_file):
|
||||
if not osp.isdir(path_to_file):
|
||||
try:
|
||||
os.mkdir(path)
|
||||
except OSError:
|
||||
|
@ -89,16 +95,29 @@ class TestWrap(unittest.TestCase):
|
|||
with open(path_to_file, 'w') as f:
|
||||
f.write(c[1])
|
||||
|
||||
def test_geometry_matlab(self):
|
||||
def compare_and_diff(self, file):
|
||||
"""
|
||||
Compute the comparison between the expected and actual file,
|
||||
and assert if diff is zero.
|
||||
"""
|
||||
output = osp.join(self.MATLAB_ACTUAL_DIR, file)
|
||||
expected = osp.join(self.MATLAB_TEST_DIR, file)
|
||||
success = filecmp.cmp(output, expected)
|
||||
if not success:
|
||||
print("Differ in file: {}".format(file))
|
||||
os.system("diff {} {}".format(output, expected))
|
||||
self.assertTrue(success, "Mismatch for file {0}".format(file))
|
||||
|
||||
def test_geometry(self):
|
||||
"""
|
||||
Check generation of matlab geometry wrapper.
|
||||
python3 wrap/matlab_wrapper.py --src wrap/tests/geometry.h
|
||||
--module_name geometry --out wrap/tests/actual-matlab
|
||||
"""
|
||||
with open(self.TEST_DIR + 'geometry.h', 'r') as f:
|
||||
with open(osp.join(self.INTERFACE_DIR, 'geometry.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if not os.path.exists(self.MATLAB_ACTUAL_DIR):
|
||||
if not osp.exists(self.MATLAB_ACTUAL_DIR):
|
||||
os.mkdir(self.MATLAB_ACTUAL_DIR)
|
||||
|
||||
module = parser.Module.parseString(content)
|
||||
|
@ -117,27 +136,144 @@ class TestWrap(unittest.TestCase):
|
|||
|
||||
self.generate_content(cc_content)
|
||||
|
||||
def compare_and_diff(file):
|
||||
output = self.MATLAB_ACTUAL_DIR + file
|
||||
expected = self.MATLAB_TEST_DIR + file
|
||||
success = filecmp.cmp(output, expected)
|
||||
if not success:
|
||||
print("Differ in file: {}".format(file))
|
||||
os.system("diff {} {}".format(output, expected))
|
||||
self.assertTrue(success)
|
||||
self.assertTrue(osp.isdir(osp.join(self.MATLAB_ACTUAL_DIR, '+gtsam')))
|
||||
|
||||
self.assertTrue(os.path.isdir(self.MATLAB_ACTUAL_DIR + '+gtsam'))
|
||||
files = ['+gtsam/Point2.m', '+gtsam/Point3.m', 'geometry_wrapper.cpp']
|
||||
|
||||
for file in files:
|
||||
self.compare_and_diff(file)
|
||||
|
||||
def test_functions(self):
|
||||
"""Test interface file with function info."""
|
||||
with open(osp.join(self.INTERFACE_DIR, 'functions.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if not osp.exists(self.MATLAB_ACTUAL_DIR):
|
||||
os.mkdir(self.MATLAB_ACTUAL_DIR)
|
||||
|
||||
module = parser.Module.parseString(content)
|
||||
|
||||
instantiator.instantiate_namespace_inplace(module)
|
||||
|
||||
wrapper = MatlabWrapper(
|
||||
module=module,
|
||||
module_name='functions',
|
||||
top_module_namespace=['gtsam'],
|
||||
ignore_classes=[''],
|
||||
)
|
||||
|
||||
cc_content = wrapper.wrap()
|
||||
|
||||
self.generate_content(cc_content)
|
||||
|
||||
files = [
|
||||
'+gtsam/Point2.m', '+gtsam/Point3.m', 'Test.m', 'MyBase.m',
|
||||
'load2D.m', 'MyTemplatePoint2.m', 'MyTemplateMatrix.m',
|
||||
'MyVector3.m', 'MyVector12.m', 'MyFactorPosePoint2.m',
|
||||
'aGlobalFunction.m', 'overloadedGlobalFunction.m',
|
||||
'geometry_wrapper.cpp'
|
||||
'functions_wrapper.cpp', 'aGlobalFunction.m', 'load2D.m',
|
||||
'MultiTemplatedFunctionDoubleSize_tDouble.m',
|
||||
'MultiTemplatedFunctionStringSize_tDouble.m',
|
||||
'overloadedGlobalFunction.m', 'TemplatedFunctionRot3.m'
|
||||
]
|
||||
|
||||
for file in files:
|
||||
compare_and_diff(file)
|
||||
self.compare_and_diff(file)
|
||||
|
||||
def test_class(self):
|
||||
"""Test interface file with only class info."""
|
||||
with open(osp.join(self.INTERFACE_DIR, 'class.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if not osp.exists(self.MATLAB_ACTUAL_DIR):
|
||||
os.mkdir(self.MATLAB_ACTUAL_DIR)
|
||||
|
||||
module = parser.Module.parseString(content)
|
||||
|
||||
instantiator.instantiate_namespace_inplace(module)
|
||||
|
||||
wrapper = MatlabWrapper(
|
||||
module=module,
|
||||
module_name='class',
|
||||
top_module_namespace=['gtsam'],
|
||||
ignore_classes=[''],
|
||||
)
|
||||
|
||||
cc_content = wrapper.wrap()
|
||||
|
||||
self.generate_content(cc_content)
|
||||
|
||||
files = [
|
||||
'class_wrapper.cpp', 'FunDouble.m', 'FunRange.m',
|
||||
'MultipleTemplatesIntDouble.m', 'MultipleTemplatesIntFloat.m',
|
||||
'MyFactorPosePoint2.m', 'MyVector3.m', 'MyVector12.m',
|
||||
'PrimitiveRefDouble.m', 'Test.m'
|
||||
]
|
||||
|
||||
for file in files:
|
||||
self.compare_and_diff(file)
|
||||
|
||||
def test_inheritance(self):
|
||||
"""Test interface file with class inheritance definitions."""
|
||||
with open(osp.join(self.INTERFACE_DIR, 'inheritance.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if not osp.exists(self.MATLAB_ACTUAL_DIR):
|
||||
os.mkdir(self.MATLAB_ACTUAL_DIR)
|
||||
|
||||
module = parser.Module.parseString(content)
|
||||
|
||||
instantiator.instantiate_namespace_inplace(module)
|
||||
|
||||
wrapper = MatlabWrapper(
|
||||
module=module,
|
||||
module_name='inheritance',
|
||||
top_module_namespace=['gtsam'],
|
||||
ignore_classes=[''],
|
||||
)
|
||||
|
||||
cc_content = wrapper.wrap()
|
||||
|
||||
self.generate_content(cc_content)
|
||||
|
||||
files = [
|
||||
'inheritance_wrapper.cpp', 'MyBase.m', 'MyTemplateMatrix.m',
|
||||
'MyTemplatePoint2.m'
|
||||
]
|
||||
|
||||
for file in files:
|
||||
self.compare_and_diff(file)
|
||||
|
||||
def test_namspaces(self):
|
||||
"""
|
||||
Test interface file with full namespace definition.
|
||||
"""
|
||||
with open(osp.join(self.INTERFACE_DIR, 'namespaces.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if not osp.exists(self.MATLAB_ACTUAL_DIR):
|
||||
os.mkdir(self.MATLAB_ACTUAL_DIR)
|
||||
|
||||
module = parser.Module.parseString(content)
|
||||
|
||||
instantiator.instantiate_namespace_inplace(module)
|
||||
|
||||
wrapper = MatlabWrapper(
|
||||
module=module,
|
||||
module_name='namespaces',
|
||||
top_module_namespace=['gtsam'],
|
||||
ignore_classes=[''],
|
||||
)
|
||||
|
||||
cc_content = wrapper.wrap()
|
||||
|
||||
self.generate_content(cc_content)
|
||||
|
||||
files = [
|
||||
'namespaces_wrapper.cpp', '+ns1/aGlobalFunction.m',
|
||||
'+ns1/ClassA.m', '+ns1/ClassB.m', '+ns2/+ns3/ClassB.m',
|
||||
'+ns2/aGlobalFunction.m', '+ns2/ClassA.m', '+ns2/ClassC.m',
|
||||
'+ns2/overloadedGlobalFunction.m', 'ClassD.m'
|
||||
]
|
||||
|
||||
for file in files:
|
||||
self.compare_and_diff(file)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -8,25 +8,30 @@ Date: February 2019
|
|||
|
||||
import filecmp
|
||||
import os
|
||||
import os.path as path
|
||||
import os.path as osp
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
|
||||
sys.path.append(
|
||||
os.path.normpath(
|
||||
os.path.abspath(os.path.join(__file__, '../../../build/wrap'))))
|
||||
osp.normpath(osp.abspath(osp.join(__file__, '../../../build/wrap'))))
|
||||
|
||||
import gtwrap.interface_parser as parser
|
||||
import gtwrap.template_instantiator as instantiator
|
||||
from gtwrap.pybind_wrapper import PybindWrapper
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
|
||||
|
||||
|
||||
class TestWrap(unittest.TestCase):
|
||||
"""Tests for Python wrapper based on Pybind11."""
|
||||
TEST_DIR = os.path.dirname(os.path.realpath(__file__)) + "/"
|
||||
TEST_DIR = osp.dirname(osp.realpath(__file__))
|
||||
INTERFACE_DIR = osp.join(TEST_DIR, 'fixtures')
|
||||
PYTHON_TEST_DIR = osp.join(TEST_DIR, 'expected', 'python')
|
||||
PYTHON_ACTUAL_DIR = osp.join(TEST_DIR, "actual", "python")
|
||||
|
||||
# Create the `actual/python` directory
|
||||
os.makedirs(PYTHON_ACTUAL_DIR, exist_ok=True)
|
||||
|
||||
def wrap_content(self, content, module_name, output_dir):
|
||||
"""
|
||||
|
@ -36,7 +41,8 @@ class TestWrap(unittest.TestCase):
|
|||
|
||||
instantiator.instantiate_namespace_inplace(module)
|
||||
|
||||
with open(self.TEST_DIR + "pybind_wrapper.tpl") as template_file:
|
||||
with open(osp.join(self.TEST_DIR,
|
||||
"pybind_wrapper.tpl")) as template_file:
|
||||
module_template = template_file.read()
|
||||
|
||||
# Create Pybind wrapper instance
|
||||
|
@ -49,54 +55,84 @@ class TestWrap(unittest.TestCase):
|
|||
|
||||
cc_content = wrapper.wrap()
|
||||
|
||||
output = path.join(self.TEST_DIR, output_dir, module_name + ".cpp")
|
||||
output = osp.join(self.TEST_DIR, output_dir, module_name + ".cpp")
|
||||
|
||||
if not path.exists(path.join(self.TEST_DIR, output_dir)):
|
||||
os.mkdir(path.join(self.TEST_DIR, output_dir))
|
||||
if not osp.exists(osp.join(self.TEST_DIR, output_dir)):
|
||||
os.mkdir(osp.join(self.TEST_DIR, output_dir))
|
||||
|
||||
with open(output, 'w') as f:
|
||||
f.write(cc_content)
|
||||
|
||||
return output
|
||||
|
||||
def test_geometry_python(self):
|
||||
def compare_and_diff(self, file, actual):
|
||||
"""
|
||||
Compute the comparison between the expected and actual file,
|
||||
and assert if diff is zero.
|
||||
"""
|
||||
expected = osp.join(self.PYTHON_TEST_DIR, file)
|
||||
success = filecmp.cmp(actual, expected)
|
||||
|
||||
if not success:
|
||||
os.system("diff {} {}".format(actual, expected))
|
||||
self.assertTrue(success, "Mismatch for file {0}".format(file))
|
||||
|
||||
def test_geometry(self):
|
||||
"""
|
||||
Check generation of python geometry wrapper.
|
||||
python3 ../pybind_wrapper.py --src geometry.h --module_name
|
||||
geometry_py --out output/geometry_py.cc
|
||||
"""
|
||||
with open(os.path.join(self.TEST_DIR, 'geometry.h'), 'r') as f:
|
||||
with open(osp.join(self.INTERFACE_DIR, 'geometry.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
output = self.wrap_content(content, 'geometry_py', 'actual-python')
|
||||
output = self.wrap_content(content, 'geometry_py',
|
||||
self.PYTHON_ACTUAL_DIR)
|
||||
|
||||
expected = path.join(self.TEST_DIR,
|
||||
'expected-python/geometry_pybind.cpp')
|
||||
success = filecmp.cmp(output, expected)
|
||||
self.compare_and_diff('geometry_pybind.cpp', output)
|
||||
|
||||
if not success:
|
||||
os.system("diff {} {}".format(output, expected))
|
||||
self.assertTrue(success)
|
||||
def test_functions(self):
|
||||
"""Test interface file with function info."""
|
||||
with open(osp.join(self.INTERFACE_DIR, 'functions.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
output = self.wrap_content(content, 'functions_py',
|
||||
self.PYTHON_ACTUAL_DIR)
|
||||
|
||||
self.compare_and_diff('functions_pybind.cpp', output)
|
||||
|
||||
def test_class(self):
|
||||
"""Test interface file with only class info."""
|
||||
with open(osp.join(self.INTERFACE_DIR, 'class.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
output = self.wrap_content(content, 'class_py', self.PYTHON_ACTUAL_DIR)
|
||||
|
||||
self.compare_and_diff('class_pybind.cpp', output)
|
||||
|
||||
def test_inheritance(self):
|
||||
"""Test interface file with class inheritance definitions."""
|
||||
with open(osp.join(self.INTERFACE_DIR, 'inheritance.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
output = self.wrap_content(content, 'inheritance_py',
|
||||
self.PYTHON_ACTUAL_DIR)
|
||||
|
||||
self.compare_and_diff('inheritance_pybind.cpp', output)
|
||||
|
||||
def test_namespaces(self):
|
||||
"""
|
||||
Check generation of python geometry wrapper.
|
||||
python3 ../pybind_wrapper.py --src testNamespaces.h --module_name
|
||||
testNamespaces_py --out output/testNamespaces_py.cc
|
||||
Check generation of python wrapper for full namespace definition.
|
||||
python3 ../pybind_wrapper.py --src namespaces.i --module_name
|
||||
namespaces_py --out output/namespaces_py.cpp
|
||||
"""
|
||||
with open(os.path.join(self.TEST_DIR, 'testNamespaces.h'), 'r') as f:
|
||||
with open(osp.join(self.INTERFACE_DIR, 'namespaces.i'), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
output = self.wrap_content(content, 'testNamespaces_py',
|
||||
'actual-python')
|
||||
output = self.wrap_content(content, 'namespaces_py',
|
||||
self.PYTHON_ACTUAL_DIR)
|
||||
|
||||
expected = path.join(self.TEST_DIR,
|
||||
'expected-python/testNamespaces_py.cpp')
|
||||
success = filecmp.cmp(output, expected)
|
||||
|
||||
if not success:
|
||||
os.system("diff {} {}".format(output, expected))
|
||||
self.assertTrue(success)
|
||||
self.compare_and_diff('namespaces_pybind.cpp', output)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue