FooPlugin_get_serialized_sample_size() not found

5 posts / 0 new
Last post
Offline
Last seen: 9 months 1 week ago
Joined: 09/07/2018
Posts: 10
FooPlugin_get_serialized_sample_size() not found

 

I am trying to port some code from Connext v5.3 to v7.2 and I ran into a problem with rtiddsgen no longer generating the following functions:

FooPlugin_get_serialized_sample_size()  and  FooPlugin_get_serialized_sample_min_size().

The only version of the functions available seems to be FooPlugin_get_serialized_sample_max_size()

Is there a way to still access these functions in Connext v7.2?

Or is there an alternative for FooPlugin_get_serialized_sample_size() ?

 

Howard's picture
Offline
Last seen: 20 hours 29 min ago
Joined: 11/29/2012
Posts: 610

Fundamentally, you have to call

FooPlugin_serialize_to_cdr_buffer()

which will return the length of the serialized buffer after serialization.

Offline
Last seen: 9 months 1 week ago
Joined: 09/07/2018
Posts: 10

 

That's disappointing.

Thanks non the less.

 

Howard's picture
Offline
Last seen: 20 hours 29 min ago
Joined: 11/29/2012
Posts: 610

Hi Chris,

So, I got this from more knowledgeable folks at RTI...

You can call
 
FooTypeSupport::serialize_data_to_cdr_buffer_ex()
 
with a NULL buffer. In this case it just returns the size of the buffer required.
 
This is the new “official” API to do this.
 

If the buffer passed to serialize_data_to_cdr_buffer_ex in RTI Connext Professional is NULL, the function will not perform serialization but instead will calculate and return the required buffer size for serialization. This behavior allows the caller to determine the appropriate buffer size needed to serialize the data without actually performing the serialization. Once the required size is known, the caller can allocate a buffer of the appropriate size and call the function again with a non-NULL buffer to perform the actual serialization.

Offline
Last seen: 9 months 1 week ago
Joined: 09/07/2018
Posts: 10

 

I can use that.  Thanks Howard!