DDS::DomainParticipant_var TestBase::create_participant() { DDS::DomainId_t domain = DEFAULT_DOMAIN; DDS::DomainParticipantQos qos; DDS::DomainParticipantFactory_var dpf = TheParticipantFactory; if (dpf->get_default_participant_qos(qos) != DDS::RETCODE_OK) { ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: %N:%l: create_participant() -") ACE_TEXT(" get_default_participant_qos failed!\n"))); ACE_OS::exit(-1); } DDS::DomainParticipantListener_ptr listener = DDS::DomainParticipantListener::_nil(); DDS::StatusMask status = OpenDDS::DCPS::DEFAULT_STATUS_MASK; if (init_participant(domain, qos, listener, status) != DDS::RETCODE_OK) { ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: %N:%l: create_participant() -") ACE_TEXT(" init_participant failed!\n"))); ACE_OS::exit(-1); } DDS::DomainParticipant_var participant = dpf->create_participant(domain, qos, listener, status); if (CORBA::is_nil(participant.in())) { ACE_ERROR((LM_ERROR, ACE_TEXT("ERROR: %N:%l: create_participant() -") ACE_TEXT(" create_participant failed!\n"))); ACE_OS::exit(-1); } return participant; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { int result = 0; ACE_DEBUG ((LM_DEBUG, "(%P|%t) subscriber main\n")); try { DDS::DomainParticipantFactory_var dpf; DDS::DomainParticipant_var participant; dpf = TheParticipantFactoryWithArgs(argc, argv); if (parse_args (argc, argv) == -1) { return -1; } DDS::DomainParticipantQos partQos; dpf->get_default_participant_qos(partQos); // set up user data in DP qos CORBA::ULong part_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (PART_USER_DATA)); partQos.user_data.value.length (part_user_data_len); partQos.user_data.value.replace (part_user_data_len, part_user_data_len, reinterpret_cast<CORBA::Octet*>(PART_USER_DATA)); participant = dpf->create_participant(411, partQos, DDS::DomainParticipantListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (participant.in ())) { cerr << "subscriber: create_participant failed." << endl; return 1 ; } ::Messenger::MessageTypeSupport_var mts = new ::Messenger::MessageTypeSupportImpl(); if (DDS::RETCODE_OK != mts->register_type(participant.in (), "Messenger")) { cerr << "subscriber: Failed to register the MessageTypeTypeSupport." << endl; exit(1); } CORBA::String_var type_name = mts->get_type_name (); DDS::TopicQos topic_qos; participant->get_default_topic_qos(topic_qos); // set up topic data in topic qos CORBA::ULong topic_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (TOPIC_DATA)); topic_qos.topic_data.value.length (topic_data_len); topic_qos.topic_data.value.replace (topic_data_len, topic_data_len, reinterpret_cast<CORBA::Octet*>(TOPIC_DATA)); DDS::Topic_var topic = participant->create_topic("Movie Discussion List", type_name.in (), topic_qos, DDS::TopicListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (topic.in ())) { cerr << "subscriber: Failed to create_topic." << endl; exit(1); } // Create the subscriber DDS::SubscriberQos sub_qos; participant->get_default_subscriber_qos (sub_qos); // set up group data in subscriber qos CORBA::ULong group_data_len = static_cast<CORBA::ULong> (ACE_OS::strlen (GROUP_DATA)); sub_qos.group_data.value.length (group_data_len); sub_qos.group_data.value.replace (group_data_len, group_data_len, reinterpret_cast<CORBA::Octet*>(GROUP_DATA)); DDS::Subscriber_var sub = participant->create_subscriber(sub_qos, DDS::SubscriberListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (sub.in ())) { cerr << "subscriber: Failed to create_subscriber." << endl; exit(1); } // activate the listener DDS::DataReaderListener_var listener (new DataReaderListenerImpl); DataReaderListenerImpl* listener_servant = dynamic_cast<DataReaderListenerImpl*>(listener.in()); DDS::Subscriber_var builtin = participant->get_builtin_subscriber(); DDS::DataReader_var bitdr = builtin->lookup_datareader(OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC); listener_servant->set_builtin_datareader(bitdr.in()); if (CORBA::is_nil (listener.in ())) { cerr << "subscriber: listener is nil." << endl; exit(1); } // Create the Datareaders DDS::DataReaderQos dr_qos; sub->get_default_datareader_qos (dr_qos); // set up user data in DR qos CORBA::ULong dr_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (DR_USER_DATA)); dr_qos.user_data.value.length (dr_user_data_len); dr_qos.user_data.value.replace (dr_user_data_len, dr_user_data_len, reinterpret_cast<CORBA::Octet*>(DR_USER_DATA)); DDS::DataReader_var dr = sub->create_datareader(topic.in (), dr_qos, listener.in (), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (dr.in ())) { cerr << "subscriber: create_datareader failed." << endl; exit(1); } // Wait for Monitor 1 done. FILE* fp = ACE_OS::fopen (synch_fname, ACE_TEXT("r")); int i = 0; while (fp == 0 && i < 15) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) waiting monitor1 done ...\n"))); ACE_OS::sleep (1); ++i; fp = ACE_OS::fopen (synch_fname, ACE_TEXT("r")); } if (fp != 0) ACE_OS::fclose (fp); // Now change the changeable qos. The second monitor should get the updated qos from BIT. part_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_PART_USER_DATA)); partQos.user_data.value.length (part_user_data_len); partQos.user_data.value.replace (part_user_data_len, part_user_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_PART_USER_DATA)); participant->set_qos (partQos); dr_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_DR_USER_DATA)); dr_qos.user_data.value.length (dr_user_data_len); dr_qos.user_data.value.replace (dr_user_data_len, dr_user_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_DR_USER_DATA)); dr->set_qos (dr_qos); group_data_len = static_cast<CORBA::ULong> (ACE_OS::strlen (UPDATED_GROUP_DATA)); sub_qos.group_data.value.length (group_data_len); sub_qos.group_data.value.replace (group_data_len, group_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_GROUP_DATA)); sub->set_qos (sub_qos); topic_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_TOPIC_DATA)); topic_qos.topic_data.value.length (topic_data_len); topic_qos.topic_data.value.replace (topic_data_len, topic_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_TOPIC_DATA)); topic->set_qos (topic_qos); while ( listener_servant->num_reads() < num_messages) { ACE_OS::sleep (1); } if (listener_servant->builtin_read_errors()) { cerr << "subscriber: Built in topic read failure." << endl; result = 1; } if (!CORBA::is_nil (participant.in ())) { participant->delete_contained_entities(); } if (!CORBA::is_nil (dpf.in ())) { dpf->delete_participant(participant.in ()); } TheServiceParticipant->shutdown (); } catch (CORBA::Exception& e) { cerr << "subscriber: SUB: Exception caught in main ():" << endl << e << endl; return 1; } return result; }
void KVStore::init() { DDS::DomainId_t myDomain = NULL; DDS::DomainParticipantFactory_var dpf; DDS::DomainParticipant_var dp; DDS::Subscriber_var subscriber; DDS::Publisher_var publisher; DDS::DomainParticipantQos dpQos; DDS::TopicQos tQos; DDS::SubscriberQos sQos; DDS::DataReaderQos drQos; DDS::PublisherQos pQos; DDS::DataWriterQos dwQos; DDS::Topic_var topic; DDSKVStore::TransactionTypeSupport_var ts; // Create Participants dpf = DDS::DomainParticipantFactory::get_instance(); dpf->get_default_participant_qos(dpQos); dp = dpf->create_participant(myDomain, dpQos, NULL, DDS::STATUS_MASK_NONE); // Create Subscriber dp->get_default_subscriber_qos(sQos); sQos.partition.name.length(1); sQos.partition.name[0] = partition.c_str(); subscriber = dp->create_subscriber(sQos, NULL, DDS::STATUS_MASK_NONE); // Create Publisher dp->get_default_publisher_qos(pQos); pQos.partition.name.length(1); pQos.partition.name[0] = partition.c_str(); publisher = dp->create_publisher(pQos, NULL, DDS::STATUS_MASK_NONE); // Set DataReader QoS settings subscriber->get_default_datareader_qos(drQos); drQos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; drQos.history.kind = DDS::KEEP_LAST_HISTORY_QOS; drQos.history.depth = 30; // Set DataWriter QoS settings publisher->get_default_datawriter_qos(dwQos); dwQos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; dwQos.history.kind = DDS::KEEP_LAST_HISTORY_QOS; dwQos.history.depth = 30; // Set Topic Qos settings dp->get_default_topic_qos(tQos); tQos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; tQos.history.kind = DDS::KEEP_LAST_HISTORY_QOS; tQos.history.depth = 30; // Create Topic ts = new DDSKVStore::TransactionTypeSupport(); ts->register_type(dp, "DDSKVStore::Transaction"); topic = dp->create_topic("Transaction", "DDSKVStore::Transaction", tQos, NULL, DDS::STATUS_MASK_NONE); // Create Datareader dataReader = subscriber->create_datareader(topic, drQos, NULL, DDS::STATUS_MASK_NONE); transactionDataReader = DDSKVStore::TransactionDataReader::_narrow( dataReader); if (dataReader == NULL) std::cout << "ERROR: DDS Connection failed" << std::endl; // Create Datawriter transactionDataWriter = DDSKVStore::TransactionDataWriter::_narrow( publisher->create_datawriter(topic, dwQos, NULL, DDS::STATUS_MASK_NONE)); if (transactionDataWriter == NULL) std::cout << "ERROR: DDS Connection failed" << std::endl; // Create Readcondition readCondition = dataReader->create_readcondition(DDS::ANY_SAMPLE_STATE, DDS::ANY_VIEW_STATE, DDS::ALIVE_INSTANCE_STATE); }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { // Initialize DomainParticipantFactory DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv); enum { READER, WRITER } mode = READER; bool toggle = false; { // New scope. ACE_Arg_Shifter shifter (argc, argv); while (shifter.is_anything_left ()) { const ACE_TCHAR* x = shifter.get_current(); if (ACE_OS::strcmp(x, ACE_TEXT("-reader")) == 0) { mode = READER; } if (ACE_OS::strcmp(x, ACE_TEXT("-writer")) == 0) { mode = WRITER; } if (ACE_OS::strcmp(x, ACE_TEXT("-toggle")) == 0) { toggle = true; } shifter.consume_arg (); } } // Create DomainParticipant DDS::DomainParticipantQos dp_qos; dpf->get_default_participant_qos(dp_qos); dp_qos.user_data.value.length(6); dp_qos.user_data.value[0] = 0; dp_qos.user_data.value[1] = 0; dp_qos.user_data.value[2] = 0; dp_qos.user_data.value[3] = 0; dp_qos.user_data.value[4] = 0; dp_qos.user_data.value[5] = (mode == READER) ? 0 : 1; DDS::DomainParticipant_var participant = dpf->create_participant(DOMAIN_ID, dp_qos, 0, OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (!participant) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" create_participant failed!\n")), -1); } // Register TypeSupport TestMsgTypeSupport_var ts = new TestMsgTypeSupportImpl; if (ts->register_type(participant, "") != DDS::RETCODE_OK) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" register_type failed!\n")), -1); } // Create Topic CORBA::String_var type_name = ts->get_type_name(); DDS::Topic_var topic = participant->create_topic("TheTopic", type_name, TOPIC_QOS_DEFAULT, 0, OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (!topic) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" create_topic failed!\n")), -1); } int return_code = 1; switch (mode) { case READER: return_code = do_reader(participant, topic, toggle); break; case WRITER: return_code = do_writer(participant, topic, toggle); break; } // Clean-up! participant->delete_contained_entities(); dpf->delete_participant(participant); TheServiceParticipant->shutdown(); return return_code; } catch (const CORBA::Exception& e) { e._tao_print_exception("Exception caught in main():"); return -1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { // Initialize DomainParticipantFactory DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv); std::string participant_id; std::vector<std::string> readers; std::vector<std::string> writers; bool reliable = false; int total_readers = 0, total_writers = 0; { // New scope. ACE_Arg_Shifter shifter (argc, argv); while (shifter.is_anything_left ()) { const ACE_TCHAR* x; x = shifter.get_the_parameter (ACE_TEXT("-participant")); if (x != NULL) { participant_id = ACE_TEXT_ALWAYS_CHAR(x); } x = shifter.get_the_parameter (ACE_TEXT("-reader")); if (x != NULL) { readers.push_back(ACE_TEXT_ALWAYS_CHAR(x)); } x = shifter.get_the_parameter (ACE_TEXT("-writer")); if (x != NULL) { writers.push_back(ACE_TEXT_ALWAYS_CHAR(x)); } x = shifter.get_the_parameter (ACE_TEXT("-reliable")); if (x != NULL) { reliable = ACE_OS::atoi(x); } x = shifter.get_the_parameter (ACE_TEXT("-total_readers")); if (x != NULL) { total_readers = ACE_OS::atoi(x); } x = shifter.get_the_parameter (ACE_TEXT("-total_writers")); if (x != NULL) { total_writers = ACE_OS::atoi(x); } shifter.consume_arg (); } } participant_id.resize(12); // Create DomainParticipant DDS::DomainParticipantQos dp_qos; dpf->get_default_participant_qos(dp_qos); dp_qos.user_data.value.length(6); dp_qos.user_data.value[0] = fromhex(participant_id, 0); dp_qos.user_data.value[1] = fromhex(participant_id, 1); dp_qos.user_data.value[2] = fromhex(participant_id, 2); dp_qos.user_data.value[3] = fromhex(participant_id, 3); dp_qos.user_data.value[4] = fromhex(participant_id, 4); dp_qos.user_data.value[5] = fromhex(participant_id, 5); DDS::DomainParticipant_var participant = dpf->create_participant(DOMAIN_ID, dp_qos, 0, OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (!participant) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" create_participant failed!\n")), -1); } // Register TypeSupport TestMsgTypeSupport_var ts = new TestMsgTypeSupportImpl; if (ts->register_type(participant, "") != DDS::RETCODE_OK) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" register_type failed!\n")), -1); } // Create Topic CORBA::String_var type_name = ts->get_type_name(); DDS::Topic_var topic = participant->create_topic("TheTopic", type_name, TOPIC_QOS_DEFAULT, 0, OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (!topic) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" create_topic failed!\n")), -1); } // Create Subscriber DDS::Subscriber_var subscriber = participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT, 0, OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (!subscriber) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" create_subscriber failed!\n")), -1); } const int n_msgs = reliable ? MSGS_PER_WRITER * total_writers : 0; // Create DataReaders for (std::vector<std::string>::iterator pos = readers.begin(), limit = readers.end(); pos != limit; ++pos) { pos->resize(6); DDS::DataReaderListener_var listener(new DataReaderListenerImpl(*pos, n_msgs, reader_done_callback)); DDS::DataReaderQos qos; subscriber->get_default_datareader_qos(qos); qos.user_data.value.length(3); qos.user_data.value[0] = fromhex(*pos, 0); qos.user_data.value[1] = fromhex(*pos, 1); qos.user_data.value[2] = fromhex(*pos, 2); qos.reliability.kind = reliable ? DDS::RELIABLE_RELIABILITY_QOS : DDS::BEST_EFFORT_RELIABILITY_QOS; DDS::DataReader_var reader = subscriber->create_datareader(topic, qos, listener, OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (!reader) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" create_datareader failed!\n")), -1); } TestMsgDataReader_var reader_i = TestMsgDataReader::_narrow(reader); if (!reader_i) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: %N:%l: main() -") ACE_TEXT(" _narrow failed!\n")), -1); } } WriterTask task(writers, participant, topic, reliable, total_readers); task.activate(DEFAULT_FLAGS, writers.size()); task.wait(); if (!reliable) ACE_OS::sleep(10); else { ACE_Guard<ACE_Thread_Mutex> g(readers_done_lock); while (readers_done != static_cast<int>(readers.size())) readers_done_cond.wait(); // Sleep allows an ACKNACK to be generated. ACE_OS::sleep(3); } // Clean-up! participant->delete_contained_entities(); dpf->delete_participant(participant); TheServiceParticipant->shutdown(); } catch (const CORBA::Exception& e) { e._tao_print_exception("Exception caught in main():"); return -1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { ACE_DEBUG ((LM_DEBUG, "(%P|%t) publisher main\n")); DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv); if (parse_args (argc, argv) == -1) { return -1; } DDS::DomainParticipantQos partQos; dpf->get_default_participant_qos(partQos); // set up user data in DP qos CORBA::ULong part_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (PART_USER_DATA)); partQos.user_data.value.length (part_user_data_len); partQos.user_data.value.replace (part_user_data_len, part_user_data_len, reinterpret_cast<CORBA::Octet*>(PART_USER_DATA)); DDS::DomainParticipant_var participant = dpf->create_participant(411, partQos, DDS::DomainParticipantListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (participant.in ())) { cerr << "publisher: create_participant failed." << endl; return 1; } ::Messenger::MessageTypeSupport_var ts = new ::Messenger::MessageTypeSupportImpl(); if (DDS::RETCODE_OK != ts->register_type(participant.in (), "Messenger")) { cerr << "publisher: register_type failed." << endl; exit(1); } CORBA::String_var type_name = ts->get_type_name (); DDS::TopicQos topic_qos; participant->get_default_topic_qos(topic_qos); // set up topic data in topic qos CORBA::ULong topic_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (TOPIC_DATA)); topic_qos.topic_data.value.length (topic_data_len); topic_qos.topic_data.value.replace (topic_data_len, topic_data_len, reinterpret_cast<CORBA::Octet*>(TOPIC_DATA)); DDS::Topic_var topic = participant->create_topic ("Movie Discussion List", type_name.in (), topic_qos, DDS::TopicListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (topic.in ())) { cerr << "publisher: create_topic failed." << endl; exit(1); } DDS::PublisherQos pub_qos; participant->get_default_publisher_qos (pub_qos); // set up group data in group qos CORBA::ULong group_data_len = static_cast<CORBA::ULong> (ACE_OS::strlen (GROUP_DATA)); pub_qos.group_data.value.length (group_data_len); pub_qos.group_data.value.replace (group_data_len, group_data_len, reinterpret_cast<CORBA::Octet*>(GROUP_DATA)); DDS::Publisher_var pub = participant->create_publisher(pub_qos, DDS::PublisherListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (pub.in ())) { cerr << "publisher: create_publisher failed." << endl; exit(1); } // Create the datawriter DDS::DataWriterQos dw_qos; pub->get_default_datawriter_qos (dw_qos); dw_qos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS; dw_qos.reliability.kind = ::DDS::RELIABLE_RELIABILITY_QOS; dw_qos.resource_limits.max_samples_per_instance = 1000; dw_qos.history.kind = ::DDS::KEEP_ALL_HISTORY_QOS; // set up user data in DW qos CORBA::ULong dw_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (DW_USER_DATA)); dw_qos.user_data.value.length (dw_user_data_len); dw_qos.user_data.value.replace (dw_user_data_len, dw_user_data_len, reinterpret_cast<CORBA::Octet*>(DW_USER_DATA)); DDS::DataWriter_var dw = pub->create_datawriter(topic.in (), dw_qos, DDS::DataWriterListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil (dw.in ())) { cerr << "publisher: create_datawriter failed." << endl; exit(1); } // wait for Monitor 1 done FILE* fp = ACE_OS::fopen (synch_fname, ACE_TEXT("r")); int i = 0; while (fp == 0 && i < 15) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) waiting monitor1 done ...\n"))); ACE_OS::sleep (1); ++ i; fp = ACE_OS::fopen (synch_fname, ACE_TEXT("r")); } if (fp != 0) ACE_OS::fclose (fp); // Now change the changeable qos. The second monitor should get the updated qos from BIT. part_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_PART_USER_DATA)); partQos.user_data.value.length (part_user_data_len); partQos.user_data.value.replace (part_user_data_len, part_user_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_PART_USER_DATA)); participant->set_qos (partQos); dw_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_DW_USER_DATA)); dw_qos.user_data.value.length (dw_user_data_len); dw_qos.user_data.value.replace (dw_user_data_len, dw_user_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_DW_USER_DATA)); dw->set_qos (dw_qos); group_data_len = static_cast<CORBA::ULong> (ACE_OS::strlen (UPDATED_GROUP_DATA)); pub_qos.group_data.value.length (group_data_len); pub_qos.group_data.value.replace (group_data_len, group_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_GROUP_DATA)); pub->set_qos (pub_qos); topic_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (UPDATED_TOPIC_DATA)); topic_qos.topic_data.value.length (topic_data_len); topic_qos.topic_data.value.replace (topic_data_len, topic_data_len, reinterpret_cast<CORBA::Octet*>(UPDATED_TOPIC_DATA)); topic->set_qos (topic_qos); Writer* writer = new Writer(dw.in()); writer->start (); while ( !writer->is_finished()) { ACE_Time_Value small_time(0,250000); ACE_OS::sleep (small_time); } // Cleanup writer->end (); delete writer; participant->delete_contained_entities(); dpf->delete_participant(participant.in ()); TheServiceParticipant->shutdown (); } catch (CORBA::Exception& e) { cerr << "publisher: PUB: Exception caught in main.cpp:" << endl << e << endl; exit(1); } return 0; }