change initialisation of a read condition to set the query condition as well
The read condition and the query condition are represented by the same data type internally, and a read condition therefore has a "m_filter" attribute. It makes more sense to initialise this properly as part of the read condition, instead of initialisation-by-memset in the dds_create_readcond, then overwriting it in dds_create_querycond. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
fcdffa8cf8
commit
de5021dc55
3 changed files with 10 additions and 6 deletions
|
@ -18,6 +18,7 @@ _Must_inspect_result_ dds_readcond*
|
|||
dds_create_readcond(
|
||||
_In_ dds_reader *rd,
|
||||
_In_ dds_entity_kind_t kind,
|
||||
_In_ uint32_t mask);
|
||||
_In_ uint32_t mask,
|
||||
_In_opt_ dds_querycondition_filter_fn filter);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,10 +32,9 @@ dds_create_querycondition(
|
|||
|
||||
rc = dds_reader_lock(reader, &r);
|
||||
if (rc == DDS_RETCODE_OK) {
|
||||
dds_readcond *cond = dds_create_readcond(r, DDS_KIND_COND_QUERY, mask);
|
||||
dds_readcond *cond = dds_create_readcond(r, DDS_KIND_COND_QUERY, mask, filter);
|
||||
assert(cond);
|
||||
hdl = cond->m_entity.m_hdl;
|
||||
cond->m_query.m_filter = filter;
|
||||
dds_reader_unlock(r);
|
||||
} else {
|
||||
DDS_ERROR("Error occurred on locking reader\n");
|
||||
|
|
|
@ -31,10 +31,11 @@ _Must_inspect_result_ dds_readcond*
|
|||
dds_create_readcond(
|
||||
_In_ dds_reader *rd,
|
||||
_In_ dds_entity_kind_t kind,
|
||||
_In_ uint32_t mask)
|
||||
_In_ uint32_t mask,
|
||||
_In_opt_ dds_querycondition_filter_fn filter)
|
||||
{
|
||||
dds_readcond * cond = dds_alloc(sizeof(*cond));
|
||||
assert(kind == DDS_KIND_COND_READ || kind == DDS_KIND_COND_QUERY);
|
||||
assert((kind == DDS_KIND_COND_READ && filter == 0) || (kind == DDS_KIND_COND_QUERY && filter != 0));
|
||||
cond->m_entity.m_hdl = dds_entity_init(&cond->m_entity, (dds_entity*)rd, kind, NULL, NULL, 0);
|
||||
cond->m_entity.m_deriver.delete = dds_readcond_delete;
|
||||
cond->m_rhc = rd->m_rd->rhc;
|
||||
|
@ -42,6 +43,9 @@ dds_create_readcond(
|
|||
cond->m_view_states = mask & DDS_ANY_VIEW_STATE;
|
||||
cond->m_instance_states = mask & DDS_ANY_INSTANCE_STATE;
|
||||
cond->m_rd_guid = rd->m_entity.m_guid;
|
||||
if (kind == DDS_KIND_COND_QUERY) {
|
||||
cond->m_query.m_filter = filter;
|
||||
}
|
||||
dds_rhc_add_readcondition (cond);
|
||||
return cond;
|
||||
}
|
||||
|
@ -58,7 +62,7 @@ dds_create_readcondition(
|
|||
|
||||
rc = dds_reader_lock(reader, &rd);
|
||||
if (rc == DDS_RETCODE_OK) {
|
||||
dds_readcond *cond = dds_create_readcond(rd, DDS_KIND_COND_READ, mask);
|
||||
dds_readcond *cond = dds_create_readcond(rd, DDS_KIND_COND_READ, mask, 0);
|
||||
assert(cond);
|
||||
hdl = cond->m_entity.m_hdl;
|
||||
dds_reader_unlock(rd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue