Unverified Commit bc99ed26 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #180 from jcarpent/devel

Fix destruction of objects 
parents fb5c65c5 6821d3a7
Subproject commit d1340a9e0340c443e5e8841c7ab4a0997f989e59
Subproject commit a5c65a0ee51191be3f2e2667b95830706c211bb2
/*
* Copyright 2014-2019, CNRS
* Copyright 2018-2019, INRIA
* Copyright 2014-2020 CNRS INRIA
*/
#ifndef __eigenpy_angle_axis_hpp__
#define __eigenpy_angle_axis_hpp__
#include "eigenpy/fwd.hpp"
#include "eigenpy/eigenpy.hpp"
#include <Eigen/Core>
#include <Eigen/Geometry>
......
......@@ -5,7 +5,8 @@
#ifndef __eigenpy_decomposition_eigen_solver_hpp__
#define __eigenpy_decomposition_eigen_solver_hpp__
#include <boost/python.hpp>
#include "eigenpy/eigenpy.hpp"
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
......
......@@ -5,7 +5,8 @@
#ifndef __eigenpy_decomposition_ldlt_hpp__
#define __eigenpy_decomposition_ldlt_hpp__
#include <boost/python.hpp>
#include "eigenpy/eigenpy.hpp"
#include <Eigen/Core>
#include <Eigen/Cholesky>
......
......@@ -5,7 +5,8 @@
#ifndef __eigenpy_decomposition_llt_hpp__
#define __eigenpy_decomposition_llt_hpp__
#include <boost/python.hpp>
#include "eigenpy/eigenpy.hpp"
#include <Eigen/Core>
#include <Eigen/Cholesky>
......
......@@ -5,7 +5,8 @@
#ifndef __eigenpy_decomposition_self_adjoint_eigen_solver_hpp__
#define __eigenpy_decomposition_self_adjoint_eigen_solver_hpp__
#include <boost/python.hpp>
#include "eigenpy/eigenpy.hpp"
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
......
......@@ -148,7 +148,7 @@ namespace boost { namespace python { namespace converter {
}
};
#define RVALUE_FROM_PYTHON_DATA_INIT(type) \
#define EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(type) \
typedef rvalue_from_python_data_eigen<type> Base; \
\
rvalue_from_python_data(rvalue_from_python_stage1_data const & _stage1) \
......@@ -162,7 +162,7 @@ namespace boost { namespace python { namespace converter {
struct rvalue_from_python_data<Eigen::MatrixBase<Derived> const &>
: rvalue_from_python_data_eigen<Derived const &>
{
RVALUE_FROM_PYTHON_DATA_INIT(Derived const &)
EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(Derived const &)
};
/// \brief Template specialization of rvalue_from_python_data
......@@ -170,11 +170,9 @@ namespace boost { namespace python { namespace converter {
struct rvalue_from_python_data<Eigen::EigenBase<Derived> const &>
: rvalue_from_python_data_eigen<Derived const &>
{
RVALUE_FROM_PYTHON_DATA_INIT(Derived const &)
EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(Derived const &)
};
#undef RVALUE_FROM_PYTHON_DATA_INIT
template<typename MatType, int Options, typename Stride>
struct rvalue_from_python_data<Eigen::Ref<MatType,Options,Stride> &>
: rvalue_from_python_storage<Eigen::Ref<MatType,Options,Stride> &>
......
/*
* Copyright 2014-2019, CNRS
* Copyright 2018-2019, INRIA
* Copyright 2014-2020 CNRS INRIA
*/
#ifndef __eigenpy_quaternion_hpp__
#define __eigenpy_quaternion_hpp__
#include "eigenpy/fwd.hpp"
#include "eigenpy/eigenpy.hpp"
#include <Eigen/Core>
#include <Eigen/Geometry>
#include "eigenpy/exception.hpp"
namespace boost { namespace python { namespace converter {
/// \brief Template specialization of rvalue_from_python_data
template<typename Quaternion>
struct rvalue_from_python_data<Eigen::QuaternionBase<Quaternion> const &>
: rvalue_from_python_data_eigen<Quaternion const &>
{
EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(Quaternion const &)
};
template <class Quaternion>
struct implicit<Quaternion, Eigen::QuaternionBase<Quaternion> >
{
typedef Quaternion Source;
typedef Eigen::QuaternionBase<Quaternion> Target;
static void* convertible(PyObject* obj)
{
// Find a converter which can produce a Source instance from
// obj. The user has told us that Source can be converted to
// Target, and instantiating construct() below, ensures that
// at compile-time.
return implicit_rvalue_convertible_from_python(obj, registered<Source>::converters)
? obj : 0;
}
static void construct(PyObject* obj, rvalue_from_python_stage1_data* data)
{
void* storage = ((rvalue_from_python_storage<Target>*)data)->storage.bytes;
arg_from_python<Source> get_source(obj);
bool convertible = get_source.convertible();
BOOST_VERIFY(convertible);
new (storage) Source(get_source());
// record successful construction
data->convertible = storage;
}
};
}}} // namespace boost::python::converter
namespace eigenpy
{
......@@ -267,7 +309,7 @@ namespace eigenpy
// Cast to Eigen::QuaternionBase and vice-versa
bp::implicitly_convertible<Quaternion,QuaternionBase >();
bp::implicitly_convertible<QuaternionBase,Quaternion >();
// bp::implicitly_convertible<QuaternionBase,Quaternion >();
}
};
......
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