Verified Commit 09ca4e45 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

swig: add helper get_PySwigObject

parent 1ac2b7cd
Pipeline #12720 passed with stage
in 14 minutes and 16 seconds
......@@ -5,6 +5,8 @@
#ifndef __eigenpy_swig_hpp__
#define __eigenpy_swig_hpp__
#include "eigenpy/fwd.hpp"
namespace eigenpy
{
struct PySwigObject
......@@ -13,6 +15,19 @@ namespace eigenpy
void * ptr;
const char * desc;
};
inline PySwigObject * get_PySwigObject(PyObject * pyObj)
{
if(!PyObject_HasAttrString(pyObj,"this"))
return NULL;
PyObject * this_ptr = PyObject_GetAttrString(pyObj,"this");
if(this_ptr == NULL)
return NULL;
PySwigObject * swig_obj = reinterpret_cast<PySwigObject*>(this_ptr);
return swig_obj;
}
}
#endif // ifndef __eigenpy_swig_hpp__
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment