File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,28 @@ namespace eigenpy
289289 return true ;
290290 }
291291
292+
293+ // / \brief Get the class object for a wrapped type that has been exposed
294+ // / through Boost.Python.
295+ template <typename T>
296+ boost::python::object getInstanceClass ()
297+ {
298+ // Query into the registry for type T.
299+ namespace bp = boost::python;
300+ bp::type_info type = bp::type_id<T>();
301+ const bp::converter::registration* registration =
302+ bp::converter::registry::query (type);
303+
304+ // If the class is not registered, return None.
305+ if (!registration) {
306+ // std::cerr<<"Class Not Registered. Returning Empty."<<std::endl;
307+ return bp::object ();
308+ }
309+
310+ bp::handle<PyTypeObject> handle (bp::borrowed (registration->get_class_object ()));
311+ return bp::object (handle);
312+ }
313+
292314 template <typename Scalar>
293315 int registerNewType (PyTypeObject * py_type_ptr = NULL )
294316 {
You can’t perform that action at this time.
0 commit comments