void test_setup(const DomainParticipant_var& dp, const MessageTypeSupport_var& ts, const Publisher_var& pub, const Subscriber_var& sub, const char* topicName, DataWriter_var& dw, DataReader_var& dr) { Topic_var topic = dp->create_topic(topicName, ts->get_type_name(), TOPIC_QOS_DEFAULT, 0, DEFAULT_STATUS_MASK); DataWriterQos dw_qos; pub->get_default_datawriter_qos(dw_qos); dw_qos.history.kind = KEEP_ALL_HISTORY_QOS; dw = pub->create_datawriter(topic, dw_qos, 0, DEFAULT_STATUS_MASK); DataReaderQos dr_qos; sub->get_default_datareader_qos(dr_qos); dr_qos.history.kind = KEEP_ALL_HISTORY_QOS; dr = sub->create_datareader(topic, dr_qos, 0, DEFAULT_STATUS_MASK); StatusCondition_var dw_sc = dw->get_statuscondition(); dw_sc->set_enabled_statuses(PUBLICATION_MATCHED_STATUS); WaitSet_var ws = new WaitSet; ws->attach_condition(dw_sc); Duration_t infinite = {DURATION_INFINITE_SEC, DURATION_INFINITE_NSEC}; ConditionSeq active; ws->wait(active, infinite); ws->detach_condition(dw_sc); }
DataWriter_var create_data_writer(const DomainParticipant_var& dp2) { TypeSupport_var ts = new TestMsgTypeSupportImpl; if (ts->register_type(dp2, "") != RETCODE_OK) { ACE_DEBUG((LM_ERROR, "ERROR: %P failed to register type support\n")); return 0; } TopicQos topic_qos; dp2->get_default_topic_qos(topic_qos); set_qos(topic_qos.topic_data.value, TestConfig::TOPIC_DATA()); CORBA::String_var type_name = ts->get_type_name(); Topic_var topic = dp2->create_topic("Movie Discussion List", type_name, topic_qos, 0, DEFAULT_STATUS_MASK); if (!topic) { ACE_DEBUG((LM_ERROR, "ERROR: %P failed to create topic\n")); return 0; } Publisher_var pub = dp2->create_publisher(PUBLISHER_QOS_DEFAULT, 0, DEFAULT_STATUS_MASK); if (!pub) { ACE_DEBUG((LM_ERROR, "ERROR: %P failed to create publisher\n")); return 0; } DataWriterQos dw_qos; pub->get_default_datawriter_qos(dw_qos); set_qos(dw_qos.user_data.value, TestConfig::DATA_WRITER_USER_DATA()); DataWriter_var dw = pub->create_datawriter(topic, dw_qos, 0, DEFAULT_STATUS_MASK); if (!dw) { ACE_DEBUG((LM_ERROR, "ERROR: %P failed to create data writer\n")); return 0; } return dw; }