void DDS_Write_T<CCM_TYPE, TYPED_WRITER, VALUE_TYPE, SEQ_VALUE_TYPE>::configuration_complete ( ::DDS::Topic_ptr topic, ::DDS::Publisher_ptr publisher, const char * qos_profile, DDS_XML_QOS_PARSER_TYPE* qos_xml) { DDS4CCM_TRACE ("DDS_Write_T<CCM_TYPE, TYPED_WRITER, VALUE_TYPE, SEQ_VALUE_TYPE>::configuration_complete"); ::DDS::DataWriter_var dw = this->dds_write_->get_dds_writer (); if (::CORBA::is_nil (dw.in ())) { ::DDS::DataWriter_var dwv_tmp; #if (CIAO_DDS4CCM_NDDS==1) if (qos_profile) { dwv_tmp = publisher->create_datawriter_with_profile ( topic, qos_profile, ::DDS::DataWriterListener::_nil (), 0); } else #endif { ::DDS::DataWriterQos dwqos; DDS::ReturnCode_t const retcode = publisher->get_default_datawriter_qos (dwqos); if (retcode != DDS::RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_Write_T::configuration_complete - " "Error: Unable to retrieve get_default_datawriter_qos: <%C>\n", ::CIAO::DDS4CCM::translate_retcode (retcode))); throw ::CCM_DDS::InternalError (retcode, 0); } if (qos_profile && qos_xml) { CORBA::String_var name = topic->get_name (); DDS::ReturnCode_t const retcode_dw_qos = qos_xml->get_datawriter_qos ( dwqos, qos_profile, name.in ()); if (retcode_dw_qos != DDS::RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_Write_T::configuration_complete - " "Error: Unable to retrieve datawriter QOS from XML: <%C>\n", ::CIAO::DDS4CCM::translate_retcode (retcode_dw_qos))); throw ::CCM_DDS::InternalError (retcode_dw_qos, 0); } } #if defined GEN_OSTREAM_OPS if (DDS4CCM_debug_level >= DDS4CCM_LOG_LEVEL_DDS_STATUS) { std::stringstream output; output << dwqos; std::string message = output.str(); DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_INFO, DDS4CCM_INFO ACE_TEXT ("DDS_Update_T::configuration_complete - ") ACE_TEXT ("Using datawriter QOS <%C>\n"), message.c_str())); } #endif dwv_tmp = publisher->create_datawriter ( topic, dwqos, ::DDS::DataWriterListener::_nil (), 0); } if (!::CORBA::is_nil (dwv_tmp.in ())) { DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_TRACE, DDS4CCM_INFO "DDS_Write_T::configuration_complete - " "Created datawriter " DDS_ENTITY_FORMAT_SPECIFIER " using publisher " DDS_ENTITY_FORMAT_SPECIFIER "\n", DDS_ENTITY_LOG (dwv_tmp.in ()), DDS_ENTITY_LOG (publisher))); } else { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO "DDS_Write_T::configuration_complete - " "Error: DDS returned a nil datawriter.\n")); throw ::CORBA::INTERNAL (); } this->dds_write_->set_dds_writer (dwv_tmp.in ()); this->ccm_data_writer_->set_dds_entity (dwv_tmp.in ()); DDS::ReturnCode_t const retcode = dwv_tmp->enable (); if (retcode != ::DDS::RETCODE_OK) { DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "DDS_Write_T::configuration_complete - " "Error: Unable to enable the datawriter: <%C>\n", ::CIAO::DDS4CCM::translate_retcode (retcode))); throw ::CORBA::INTERNAL (); } } }
DDS::DataWriter_ptr MonitorFactoryImpl::create_data_writer(DDS::DomainParticipant_ptr participant, DDS::Publisher_ptr publisher, const char* type_name, const char* topic_name, const DDS::DataWriterQos& dw_qos) { DDS::Topic_var topic = participant->create_topic(topic_name, type_name, TOPIC_QOS_DEFAULT, DDS::TopicListener::_nil(), OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil(topic)) { ACE_DEBUG((LM_DEBUG, "MonitorFactoryImpl::create_data_writer(): Failed to create topic, name = %s\n", topic_name)); } DDS::DataWriter_var writer = publisher->create_datawriter(topic.in(), dw_qos, DDS::DataWriterListener::_nil(), OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil(writer)) { ACE_DEBUG((LM_DEBUG, "MonitorFactoryImpl::create_data_writer(): Failed to create data writer\n")); } return writer._retn(); }