Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
eigenpy
Commits
a9981b17
Verified
Commit
a9981b17
authored
Apr 01, 2020
by
Justin Carpentier
Browse files
core/geometry: specialize converter for Quaternion
parent
c68020de
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/eigenpy/quaternion.hpp
View file @
a9981b17
...
...
@@ -12,6 +12,49 @@
#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
&>
{
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
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment