dds_read_wl/dds_take_wl should allow to read/take all samples
dds_read_wl/dds_take_wl allows to read/take samples while loaning the memory that holds the samples themselves. However these APIs currently assume that the buf passed il pre-allocated to provide, say n slots. Why don't we allow this call to actually allocate buf when what is passed is a null pointer. We would have to change the signature, tu be able to return the newly allocated buffer, but at least we would make it possible to read all samples in one shot w/o having to issue multiple read/take and while still minimising the memory allocation.
@eboasson what are your thoughts?
A+
Absolutely.
I have to say I find the current read/take interface quite illogical even for preallocated use: I'd rather provide a buffer of some size and have it use the equivalent of a "placement new" to subdivide that buffer. So perhaps a little TLC for the read/take interface is needed in general.
I'm working on a C++ language binding (IsoCpp) on top of cyclonedds. This C++ binding will return all available samples with a single read/take. So, it would be very helpful if this is supported.
There is a un-documented kludgy 'feature' in cyclonedds that works around the problem, so I can continue for now. But it would be nice if we could replace this kludge with a proper call.