posted on Thursday, January 13, 2011 - 03:14 am
Regarding FooDataReader.return_loan(...), the DDS 1.2 spec states "During the loan, the DataReader will guarantee that the data and sample-information are not modified."
I presume that this guarantee applies only to the copy of samples and sample info already read.
Specifically, another call to read(...) on the same DataReader would retrieve the most recent samples, possibly a superset of those already read, including new samples for which the generation_rank is now 0.
The previous copy on loan would still include samples having generation_rank of 0, even though that sample and corresponding generation_rank are now out of date. The more recent copy on loan would perhaps have a generation_rank of 1 for the same sample.
The DDS specification states that while an application is holding a loan nor the data nor the sample information will be modified.
This means that if you nest another "loaned" read/take before returning the current loan, a DDS implementation will have to re-compute the sample info for the samples being read and return the newly computed list of sample info as part of the new loan.
It is also worth noticing that it is perfectly correct to have different the sample info lists for the two subsequents read/take as they reflect the state of when you read/took the data.
Finally, notice that this behaviour is not in conflict with the zero-copy semantics of data, yet it requires coping over the sample info but the data structures are relatively small.