DDS_DomainParticipantFactoryQos factory_qos; if (factory->get_qos(factory_qos) != DDS_RETCODE_OK) { printf("***Error: failed to get domain participant factory qos\n"); } /* Change the QosPolicy to create disabled participants */ factory_qos.entity_factory.autoenable_created_entities = DDS_BOOLEAN_FALSE; if (factory->set_qos(factory_qos) != DDS_RETCODE_OK) { printf("***Error: failed to set domain participant factory qos\n"); }
DDSDomainParticipantFactory* factory = NULL; factory = DDSDomainParticipantFactory::get_instance(); if (factory == NULL) { // ... error }
struct DDS_DomainParticipantQos participant_qos; DDS_DomainParticipant* participant; struct DDS_DomainParticipantListener participant_listener; DDS_ReturnCode_t retcode; /* Set the initial peers. These list all the computers the application may communicate with along with the maximum number of RTI Data Distribution Service participants that can concurrently run on that computer. This list only needs to be a superset of the actual list of computers and participants that will be running at any time. */ const char* NDDS_DISCOVERY_INITIAL_PEERS[] = { "host1", "10.10.30.192", "1@localhost", "2@host2", "my://", /* all unicast addresses on transport plugins with alias "my" */ "2@shmem://", /* shared memory */ "FF00:ABCD::0", "sf://0/0/R", /* StarFabric transport plugin */ "1@FF00:0:1234::0", "225.1.2.3", "3@225.1.0.55", "FAA0::0#0/0/R", }; /* initialize participant_qos with default values */ retcode = DDS_DomainParticipantFactory_get_default_participant_qos(factory, &participant_qos); if (retcode != DDS_RETCODE_OK) { printf("***Error: failed to get default participant qos\n"); } if (!DDS_StringSeq_from_array(&participant_qos.discovery.initial_peers, NDDS_DISCOVERY_INITIAL_PEERS, NDDS_DISCOVERY_INITIAL_PEERS_LENGTH)) { printf("***Error: failed to set discovery.initial_peers qos\n"); } // Create the participant DDSDomainParticipant* participant = factory->create_participant(domain_id, participant_qos, participant_listener, DDS_STATUS_MASK_NONE); if (participant == NULL) { printf("***Error: failed to create domain participant\n"); }; return participant;
DDS_ReturnCode_t retcode; retcode = factory->delete_participant(participant); if (retcode != DDS_RETCODE_OK) { // ... check for cause of failure }