Ejemplo n.º 1
0
void
DDS_Subscriber_Base_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::remove (
  ::DDS::Subscriber_ptr subscriber)
{
  DDS4CCM_TRACE ("DDS_Subscriber_Base_T<CCM_TYPE, TYPED_DDS_READER, VALUE_TYPE, SEQ_VALUE_TYPE>::remove");

  ::DDS::DataReader_var dr = this->dds_read_->get_dds_reader ();

  this->condition_manager_.set_dds_entity (::DDS::DataReader::_nil ());
  this->dds_read_->set_dds_reader (::DDS::DataReader::_nil (), 0);
  this->ccm_data_reader_->set_dds_entity (::DDS::DataReader::_nil ());

  if (!::CORBA::is_nil (dr.in ()))
    {
      DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO
                  "DDS_Subscriber_Base_T::remove - "
                  "Going to delete DataReader "
                  DDS_ENTITY_FORMAT_SPECIFIER
                  " from subscriber "
                  DDS_ENTITY_FORMAT_SPECIFIER
                  "\n",
                  DDS_ENTITY_LOG (dr.in ()),
                  DDS_ENTITY_LOG (subscriber)));

      DDS::ReturnCode_t const retval =
        subscriber->delete_datareader (dr.in ());

      if (retval != ::DDS::RETCODE_OK)
        {
          DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
                        ACE_TEXT ("DDS_Subscriber_Base_T::remove - ")
                        ACE_TEXT ("Unable to delete DataReader: <%C>\n"),
                        ::CIAO::DDS4CCM::translate_retcode (retval)));
          throw ::CORBA::INTERNAL ();
        }
      else
        {
          DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_DDS_STATUS, (LM_INFO, DDS4CCM_INFO
              "DDS_Subscriber_Base_T::remove - "
              "Deleted DataReader\n"));
        }
    }

  dr = ::DDS::DataReader::_nil ();
  this->cft_setting_->delete_contentfilteredtopic (subscriber);
}