Verified Commit 79f84d3f authored by Justin Carpentier's avatar Justin Carpentier
Browse files

registration: add function to register a symlink if the type is already registered

parent ba078762
......@@ -7,6 +7,7 @@
#define __eigenpy_registration_hpp__
#include <boost/python.hpp>
#include <boost/python/scope.hpp>
namespace eigenpy
{
......@@ -29,6 +30,30 @@ namespace eigenpy
return true;
}
///
/// \brief Symlink to the current scope the already registered class T.
///
/// \returns true if the type T is effectively symlinked.
///
/// \tparam T The type to symlink.
///
template<typename T>
inline bool register_symbolic_link_to_registered_type()
{
namespace bp = boost::python;
const bp::type_info info = bp::type_id<T>();
const bp::converter::registration* reg = bp::converter::registry::query(info);
if(check_registration<T>())
{
bp::scope().attr(info.name()) = reg->get_class_object();
return true;
}
return false;
}
}
#endif // ifndef __eigenpy_registration_hpp__
Supports Markdown
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