+%typemap(in) std::vector<double>& (std::vector<double> temp) {
+ if (PyList_Check($input)) {
+ for (Py_ssize_t i = 0; i < PyList_Size($input); ++i) {
+ PyObject * item = PySequence_GetItem($input, i);
+ if (PyNumber_Check(item)) {
+ temp.push_back(PyFloat_AsDouble(item));
+ } else {
+ PyErr_SetString(PyExc_TypeError, "argument must be double value.");
+ return NULL;
+ }
+ Py_DECREF(item);
+ }
+ $1 = &temp;
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be a list of double values.");
+ return NULL;
+ }
+}
+
+%typemap(argout) std::vector<double>& {
+ PyObject* outList = PyList_New(0);
+ int error;
+ std::vector<double>::iterator it;
+ for ( it=$1->begin() ; it != $1->end(); it++ )
+ {
+ error = PyList_Append(outList, PyFloat_FromDouble(*it));
+ if (error)
+ SWIG_fail;
+ }
+ if ((!$result) || ($result == Py_None)) {
+ $result = outList;
+ } else {
+ PyObject *aObj1, *aObj2;
+ if (!PyTuple_Check($result)) {
+ PyObject* aObj = $result;
+ $result = PyTuple_New(1);
+ PyTuple_SetItem($result,0,aObj);
+ }
+ aObj2 = PyTuple_New(1);
+ PyTuple_SetItem(aObj2,0,outList);
+ aObj1 = $result;
+ $result = PySequence_Concat(aObj1,aObj2);
+ Py_DECREF(aObj1);
+ Py_DECREF(aObj2);
+ }
+}
+
+%typecheck(SWIG_TYPECHECK_POINTER) std::vector<double>, const std::vector<double>& {
+ if (PyTuple_Check($input)) {
+ for (Py_ssize_t i = 0; i < PyTuple_Size($input); ++i) {
+ PyObject * item = PySequence_GetItem($input, i);
+ if (PyNumber_Check(item)) {
+ $1 = 1;
+ } else {
+ $1 = 0;
+ break;
+ }
+ Py_DECREF(item);
+ }
+ } else {
+ $1 = 0;
+ }
+}
+
+%typemap(in) double& (double temp) {
+ if (PyFloat_Check($input)) {
+ temp = PyFloat_AsDouble($input);
+ $1 = &temp;
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be a double value.");
+ return NULL;
+ }
+}
+
+%typemap(argout) double& {
+ if ((!$result) || ($result == Py_None)) {
+ $result = PyFloat_FromDouble(*$1);
+ } else {
+ PyObject *aObj1, *aObj2;
+ if (!PyTuple_Check($result)) {
+ PyObject* aObj = $result;
+ $result = PyTuple_New(1);
+ PyTuple_SetItem($result,0,aObj);
+ }
+ aObj2 = PyTuple_New(1);
+ PyTuple_SetItem(aObj2,0,PyFloat_FromDouble(*$1));
+ aObj1 = $result;
+ $result = PySequence_Concat(aObj1,aObj2);
+ Py_DECREF(aObj1);
+ Py_DECREF(aObj2);
+ }
+}
+
+// shared pointers
+%shared_ptr(GeomAlgoAPI_Boolean)
+%shared_ptr(GeomAlgoAPI_Intersection)
+%shared_ptr(GeomAlgoAPI_MakeShape)
+%shared_ptr(GeomAlgoAPI_MakeShapeCustom)
+%shared_ptr(GeomAlgoAPI_MakeShapeList)
+%shared_ptr(GeomAlgoAPI_MakeSweep)
+%shared_ptr(GeomAlgoAPI_PaveFiller)
+%shared_ptr(GeomAlgoAPI_Pipe)
+%shared_ptr(GeomAlgoAPI_Placement)
+%shared_ptr(GeomAlgoAPI_Prism)
+%shared_ptr(GeomAlgoAPI_Revolution)
+%shared_ptr(GeomAlgoAPI_Rotation)
+%shared_ptr(GeomAlgoAPI_Sewing)
+%shared_ptr(GeomAlgoAPI_SketchBuilder)
+%shared_ptr(GeomAlgoAPI_ShapeBuilder)
+%shared_ptr(GeomAlgoAPI_Translation)
+%shared_ptr(GeomAlgoAPI_Transform)
+%shared_ptr(GeomAlgoAPI_Box)
+%shared_ptr(GeomAlgoAPI_ConeSegment)
+%shared_ptr(GeomAlgoAPI_Copy)
+%shared_ptr(GeomAlgoAPI_Symmetry)
+%shared_ptr(GeomAlgoAPI_MapShapesAndAncestors)
+%shared_ptr(GeomAlgoAPI_WireBuilder)