IDL and abstract types

2 posts / 0 new
Last post
Offline
Last seen: 10 years 1 day ago
Joined: 07/29/2013
Posts: 7
IDL and abstract types

Hello,

Does the IDL format support abstract types? How would I go about implementing that?


The following does not work, unfortunately. rtiddsgen seems to fail when parsing struct A.

struct A {
}; // @top-level false
 
struct B : A {
  long someType;
}; // @top-level false
 
struct C : A {
  double someType;
}; // @top-level false
 
struct User {
  A dataField
};

 

Keywords:
rip
rip's picture
Offline
Last seen: 17 hours 43 min ago
Joined: 04/06/2012
Posts: 324

Hi,

The construction you have, an empty struct element is invalid (as per idl-spec.pdf, member_list ::= <member>+ )

Generally we see engineers trying this the other way around (a struct with elements is then inherited by further structs with no elements:

struct FooType {
    long proxyTooInvolved;
};
valuetype Bar : FooType {
};
valuetype Fnorb : FooType {
};

 because it gives them two Types (Bar and Fnorb) which can then diverge at some point in the future, and it also allows them to use Bar as both the Topic and Type, and Fnorb as Topic and Type to "simplify". 

But the spec doesn't allow it.  I'll leave the "abstract type" requirement and use case to others to discuss. 

rip