How to determine topic size

2 posts / 0 new
Last post
Hassan's picture
Last seen: 3 years 7 months ago
Joined: 03/14/2015
Posts: 7
How to determine topic size

Hello Everyone,

                      I have generated my code using rtiddsgen utility through idl file and code is running quite well. Now I am wondering what is the size of my topic. 
I have searched alot about it but could not find out the answer. Can anyone please tell me how I can know the size of topic.

Gerardo Pardo's picture
Last seen: 1 month 1 week ago
Joined: 06/02/2010
Posts: 591


I am not sure what you mean by "the size of my topic". The Topic has an associated data-type (e.g. Foo) and when you use it you end up creating data-objects (e.g. a foo_object) of that data type.

Are you talking about the size of the memory allocated when you create the foo_object. Or are you talking about the size needed to serialize the foo_object into a stream of bytes to send it on the network? Or is it something else?

Either way the type (Foo) does not have a size per se, it is the object (foo_object) that have sizes. For some types all objects may have the same size. But for many other types (e.g. those containing strings or sequences) the size would depend on the specific object.

If you used IDL to define your type, the code generated by rtiddsgen has some utility functions that help figure out some of these sizes. For example for a type FooType you will see these functions:

  • FooTypePlugin_get_serialized_sample_max_size -- Computes the mazimum serialized size of any data-object of type FooType
  • FooypePlugin_get_serialized_sample_size(foo_object) -- COmpute the serialized size of a specific data object (foo_object) of that type