how to set data writer transport use to shared memory only programtically

2 posts / 0 new
Last post
Offline
Last seen: 5 months 4 weeks ago
Joined: 09/06/2018
Posts: 22
how to set data writer transport use to shared memory only programtically

Hi,

In my application, I need to set a particular datawriter to use shared memory only. We do not want to use an XML file since we don't want to give our users any chance to change this.

I have tried the follwoing code but I keep getting an error that that '=' is not defined for the opeations or something simliar.  The docs are not clear on this(The docs emphasize over and over to use XML files.  Why?)  We are using RTI DDS 5.3.1 on RHEL 7.5 on a x64 machine.

This is the code:

DDS_DataWriterQos datawriter_qos;

if(writer->get_qos(datawriter_qos)!=DDS_RETCODE_OK){

.    .    .

}

 

datawriter_qos.transport_selection.enabled_transports = DDS_TRANSPORTBUILTIN_SHMEM_ALIAS;

What is the right way to do this without using an XML file?  We need to do this at the datawriter level.

 

tia,bernardo

Offline
Last seen: 5 months 4 weeks ago
Joined: 09/06/2018
Posts: 22

This is the solution I found that works.

char* foo[] = { DDS_TRANSPORTBUILTIN_SHMEM_ALIAS };

 

datawriter_qos.transport_selection.enabled_transports.from_array(foo,1);

writer = publisher->create_datawriter( topic, datawriter_qos,NULL, DDS_STATUS_MASK_NONE);

.

.