| 1690 | } |
| 1691 | |
| 1692 | DDS::ReturnCode_t |
| 1693 | DataWriterImpl::unregister_instance_i(DDS::InstanceHandle_t handle, |
| 1694 | const Sample* samp, |
| 1695 | const DDS::Time_t& source_timestamp) |
| 1696 | { |
| 1697 | DBG_ENTRY_LVL("DataWriterImpl","unregister_instance_i",6); |
| 1698 | |
| 1699 | if (!enabled_) { |
| 1700 | ACE_ERROR_RETURN((LM_ERROR, |
| 1701 | ACE_TEXT("(%P|%t) ERROR: DataWriterImpl::unregister_instance_i: ") |
| 1702 | ACE_TEXT("Entity is not enabled.\n")), |
| 1703 | DDS::RETCODE_NOT_ENABLED); |
| 1704 | } |
| 1705 | |
| 1706 | // According to spec 1.2, autodispose_unregistered_instances true causes |
| 1707 | // dispose on the instance prior to calling unregister operation. |
| 1708 | if (this->qos_.writer_data_lifecycle.autodispose_unregistered_instances) { |
| 1709 | return this->dispose_and_unregister(handle, samp, source_timestamp); |
| 1710 | } |
| 1711 | |
| 1712 | DDS::ReturnCode_t ret = DDS::RETCODE_ERROR; |
| 1713 | ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, get_lock(), ret); |
| 1714 | Message_Block_Ptr unregistered_sample_data; |
| 1715 | ret = this->data_container_->unregister(handle, unregistered_sample_data); |
| 1716 | |
| 1717 | if (ret != DDS::RETCODE_OK) { |
| 1718 | ACE_ERROR_RETURN((LM_ERROR, |
| 1719 | ACE_TEXT("(%P|%t) ERROR: ") |
| 1720 | ACE_TEXT("DataWriterImpl::unregister_instance_i: ") |
| 1721 | ACE_TEXT("unregister with container failed.\n")), |
| 1722 | ret); |
| 1723 | } |
| 1724 | |
| 1725 | DataSampleElement* element = 0; |
| 1726 | ret = this->data_container_->obtain_buffer_for_control(element); |
| 1727 | |
| 1728 | if (ret != DDS::RETCODE_OK) { |
| 1729 | ACE_ERROR_RETURN((LM_ERROR, |
| 1730 | ACE_TEXT("(%P|%t) ERROR: ") |
| 1731 | ACE_TEXT("DataWriterImpl::unregister_instance_i: ") |
| 1732 | ACE_TEXT("obtain_buffer_for_control returned %d.\n"), |
| 1733 | ret), |
| 1734 | ret); |
| 1735 | } |
| 1736 | |
| 1737 | Message_Block_Ptr sample(create_control_message(UNREGISTER_INSTANCE, |
| 1738 | element->get_header(), |
| 1739 | OPENDDS_MOVE_NS::move(unregistered_sample_data), |
| 1740 | source_timestamp)); |
| 1741 | element->set_sample(OPENDDS_MOVE_NS::move(sample)); |
| 1742 | |
| 1743 | ret = this->data_container_->enqueue_control(element); |
| 1744 | |
| 1745 | if (ret != DDS::RETCODE_OK) { |
| 1746 | data_container_->release_buffer(element); |
| 1747 | ACE_ERROR_RETURN((LM_ERROR, |
| 1748 | ACE_TEXT("(%P|%t) ERROR: ") |
| 1749 | ACE_TEXT("DataWriterImpl::unregister_instance_i: ") |
nothing calls this directly
no test coverage detected