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
pinocchio
Commits
a9c2f230
Verified
Commit
a9c2f230
authored
Aug 30, 2020
by
Justin Carpentier
Browse files
python/utils: add return of the class for StdVector helpers
parent
3179793d
Changes
2
Hide whitespace changes
Inline
Side-by-side
bindings/python/utils/std-aligned-vector.hpp
View file @
a9c2f230
...
...
@@ -35,12 +35,13 @@ namespace pinocchio
typedef
container
::
aligned_vector
<
T
>
vector_type
;
typedef
StdContainerFromPythonList
<
vector_type
>
FromPythonListConverter
;
static
void
expose
(
const
std
::
string
&
class_name
,
const
std
::
string
&
doc_string
=
""
)
static
bp
::
class_
<
vector_type
>
expose
(
const
std
::
string
&
class_name
,
const
std
::
string
&
doc_string
=
""
)
{
namespace
bp
=
boost
::
python
;
bp
::
class_
<
vector_type
>
(
class_name
.
c_str
(),
doc_string
.
c_str
())
bp
::
class_
<
vector_type
>
cl
(
class_name
.
c_str
(),
doc_string
.
c_str
());
cl
.
def
(
StdAlignedVectorPythonVisitor
())
.
def
(
"tolist"
,
&
FromPythonListConverter
::
tolist
,
bp
::
arg
(
"self"
),
"Returns the aligned_vector as a Python list."
)
...
...
@@ -49,6 +50,8 @@ namespace pinocchio
// Register conversion
if
(
EnableFromPythonListConverter
)
FromPythonListConverter
::
register_converter
();
return
cl
;
}
};
}
// namespace python
...
...
bindings/python/utils/std-vector.hpp
View file @
a9c2f230
...
...
@@ -174,12 +174,13 @@ namespace pinocchio
typedef
std
::
vector
<
T
,
Allocator
>
vector_type
;
typedef
StdContainerFromPythonList
<
vector_type
>
FromPythonListConverter
;
static
void
expose
(
const
std
::
string
&
class_name
,
const
std
::
string
&
doc_string
=
""
)
static
bp
::
class_
<
vector_type
>
expose
(
const
std
::
string
&
class_name
,
const
std
::
string
&
doc_string
=
""
)
{
namespace
bp
=
boost
::
python
;
bp
::
class_
<
vector_type
>
(
class_name
.
c_str
(),
doc_string
.
c_str
())
bp
::
class_
<
vector_type
>
cl
(
class_name
.
c_str
(),
doc_string
.
c_str
());
cl
.
.
def
(
StdVectorPythonVisitor
())
.
def
(
"tolist"
,
&
FromPythonListConverter
::
tolist
,
bp
::
arg
(
"self"
),
"Returns the std::vector as a Python list."
)
...
...
@@ -188,6 +189,8 @@ namespace pinocchio
// Register conversion
if
(
EnableFromPythonListConverter
)
FromPythonListConverter
::
register_converter
();
return
cl
;
}
};
...
...
Write
Preview
Markdown
is supported
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