Skip to main content

dds_request_loan

Function dds_request_loan 

Source
pub unsafe extern "C" fn dds_request_loan(
    entity: dds_entity_t,
    sample: *mut *mut c_void,
) -> dds_return_t
Expand description

@brief Request a loan from an entity. @ingroup loan

Borrow a sample from the entity, which currently must be a writer. This sample can then be returned using @ref dds_return_loan or can be used to publish data using @ref dds_write or @ref dds_writedispose.

If the topic type has a fixed size (and so no internal pointers) and a PSMX interface is configured, the memory will be borrowed from the PSMX implementation, which allows Cyclone to avoid copies and/or serialization if there is no need for sending the data over a network interface or storing it in the WHC.

@param[in] entity The entity to request loans from. @param[out] sample Where to store the address of the loaned sample.

@returns A dds_return_t indicating success or failure.

@retval DDS_RETCODE_OK The operation was successful. @retval DDS_RETCODE_BAD_PARAMETER One or more parameters are invalid. @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_ERROR An unfortunate incident occurred.