replace temporary hack that is dds_writecdr by a better but nonetheless still temporary hack
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
bfb5874373
commit
f4824b0b5d
5 changed files with 25 additions and 34 deletions
|
@ -55,6 +55,9 @@ typedef _Return_type_success_(return > 0) int32_t dds_entity_t;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* FIXME: rename serdata, abstract it properly, etc */
|
||||||
|
struct serdata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the default domain identifier.
|
* @brief Returns the default domain identifier.
|
||||||
*
|
*
|
||||||
|
@ -1707,8 +1710,7 @@ _Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
||||||
DDS_EXPORT int
|
DDS_EXPORT int
|
||||||
dds_writecdr(
|
dds_writecdr(
|
||||||
dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
const void *cdr,
|
struct serdata *serdata);
|
||||||
size_t size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write the value of a data instance along with the source timestamp passed.
|
* @brief Write the value of a data instance along with the source timestamp passed.
|
||||||
|
@ -2717,8 +2719,6 @@ dds_take_mask_wl(
|
||||||
_In_ uint32_t maxs,
|
_In_ uint32_t maxs,
|
||||||
_In_ uint32_t mask);
|
_In_ uint32_t mask);
|
||||||
|
|
||||||
struct serdata;
|
|
||||||
|
|
||||||
DDS_EXPORT int
|
DDS_EXPORT int
|
||||||
dds_takecdr(
|
dds_takecdr(
|
||||||
dds_entity_t reader_or_condition,
|
dds_entity_t reader_or_condition,
|
||||||
|
|
|
@ -108,6 +108,10 @@ const char *
|
||||||
dds__entity_kind_str(
|
dds__entity_kind_str(
|
||||||
_In_ dds_entity_t e);
|
_In_ dds_entity_t e);
|
||||||
|
|
||||||
|
dds_domain *
|
||||||
|
dds__entity_domain(
|
||||||
|
_In_ dds_entity* e);
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,12 +39,10 @@ dds_write_impl(
|
||||||
int
|
int
|
||||||
dds_writecdr_impl(
|
dds_writecdr_impl(
|
||||||
_In_ dds_writer *wr,
|
_In_ dds_writer *wr,
|
||||||
_In_ const void *cdr,
|
_Inout_ struct serdata *d,
|
||||||
_In_ size_t sz,
|
|
||||||
_In_ dds_time_t tstamp,
|
_In_ dds_time_t tstamp,
|
||||||
_In_ dds_write_action action);
|
_In_ dds_write_action action);
|
||||||
|
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,6 +46,12 @@ dds_entity_add_ref(_In_ dds_entity * e)
|
||||||
os_mutexUnlock (&e->m_mutex);
|
os_mutexUnlock (&e->m_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dds_domain *
|
||||||
|
dds__entity_domain(_In_ dds_entity* e)
|
||||||
|
{
|
||||||
|
return e->m_domain;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dds_set_explicit(
|
dds_set_explicit(
|
||||||
_In_ dds_entity_t entity);
|
_In_ dds_entity_t entity);
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "ddsi/q_radmin.h"
|
#include "ddsi/q_radmin.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
_Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
||||||
dds_return_t
|
dds_return_t
|
||||||
dds_write(
|
dds_write(
|
||||||
|
@ -58,16 +57,15 @@ _Pre_satisfies_((writer & DDS_ENTITY_KIND_MASK) == DDS_KIND_WRITER)
|
||||||
int
|
int
|
||||||
dds_writecdr(
|
dds_writecdr(
|
||||||
dds_entity_t writer,
|
dds_entity_t writer,
|
||||||
const void *cdr,
|
struct serdata *serdata)
|
||||||
size_t size)
|
|
||||||
{
|
{
|
||||||
dds_return_t ret;
|
dds_return_t ret;
|
||||||
dds__retcode_t rc;
|
dds__retcode_t rc;
|
||||||
dds_writer *wr;
|
dds_writer *wr;
|
||||||
if (cdr != NULL) {
|
if (serdata != NULL) {
|
||||||
rc = dds_writer_lock(writer, &wr);
|
rc = dds_writer_lock(writer, &wr);
|
||||||
if (rc == DDS_RETCODE_OK) {
|
if (rc == DDS_RETCODE_OK) {
|
||||||
ret = dds_writecdr_impl (wr, cdr, size, dds_time (), 0);
|
ret = dds_writecdr_impl (wr, serdata, dds_time (), 0);
|
||||||
dds_writer_unlock(wr);
|
dds_writer_unlock(wr);
|
||||||
} else {
|
} else {
|
||||||
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
|
ret = DDS_ERRNO(rc, "Error occurred on locking writer");
|
||||||
|
@ -257,24 +255,21 @@ filtered:
|
||||||
|
|
||||||
int
|
int
|
||||||
dds_writecdr_impl(
|
dds_writecdr_impl(
|
||||||
_In_ dds_writer *wr,
|
_In_ dds_writer *wr,
|
||||||
_In_ const void *cdr,
|
_Inout_ serdata_t d,
|
||||||
_In_ size_t sz,
|
_In_ dds_time_t tstamp,
|
||||||
_In_ dds_time_t tstamp,
|
_In_ dds_write_action action)
|
||||||
_In_ dds_write_action action)
|
|
||||||
{
|
{
|
||||||
int ret = DDS_RETCODE_OK;
|
int ret = DDS_RETCODE_OK;
|
||||||
int w_rc;
|
int w_rc;
|
||||||
|
|
||||||
assert (wr);
|
assert (wr);
|
||||||
assert (cdr);
|
|
||||||
|
|
||||||
struct thread_state1 * const thr = lookup_thread_state ();
|
struct thread_state1 * const thr = lookup_thread_state ();
|
||||||
const bool asleep = !vtime_awake_p (thr->vtime);
|
const bool asleep = !vtime_awake_p (thr->vtime);
|
||||||
const bool writekey = action & DDS_WR_KEY_BIT;
|
const bool writekey = action & DDS_WR_KEY_BIT;
|
||||||
struct writer * ddsi_wr = wr->m_wr;
|
struct writer * ddsi_wr = wr->m_wr;
|
||||||
struct tkmap_instance * tk;
|
struct tkmap_instance * tk;
|
||||||
serdata_t d;
|
|
||||||
|
|
||||||
/* Check for topic filter */
|
/* Check for topic filter */
|
||||||
if (ddsi_wr->topic->filter_fn && ! writekey) {
|
if (ddsi_wr->topic->filter_fn && ! writekey) {
|
||||||
|
@ -285,22 +280,10 @@ dds_writecdr_impl(
|
||||||
thread_state_awake (thr);
|
thread_state_awake (thr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Serialize and write data or key */
|
|
||||||
{
|
|
||||||
serstate_t st = ddsi_serstate_new (ddsi_wr->topic);
|
|
||||||
dds_stream_t is;
|
|
||||||
ddsi_serstate_append_blob(st, 1, sz, cdr);
|
|
||||||
d = ddsi_serstate_fix(st);
|
|
||||||
assert(d->v.keyhash.m_flags == 0);
|
|
||||||
assert(!d->v.bswap);
|
|
||||||
dds_stream_from_serstate (&is, d->v.st);
|
|
||||||
d->v.st->kind = writekey ? STK_KEY : STK_DATA;
|
|
||||||
dds_stream_read_keyhash (&is, &d->v.keyhash, ddsi_wr->topic->status_cb_entity->m_descriptor, d->v.st->kind == STK_KEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set if disposing or unregistering */
|
/* Set if disposing or unregistering */
|
||||||
d->v.msginfo.statusinfo = ((action & DDS_WR_DISPOSE_BIT ) ? NN_STATUSINFO_DISPOSE : 0) |
|
d->v.msginfo.statusinfo =
|
||||||
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
|
((action & DDS_WR_DISPOSE_BIT ) ? NN_STATUSINFO_DISPOSE : 0) |
|
||||||
|
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
|
||||||
d->v.msginfo.timestamp.v = tstamp;
|
d->v.msginfo.timestamp.v = tstamp;
|
||||||
os_mutexLock (&wr->m_call_lock);
|
os_mutexLock (&wr->m_call_lock);
|
||||||
ddsi_serdata_ref(d);
|
ddsi_serdata_ref(d);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue