support for query conditions
This also fixes #87. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
b21c7f032c
commit
f0675ca7f1
4 changed files with 477 additions and 318 deletions
|
@ -64,7 +64,7 @@ dds_rhc_take(
|
||||||
|
|
||||||
void dds_rhc_set_qos (struct rhc * rhc, const struct nn_xqos * qos);
|
void dds_rhc_set_qos (struct rhc * rhc, const struct nn_xqos * qos);
|
||||||
|
|
||||||
void dds_rhc_add_readcondition (dds_readcond * cond);
|
bool dds_rhc_add_readcondition (dds_readcond * cond);
|
||||||
void dds_rhc_remove_readcondition (dds_readcond * cond);
|
void dds_rhc_remove_readcondition (dds_readcond * cond);
|
||||||
|
|
||||||
bool dds_rhc_add_waitset (dds_readcond * cond, dds_waitset * waitset, dds_attach_t x);
|
bool dds_rhc_add_waitset (dds_readcond * cond, dds_waitset * waitset, dds_attach_t x);
|
||||||
|
|
|
@ -34,8 +34,14 @@ dds_create_querycondition(
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
dds_readcond *cond = dds_create_readcond(r, DDS_KIND_COND_QUERY, mask, filter);
|
dds_readcond *cond = dds_create_readcond(r, DDS_KIND_COND_QUERY, mask, filter);
|
||||||
assert(cond);
|
assert(cond);
|
||||||
hdl = cond->m_entity.m_hdl;
|
const bool success = (cond->m_entity.m_deriver.delete != 0);
|
||||||
dds_reader_unlock(r);
|
dds_reader_unlock(r);
|
||||||
|
if (success) {
|
||||||
|
hdl = cond->m_entity.m_hdl;
|
||||||
|
} else {
|
||||||
|
dds_delete (cond->m_entity.m_hdl);
|
||||||
|
hdl = DDS_ERRNO(DDS_RETCODE_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DDS_ERROR("Error occurred on locking reader\n");
|
DDS_ERROR("Error occurred on locking reader\n");
|
||||||
hdl = DDS_ERRNO(rc);
|
hdl = DDS_ERRNO(rc);
|
||||||
|
|
|
@ -47,7 +47,12 @@ dds_create_readcond(
|
||||||
cond->m_query.m_filter = filter;
|
cond->m_query.m_filter = filter;
|
||||||
cond->m_query.m_index = UINT_MAX;
|
cond->m_query.m_index = UINT_MAX;
|
||||||
}
|
}
|
||||||
dds_rhc_add_readcondition (cond);
|
if (!dds_rhc_add_readcondition (cond)) {
|
||||||
|
/* FIXME: current entity management code can't deal with an error late in the creation of the
|
||||||
|
entity because it doesn't allow deleting it again ... instead use a hack to signal a problem
|
||||||
|
to the caller and let that one handle it. */
|
||||||
|
cond->m_entity.m_deriver.delete = 0;
|
||||||
|
}
|
||||||
return cond;
|
return cond;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +70,7 @@ dds_create_readcondition(
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
dds_readcond *cond = dds_create_readcond(rd, DDS_KIND_COND_READ, mask, 0);
|
dds_readcond *cond = dds_create_readcond(rd, DDS_KIND_COND_READ, mask, 0);
|
||||||
assert(cond);
|
assert(cond);
|
||||||
|
assert(cond->m_entity.m_deriver.delete);
|
||||||
hdl = cond->m_entity.m_hdl;
|
hdl = cond->m_entity.m_hdl;
|
||||||
dds_reader_unlock(rd);
|
dds_reader_unlock(rd);
|
||||||
} else {
|
} else {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue