Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
pinocchio
Commits
f8b6120d
Commit
f8b6120d
authored
Oct 01, 2016
by
jcarpent
Browse files
[Python] Add printable visitor
parent
999ffe21
Changes
2
Hide whitespace changes
Inline
Side-by-side
bindings/python/CMakeLists.txt
View file @
f8b6120d
...
...
@@ -64,6 +64,7 @@ SET(${PROJECT_NAME}_PYTHON_HEADERS
utils/eigen_container.hpp
utils/handler.hpp
utils/copyable.hpp
utils/printable.hpp
fwd.hpp
spatial/se3.hpp
spatial/force.hpp
...
...
bindings/python/utils/printable.hpp
0 → 100644
View file @
f8b6120d
//
// Copyright (c) 2016 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.
#ifndef __se3_python_utils_printable_hpp__
#define __se3_python_utils_printable_hpp__
#include
<boost/python.hpp>
namespace
se3
{
namespace
python
{
namespace
bp
=
boost
::
python
;
///
/// \brief Set the Python method __str__ and __repr__ to use the overloading operator<<.
///
template
<
class
C
>
struct
PrintableVisitor
:
public
bp
::
def_visitor
<
PrintableVisitor
<
C
>
>
{
template
<
class
PyClass
>
void
visit
(
PyClass
&
cl
)
const
{
cl
.
def
(
bp
::
self_ns
::
str
(
bp
::
self_ns
::
self
))
.
def
(
bp
::
self_ns
::
repr
(
bp
::
self_ns
::
self
))
;
}
};
}
// namespace python
}
// namespace se3
#endif // ifndef __se3_python_utils_printable_hpp__
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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