How to publish union values that has structure members using luafile??

1 post / 0 new
Offline
Last seen: 5 years 3 months ago
Joined: 09/09/2019
Posts: 1
How to publish union values that has structure members using luafile??

I have the following IDL file:

------------------------------------------------------------------

module config {

const string Topic = "Topic";

enum MessageType
{
REQUEST,
RESPONSE
};

struct Request
{
long spare;
};

struct Response
{
string<32> Id;
string<32> Date;
boolean force;
};

union MessageUnion switch ( MessageType )
{
case REQUEST:
Request request;
case RESPONSE:
Response response;
};
};

------------------------------------------------------------------

The equivalent xml is:

------------------------------------------------------------------

<types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:////home/testsetup/rti_connext_dds-5.3.0/bin/../resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.xsd">
<module name="config">
<const name="Topic" type="string" value="&quot;Topic&quot;"/>
<enum name="MessageType">
<enumerator name="REQUEST"/>
<enumerator name="RESPONSE"/>
</enum>
<struct name= "Request">
<member name="spare" type="int32"/>
</struct>
<struct name= "Response">
<member name="Id" stringMaxLength="32" type="string"/>
<member name="Date" stringMaxLength="32" type="string"/>
<member name="force" type="boolean"/>
</struct>
<union name="MessageUnion">
<discriminator type="nonBasic" nonBasicTypeName="config::MessageType"/>
<case>
<caseDiscriminator value="(config::REQUEST)"/>
<member name="request" type="nonBasic" nonBasicTypeName= "config::Request"/>
</case>
<case>
<caseDiscriminator value="(config::RESPONSE)"/>
<member name="response" type="nonBasic" nonBasicTypeName= "config::Response"/>
</case>
</union>
</module>
</types>

------------------------------------------------------------------

I want to :

- publish the union with request structure

- subscribe the union with response structure

I am unable to figure out how to publish the union that has member as a structure.

Kindly help asap