cyclonedds icon indicating copy to clipboard operation
cyclonedds copied to clipboard

dds_read_wl/dds_take_wl should allow to read/take all samples

Open kydos opened this issue 7 years ago • 2 comments

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+

kydos avatar Dec 12 '18 09:12 kydos

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.

eboasson avatar Dec 12 '18 16:12 eboasson

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.

martinbremmer avatar May 22 '19 16:05 martinbremmer