Exemplo n.º 1
0
    void
    CCM_DDS_ContentFilterSetting_i::delete_contentfilteredtopic (
      ::DDS::Subscriber_ptr subscriber)
    {
      DDS4CCM_TRACE ("CCM_DDS_ContentFilterSetting_i::delete_contentfilteredtopic");

      if (! ::CORBA::is_nil (subscriber))
        {
          ::DDS::DomainParticipant_var dp = subscriber->get_participant ();
          ::DDS::ContentFilteredTopic_var cft = this->cft_._retn ();
          if (! ::CORBA::is_nil (dp.in ()) && (! ::CORBA::is_nil (cft.in ())))
            {
              ::CORBA::String_var name = cft->get_name ();
              ::DDS::ReturnCode_t const retcode =
                dp->delete_contentfilteredtopic (cft.in ());

              if (retcode == ::DDS::RETCODE_OK)
                {
                  DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
                                "CCM_DDS_ContentFilterSetting_i::delete_contentfilteredtopic: "
                                "successfully deleted ContentFilteredTopic <%C>\n",
                                name.in ()));
                }
              else
                {
                  DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
                                "CCM_DDS_ContentFilterSetting_i::delete_contentfilteredtopic: "
                                "Error deleting ContentFilteredTopic <%C>: <%C>\n",
                                name.in (),
                                translate_retcode (retcode)));
                  throw ::CCM_DDS::InternalError (retcode, 0);
                }
            }
        }
    }
Exemplo n.º 2
0
    ::DDS::ContentFilteredTopic_ptr
    CCM_DDS_ContentFilterSetting_i::create_contentfilteredtopic (
      ::DDS::Topic_ptr topic,
      ::DDS::Subscriber_ptr subscriber)
    {
      DDS4CCM_TRACE ("CCM_DDS_ContentFilterSetting_i::create_contentfilteredtopic");

      ::DDS::DomainParticipant_var dp = subscriber->get_participant ();
      if (::CORBA::is_nil (dp.in ()))
        {
          DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
                        "CCM_DDS_ContentFilterSetting_i::create_contentfilteredtopic: "
                        "Unable to get DomainParticipant.\n"));
          throw ::CORBA::INTERNAL ();
        }

      ACE_Auto_Array_Ptr <char> name;
      {
        char *name_bootstrap = 0;
        ACE_NEW_THROW_EX (name_bootstrap,
                          char[32],
                          ::CORBA::NO_MEMORY ());
        name.reset(name_bootstrap);
      }
      ACE_OS::sprintf (name.get (),
                       "DDS4CCM_CFT_%ld",
                       reinterpret_cast <unsigned long> (this));

      this->cft_ = dp->create_contentfilteredtopic (name.get (),
                                                    topic,
                                                    this->filter_.expression,
                                                    this->filter_.parameters);
      if (::CORBA::is_nil (this->cft_.in ()))
        {
          DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
                        "CCM_DDS_ContentFilterSetting_i::create_contentfilteredtopic: "
                        "Error creating ContentFilteredTopic <%C>.\n",
                        name.get ()));
          throw ::CORBA::INTERNAL ();
        }
      DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
                    "CCM_DDS_ContentFilterSetting_i::create_contentfilteredtopic: "
                    "successfully created ContentFilteredTopic <%C>\n",
                    name.get ()));
      return ::DDS::ContentFilteredTopic::_duplicate (this->cft_);
    }