Function dds_takecdr_instance

Function Documentation

dds_return_t dds_takecdr_instance(dds_entity_t reader_or_condition, struct ddsi_serdata **buf, uint32_t maxs, dds_sample_info_t *si, dds_instance_handle_t handle, uint32_t mask)

Access the collection of serialized data values (of same type) and sample info from the data reader, readcondition or querycondition scoped by the provided instance handle..

This operation implements the same functionality as dds_take_instance_wl, except that samples are now in their serialized form. The serialized data is made available through ddsi_serdata structures. Returned samples are marked as READ.

Return value provides information about the number of samples read, which will be <= maxs. Based on the count, the buffer will contain serialized data to be read only when valid_data bit in sample info structure is set. The buffer required for data values, could be allocated explicitly or can use the memory from data reader to prevent copy. In the latter case, buffer and sample_info should be returned back, once it is no longer using the data.

Parameters
  • reader_or_condition[in] Reader, readcondition or querycondition entity.

  • buf[out] An array of pointers to ddsi_serdata structures that contain the serialized data. The pointers can be NULL.

  • maxs[in] Maximum number of samples to read.

  • si[out] Pointer to an array of dds_sample_info_t returned for each data value.

  • handle[in] Instance handle related to the samples to read.

  • mask[in] Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t.

Return values
  • >=0 – Number of samples read.

  • DDS_RETCODE_ERROR – An internal error has occurred.

  • DDS_RETCODE_BAD_PARAMETER – One of the given arguments is not valid.

  • DDS_RETCODE_ILLEGAL_OPERATION – The operation is invoked on an inappropriate object.

  • DDS_RETCODE_ALREADY_DELETED – The entity has already been deleted.

  • DDS_RETCODE_PRECONDITION_NOT_MET – The instance handle has not been registered with this reader.

Returns

A dds_return_t with the number of samples read or an error code.