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
sot-core
Commits
78ee4f15
Commit
78ee4f15
authored
Sep 18, 2020
by
Joseph Mirabel
Committed by
Guilhem Saurel
Sep 27, 2020
Browse files
[Python] Expose Flags and signal of Flags
parent
182c7fab
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/python-module.cc
View file @
78ee4f15
#include "dynamic-graph/python/module.hh"
#include "dynamic-graph/python/signal.hh"
#include <sot/core/device.hh>
#include <sot/core/flags.hh>
namespace
dg
=
dynamicgraph
;
namespace
dgs
=
dynamicgraph
::
sot
;
...
...
@@ -44,4 +46,35 @@ BOOST_PYTHON_MODULE(wrap)
.
def_readonly
(
"before"
,
bp
::
make_function
(
&
dgs
::
Device
::
periodicCallBefore
,
reference_existing_object
()))
;
using
dgs
::
Flags
;
bp
::
class_
<
Flags
>
(
"Flags"
,
bp
::
init
<
const
bool
&>
())
.
def
(
bp
::
init
<
const
char
&>
())
.
def
(
bp
::
init
<
const
int
&>
())
.
def
(
"add"
,
static_cast
<
void
(
Flags
::*
)(
const
char
&
)
>
(
&
Flags
::
add
))
.
def
(
"add"
,
static_cast
<
void
(
Flags
::*
)(
const
int
&
)
>
(
&
Flags
::
add
))
.
def
(
"set"
,
&
Flags
::
set
)
.
def
(
"unset"
,
&
Flags
::
unset
)
.
def
(
bp
::
self
&
bool
())
.
def
(
bp
::
self
|
bool
())
.
def
(
bp
::
self
&=
bool
())
.
def
(
bp
::
self
|=
bool
())
.
def
(
"__call__"
,
&
Flags
::
operator
())
.
def
(
"__bool__"
,
&
Flags
::
operator
bool
)
.
def
(
"reversed"
,
&
Flags
::
operator
!
)
.
def
(
"set"
,
+
[](
Flags
&
f
,
const
std
::
string
&
s
)
{
std
::
istringstream
is
(
s
);
is
>>
f
;
})
.
def
(
"__str__"
,
+
[](
const
Flags
&
f
)
{
std
::
ostringstream
os
;
os
<<
f
;
return
os
.
str
();
})
;
dg
::
python
::
exposeSignalsOfType
<
Flags
,
int
>
(
"Flags"
);
}
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