Skip to content

Commit

Permalink
Fixed bugs in GuardCondition handlers, minor modifications to examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Chiesa committed May 19, 2020
1 parent 17ccf01 commit 97e2dc9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
2 changes: 2 additions & 0 deletions connextdds/include/PyCondition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class PyGuardCondition : public dds::core::cond::GuardCondition, public PyICondi
public:
using dds::core::cond::GuardCondition::GuardCondition;

PyGuardCondition() : dds::core::cond::GuardCondition() {}

PyGuardCondition(const dds::core::cond::GuardCondition& gc) : dds::core::cond::GuardCondition(gc) {}

dds::core::cond::Condition get_condition() override {
Expand Down
19 changes: 1 addition & 18 deletions connextdds/src/dds/core/cond/GuardCondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@ void init_class_defs(py::class_<PyGuardCondition, PyICondition>& cls) {
py::init<>(),
"Create a GuardCondition in an untriggered state."
)
.def(
py::init(
[](std::function<void(py::object)>& func) {
PyGuardCondition gc;
gc->handler(
[&func](dds::core::cond::Condition c) {
py::gil_scoped_acquire acquire;
auto gc = dds::core::polymorphic_cast<dds::core::cond::GuardCondition>(c);
func(py::cast(PyGuardCondition(gc)));
}
);
return gc;
}
),
py::arg("handler"),
"Create a GuardCondition in an untriggered state with a handler function."
)
.def(
py::init(
[](PyICondition& c) {
Expand All @@ -42,7 +25,7 @@ void init_class_defs(py::class_<PyGuardCondition, PyICondition>& cls) {
"handler",
[](PyGuardCondition& gc, std::function<void(PyICondition*)>& func) {
gc->handler(
[&func](dds::core::cond::Condition c) {
[func](dds::core::cond::Condition c) {
py::gil_scoped_acquire acquire;
auto py_c = dds::core::polymorphic_cast<PyGuardCondition>(c);
func(&py_c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def create_typecode_outer_struct():
loaned_inner.data['y'] = 0.00001

print(loaned_inner.data)
print('+ current outer_data value')
print(outer_data)

print('+ current outer_data value')
print(outer_data)

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def publisher_main(domain_id, sample_count):

count = 0
while (sample_count == 0) or (count < sample_count):
print('Writing waitset_query_cond, count = {}'.format(count))
print('Writing Foo, count = {}'.format(count))
sample['x'] = count
writer.write(sample)

Expand Down

0 comments on commit 97e2dc9

Please sign in to comment.