Skip to main content

dds_readcdr_instance

Function dds_readcdr_instance 

Source
pub unsafe extern "C" fn dds_readcdr_instance(
    reader_or_condition: dds_entity_t,
    buf: *mut *mut ddsi_serdata,
    maxs: u32,
    si: *mut dds_sample_info_t,
    handle: dds_instance_handle_t,
    mask: u32,
) -> dds_return_t
Expand description

@brief Get references to a representation of the samples of a specific instance in a reader history cache and their accompanying sample infodata values (of same type) and marking them as read @ingroup reading @component read_data

This operation returns references to the internal representation of samples (struct ddsi_serdata), which can then be used in a variety of ways. Examples are converting it to application representation and obtaining a copy or a reference of the serialized representation. If the underlying implementation (struct ddsi_sertype) is known to the application, other options may exist as well.

The data is left in the reader history cache and the sample state and view state of the returned samples and their instances are updated; @ref dds_peekcdr returns the data without updating these states; @ref dds_takecdr removes the data from the history cache.

The returned references must eventually be released by calling @ref ddsi_serdata_unref. There is no guarantee the type pointer survives beyond the existence of the reader from which the references were read.

When using a readcondition or querycondition, their masks are or’d with the given mask.

If the sample/view/instance state component in the mask is 0 and there is no read or query condition, to combine it with, it is treated as equivalent to any sample/view/instance state.

Note that this is a simple wrapper around @ref dds_read_with_collector.

@param[in] reader_or_condition Reader, readcondition or querycondition entity. @param[out] buf Filled with references @ref ddsi_serdata structures. @param[in] maxs Maximum number of samples to read. @param[out] si Filled with sample info. @param[in] handle Handle of instance from which to read samples. @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t.

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

@retval >=0 Number of samples read. @retval DDS_RETCODE_ERROR An internal error has occurred. @retval DDS_RETCODE_BAD_PARAMETER One of the given arguments is not valid. @retval DDS_RETCODE_ILLEGAL_OPERATION The operation is invoked on an inappropriate object. @retval DDS_RETCODE_ALREADY_DELETED The entity has already been deleted. @retval DDS_RETCODE_PRECONDITION_NOT_MET The instance handle has not been registered with this reader.