How to generate a constructor that takes into account class hierarchy?

2 posts / 0 new
Last post
Offline
Last seen: 3 years 8 months ago
Joined: 02/05/2016
Posts: 1
How to generate a constructor that takes into account class hierarchy?

Hello,

Let say I have 2 IDL files, one for each struct:

module myModule {
   struct Parent {
      long a;
   }
}
module myModule {
   struct Child : Parent {
      double b;
   }
}

rtiddsgen will generate a few java files for both IDLs. I would like to generate a constructor that looks like this:

public Parent(int a) {
   this.a = a;
} 
public Child(int a, double b) {
   super(a);
   this.b = b;
}

The Parent constructor is easy to generate, because the variable $constructMap.memberFieldMapList contains all the info I need.

But the constructor of the Child class seams impossible to do. The variable $constructMap.memberFieldMapList constains the info for "b", but not for "a" from the Parent class.

I know of $constructMap.baseTypeFQName, but that's just the name.

Is there a way to do what I want?

 

Thank you for any help

Guillaume

 

Offline
Last seen: 1 year 3 months ago
Joined: 01/17/2013
Posts: 23

Hi Guillaume,

I'm affraid that information is not avaliable in the existing variables for Java.  We do have it for the Modern C++ languages (C++03, and C++11) with the variable baseTypeMembers, but it is only avaliable when generating for those languages. 

I have created a RFE so we populate that variable for other languages as well. 

Best regards,

Aida