Does Sample Loaning (not in data-sharing) require bounded type? #5087
-
related discusstions: #3654 I got the idea that sample loaning is not only possible with data-sharing, but also can be applied to other delivery mechanisms. What are the constraints to use loaning?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @zoeeer, The bounded type is a data-sharing requirement, not related to loans. So as a summary, loans can always be used in the DataReader. Loans can only be used by a DataWriter when the type is plain. If using loans in DataWriter and DataReader, and if the type is plain, and if the delivery mechanism is data-sharing or intra-process, then the communication would be performed without any additional copy (zero-copy). |
Beta Was this translation helpful? Give feedback.
Hi @zoeeer,
There is a distinction between using loans in the DataWriter and the DataReader.
It is mandatory for the type to be plain to use loans in the DataWriter.
It is NOT mandatory for the type to be plain to use loans in the DataReader.
If it is not plain, DataReader requests TypeSupport the data and deserializes that payload.
The bounded type is a data-sharing requirement, not related to loans.
It may not be very clear because the related discussion linked was related to the zero-copy mechanism, which is a combination of loans and data-sharing.
Zero-copy's constraint is the type to be plain. And if the type is plain, it is already bounded (it is a conditional statement: If plain th…