Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
sot-core
Commits
0c0e089a
Commit
0c0e089a
authored
4 years ago
by
Joseph Mirabel
Committed by
Guilhem Saurel
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Python] Add constructor of Flags from list or tuple.
parent
c1c85134
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/sot/core/flags.hh
+1
-1
1 addition, 1 deletion
include/sot/core/flags.hh
src/python-module.cc
+10
-1
10 additions, 1 deletion
src/python-module.cc
src/sot/flags.cpp
+1
-1
1 addition, 1 deletion
src/sot/flags.cpp
with
12 additions
and
3 deletions
include/sot/core/flags.hh
+
1
−
1
View file @
0c0e089a
...
...
@@ -37,7 +37,7 @@ protected:
public:
Flags
(
const
bool
&
b
=
false
);
Flags
(
const
char
*
flags
);
Flags
(
std
::
vector
<
bool
>
&
&
flags
);
Flags
(
const
std
::
vector
<
bool
>
&
flags
);
void
add
(
const
bool
&
b
);
...
...
This diff is collapsed.
Click to expand it.
src/python-module.cc
+
10
−
1
View file @
0c0e089a
...
...
@@ -50,7 +50,16 @@ BOOST_PYTHON_MODULE(wrap)
using
dgs
::
Flags
;
bp
::
class_
<
Flags
>
(
"Flags"
,
bp
::
init
<>
())
.
def
(
bp
::
init
<
const
char
*>
())
//TODO .def(bp::init<std::vector<bool>&& >())
.
def
(
"__init__"
,
bp
::
make_constructor
(
+
[](
bp
::
list
bools
)
{
std
::
vector
<
bool
>
flags
(
bp
::
len
(
bools
));
for
(
std
::
size_t
i
=
0
;
i
<
flags
.
size
();
++
i
)
flags
[
i
]
=
bp
::
extract
<
bool
>
(
bools
[
i
]);
return
new
Flags
(
flags
);
}))
.
def
(
"__init__"
,
bp
::
make_constructor
(
+
[](
bp
::
tuple
bools
)
{
std
::
vector
<
bool
>
flags
(
bp
::
len
(
bools
));
for
(
std
::
size_t
i
=
0
;
i
<
flags
.
size
();
++
i
)
flags
[
i
]
=
bp
::
extract
<
bool
>
(
bools
[
i
]);
return
new
Flags
(
flags
);
}))
.
def
(
"add"
,
&
Flags
::
add
)
.
def
(
"set"
,
&
Flags
::
set
)
.
def
(
"unset"
,
&
Flags
::
unset
)
...
...
This diff is collapsed.
Click to expand it.
src/sot/flags.cpp
+
1
−
1
View file @
0c0e089a
...
...
@@ -47,7 +47,7 @@ Flags::Flags(const char *_flags)
}
}
Flags
::
Flags
(
std
::
vector
<
bool
>
&
&
_flags
)
Flags
::
Flags
(
const
std
::
vector
<
bool
>
&
_flags
)
:
flags
(
_flags
),
outOfRangeFlag
(
false
)
{}
Flags
::
operator
bool
(
void
)
const
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment