Use custom typemaps for geometry related classes as well

This commit is contained in:
Thomas Krijnen
2015-06-26 13:06:28 +00:00
parent e518146bd6
commit 92bc7b13cb
4 changed files with 8 additions and 48 deletions
+1
View File
@@ -107,6 +107,7 @@
// Conversion functions to convert STL vectors into Python objects
%{
PyObject* pythonize(const int& t) { return PyInt_FromLong(t); }
PyObject* pythonize(const unsigned int& t) { return PyInt_FromLong(t); }
PyObject* pythonize(const bool& t) { return PyBool_FromLong(t); }
PyObject* pythonize(const double& t) { return PyFloat_FromDouble(t); }
PyObject* pythonize(const std::string& t) { return PyString_FromString(t.c_str()); }
+2 -1
View File
@@ -97,10 +97,11 @@
$result = pythonize_vector<template_type>($1);
}
%typemap(out) const std::vector<template_type>& {
$result = pythonize_vector<template_type>($1);
$result = pythonize_vector<template_type>(*$1);
}
%enddef
CREATE_VECTOR_TYPEMAP_OUT(int)
CREATE_VECTOR_TYPEMAP_OUT(unsigned int)
CREATE_VECTOR_TYPEMAP_OUT(double)
CREATE_VECTOR_TYPEMAP_OUT(std::string)