[IDL] How To Define void*

2 posts / 0 new
Last post
Last seen: 8 years 1 month ago
Joined: 01/09/2016
Posts: 8
[IDL] How To Define void*


I'm tryig to find a way to use DDS to publish some data struct that contains a void* member. Ths void* variable will point to an image. The conceptual issue I'm facing is the size of the data. How can DDS know upfront the size of whatever it is I'm sending in void*?

Sorry if the question doesn't make a lot of sense.

rip's picture
Last seen: 4 days 7 hours ago
Joined: 04/06/2012
Posts: 324

Primarily it does not make sense because a void * is a pointer to a block of memory.  If you send a pointer to a block of memory... like "0x44ee1210", the value 0x44ee1210 gets sent.

Who knows what that is pointing at by a remote application.  It may not even be mapped, causing the machine to flat out crash -- probably not what you want.

struct ImageChunk {
    long long id; //@key
    long last; // set to 0 until the last chunk, then 1, or set to number of segments coming and decrement on each until 0
    sequence<octet, 16384> chunk;

Chunk the image into 16k segments, fill a sequence of samples and send them.  Subscriber then rebuilds the file from the segments.  Or use 5.2.0's unbounded sequence (of octet)

but:  DDS is not apt for sending files.  It's better to send a noticethat a file is available at a given url, and then let your subscriber use curl or sftp or some dedicated file-transfer protocol to pull the file, and simply send a "got it" back once it has it.