Polymorphism

Subscriber is not receiving all fields from polymorphic types. And based on what I have read on this Forum, I think this might be the expected behavior.

I am using Java and my IDL looks like this:

struct Container {sequence<Parent> items; };

struct Parent { string lastName; }:

struct Child : Parent { string firstName; };

PROBLEM:

If I create Child instances and add them to Container.items, the Publisher seems to publish firstName and lastName, but the Subscriber only receives lastName. That is, it doesn't see the fields implemented in the subclass.

Is there some way to get the polymorphism to work such that the Subscriber receives all of the fields associated with the runtime type that was published?

1. How do you know that the publishers publishes the first name? did you use wireshark and a dissector?

2. When you are not using the dynamic data api, rti will use statically compiled libraries to deserialize incoming data. since the type of Container is statically defined to work with a sequence of parents, i guess it is statically bound to work with parents, not children.

3. Other approaches that support do "polymorphism" are using UNIONS and using optional fields. (for example, making the sequence a sequence of "people", using a field to determine type of person, parent or child, and using an optional field firstName that has some default value that can be ignored)

RTI Community Portal Terms of Use

NOTICE: Any content you submit to the RTI Research Community Portal, including personal information, is not subject to the protections which may be afforded to information collected under other sections of RTI's Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via RTI Community Portal. RTI does not control the content posted by visitors to RTI Community Portal and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will RTI be liable in any way for any content not authored by RTI, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via RTI Community Portal. Read the complete Terms prior to use.