diff options
20 files changed, 297 insertions, 285 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index b7f5829b104..4b08eef07a6 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,13 +1,37 @@ +Thu Feb 25 20:03:54 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + + * connectors/dds4ccm/impl/ndds/DataReader.cpp + * connectors/dds4ccm/impl/ndds/DataReader.h + * connectors/dds4ccm/impl/ndds/DataReaderListener.cpp + * connectors/dds4ccm/impl/ndds/DDS_Get_T.cpp + * connectors/dds4ccm/impl/ndds/DDS_Get_T.h + * connectors/dds4ccm/impl/ndds/DDS_Listen_T.cpp + * connectors/dds4ccm/impl/ndds/DDS_Read_T.cpp + * connectors/dds4ccm/impl/ndds/DDS_StateListen_T.cpp + * connectors/dds4ccm/impl/ndds/DomainParticipant.cpp + * connectors/dds4ccm/impl/ndds/PublisherListener.cpp + * connectors/dds4ccm/impl/ndds/QueryCondition.cpp + * connectors/dds4ccm/impl/ndds/QueryCondition.h + * connectors/dds4ccm/impl/ndds/ReadCondition.cpp + * connectors/dds4ccm/impl/ndds/ReadCondition.h + * connectors/dds4ccm/impl/ndds/Subscriber.cpp + * connectors/dds4ccm/impl/ndds/SubscriberListener.cpp + * connectors/dds4ccm/impl/ndds/Topic.cpp + * connectors/dds4ccm/impl/ndds/TopicDescription.cpp + * connectors/dds4ccm/impl/ndds/TopicListener.cpp + Set of cleanup of the core library. More will come after the release + of x.7.7. The code is at a much better level than with x.7.6 but + not at the level we aimed for x.7.7 because that was scheduled for + the end of March + Thu Feb 25 16:23:49 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> * NEWS: - Added news entries. - + Thu Feb 25 16:20:27 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> * DAnCE/tools/Convert_Plan/Convert_Plan_Impl.h: - Compile error fix. Thu Feb 25 15:47:16 UTC 2010 Marcel Smit <msmit@remedy.nl> diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.cpp index 1840a778c4f..e65491d078d 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.cpp @@ -9,7 +9,8 @@ #include "dds4ccm/impl/logger/Log_Macros.h" template <typename DDS_TYPE, typename CCM_TYPE, bool FIXED> -DDS_Get_T<DDS_TYPE, CCM_TYPE, FIXED>::DDS_Get_T (void) +DDS_Get_T<DDS_TYPE, CCM_TYPE, FIXED>::DDS_Get_T (void) : + rti_reader_ (0) { } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.h b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.h index 9c19c852365..3ed0f519fe8 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Get_T.h @@ -31,6 +31,7 @@ public: ::DDS::CCM_DataReader_ptr get_dds_entity (void); //@} + void configuration_complete ( ::DDS::Topic_ptr topic, ::DDS::Subscriber_ptr subscriber, diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Listen_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Listen_T.cpp index cb153a316ea..afdabd65774 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Listen_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Listen_T.cpp @@ -16,7 +16,8 @@ template <typename DDS_TYPE, typename CCM_TYPE> DDS_Listen_T<DDS_TYPE, CCM_TYPE>::DDS_Listen_T (void) : data_control_ (new CCM_DDS_DataListenerControl_T - < ::CCM_DDS::CCM_DataListenerControl> ()) + < ::CCM_DDS::CCM_DataListenerControl> ()), + rti_reader_ (0) { } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Read_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Read_T.cpp index 477d51e4ad2..9de3be9e328 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDS_Read_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DDS_Read_T.cpp @@ -11,7 +11,8 @@ #include "dds4ccm/impl/logger/Log_Macros.h" template <typename DDS_TYPE, typename CCM_TYPE> -DDS_Read_T<DDS_TYPE, CCM_TYPE>::DDS_Read_T (void) +DDS_Read_T<DDS_TYPE, CCM_TYPE>::DDS_Read_T (void) : + rti_reader_ (0) { } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDS_StateListen_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDS_StateListen_T.cpp index d13048f4217..01acfc8df28 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DDS_StateListen_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DDS_StateListen_T.cpp @@ -11,7 +11,8 @@ template <typename DDS_TYPE, typename CCM_TYPE> DDS_StateListen_T<DDS_TYPE, CCM_TYPE>::DDS_StateListen_T (void) : data_control_ (new CCM_DDS_StateListenerControl_T - < ::CCM_DDS::CCM_StateListenerControl> ()) + < ::CCM_DDS::CCM_StateListenerControl> ()), + rti_reader_ (0) { } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp index 22a308ec46e..d7d963d912d 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.cpp @@ -26,8 +26,8 @@ namespace CIAO { namespace DDS4CCM { - CCM_DDS_DataReader_i::CCM_DDS_DataReader_i (void) - : impl_ (0) + CCM_DDS_DataReader_i::CCM_DDS_DataReader_i (DDSDataReader * dr) + : impl_ (dr) { } @@ -47,14 +47,20 @@ namespace CIAO ::DDS::StatusCondition_var retval = ::DDS::StatusCondition::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSStatusCondition* sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_StatusCondition_i (sc), - CORBA::NO_MEMORY ()); + if (sc) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_StatusCondition_i (sc), + CORBA::NO_MEMORY ()); + } #else ::DDS::StatusCondition_var sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_StatusCondition_i (sc.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_nil (sc.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_StatusCondition_i (sc.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } @@ -84,19 +90,25 @@ namespace CIAO ::DDS::ViewStateMask view_states, ::DDS::InstanceStateMask instance_states) { -#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::ReadCondition_var retval = ::DDS::ReadCondition::_nil (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_ReadCondition_i (), - CORBA::NO_MEMORY ()); - +#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSReadCondition* rc = this->impl ()->create_readcondition (sample_states, view_states, instance_states); - CCM_DDS_ReadCondition_i *rti_rc = dynamic_cast < CCM_DDS_ReadCondition_i *>(retval.in ()); - rti_rc->set_impl (rc); - return retval._retn (); + if (rc) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_ReadCondition_i (rc), + CORBA::NO_MEMORY ()); + } #else - return this->impl ()->create_readcondition (sample_states, view_states, instance_states); + ::DDS::ReadCondition_var rc = this->impl ()->create_readcondition (sample_states, view_states, instance_states); + if (!CORBA::is_nil (rc.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_StatusCondition_i (sc.in ()), + CORBA::NO_MEMORY ()); + } #endif + return retval._retn (); } ::DDS::QueryCondition_ptr @@ -107,15 +119,10 @@ namespace CIAO const char * query_expression, const ::DDS::StringSeq & query_parameters) { + ::DDS::QueryCondition_var retval = ::DDS::QueryCondition::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDS_StringSeq parameters; parameters <<= query_parameters; - - ::DDS::QueryCondition_var retval = ::DDS::QueryCondition::_nil (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_QueryCondition_i (), - CORBA::NO_MEMORY ()); - DDSQueryCondition* qc = this->impl ()->create_querycondition ( sample_states, view_states, @@ -123,23 +130,28 @@ namespace CIAO query_expression, parameters); - if (!qc) + if (qc) { - DDS4CCM_ERROR (1, (LM_ERROR, "CCM_DDS_DataReader_i::create_querycondition: " - "DDS return NIL as a DDSQueryCondition!\n")); - return ::DDS::QueryCondition::_nil (); + ACE_NEW_THROW_EX (retval, + CCM_DDS_QueryCondition_i (qc), + CORBA::NO_MEMORY ()); } - CCM_DDS_QueryCondition_i *rti_qc = dynamic_cast < CCM_DDS_QueryCondition_i *> (retval.in ()); - rti_qc->set_impl (qc); - return retval._retn (); #else - return this->impl ()->create_querycondition ( + ::DDS::QueryCondition_var qc = this->impl ()->create_querycondition ( sample_states, view_states, instance_states, query_expression, query_parameters); + + if (!CORBA::is_nil (qc.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_QueryCondition_i (qc.in ()), + CORBA::NO_MEMORY ()); + } #endif + return retval._retn (); } ::DDS::ReturnCode_t @@ -183,7 +195,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_DataReaderQos ddsqos; - ddsqos <<= qos; ::DDS_ReturnCode_t const retval = this->impl ()->get_qos (ddsqos); qos <<= ddsqos; return retval; @@ -275,7 +286,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDS_SampleRejectedStatus rtistatus; - rtistatus <<= status; ::DDS::ReturnCode_t const retval = this->impl ()->get_sample_rejected_status (rtistatus); rtistatus >>= status; return retval; @@ -290,7 +300,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDS_LivelinessChangedStatus rtistatus; - rtistatus <<= status; ::DDS::ReturnCode_t const retval = this->impl ()->get_liveliness_changed_status (rtistatus); rtistatus >>= status; return retval; @@ -305,7 +314,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDS_RequestedDeadlineMissedStatus rtistatus; - rtistatus <<= status; ::DDS::ReturnCode_t const retval = this->impl ()->get_requested_deadline_missed_status (rtistatus); rtistatus >>= status; return retval; @@ -320,7 +328,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDS_RequestedIncompatibleQosStatus rtistatus; - rtistatus <<= status; ::DDS::ReturnCode_t const retval = this->impl ()->get_requested_incompatible_qos_status (rtistatus); rtistatus >>= status; return retval; @@ -335,7 +342,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_SubscriptionMatchedStatus ddsstatus; - ddsstatus <<= status; ::DDS::ReturnCode_t const retval = this->impl ()->get_subscription_matched_status (ddsstatus); ddsstatus >>= status; return retval; @@ -377,7 +383,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_InstanceHandleSeq rtiseq; - rtiseq <<= publication_handles; ::DDS::ReturnCode_t const retval = this->impl ()->get_matched_publications (rtiseq); rtiseq >>= publication_handles; return retval; @@ -397,7 +402,7 @@ namespace CIAO rti_pub_data <<= publication_data; rti_pub_handle <<= publication_handle; - ::DDS::ReturnCode_t retcode = this->impl()-> + ::DDS::ReturnCode_t const retcode = this->impl()-> get_matched_publication_data (rti_pub_data, rti_pub_handle); rti_pub_data >>= publication_data; diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h index ace577ce6e3..74648685770 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReader.h @@ -36,7 +36,7 @@ namespace CIAO { public: /// Constructor - CCM_DDS_DataReader_i (void); + CCM_DDS_DataReader_i (DDSDataReader *dr); /// Destructor virtual ~CCM_DDS_DataReader_i (void); diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.cpp index a36630d250e..f1f177e8801 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DataReaderListener.cpp @@ -32,16 +32,15 @@ namespace CIAO const ::DDS_RequestedDeadlineMissedStatus & status) { DDS4CCM_TRACE ("CCM_DDS_DataReaderListener_i::on_requested_deadline_missed"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::RequestedDeadlineMissedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_requested_deadline_missed (dds_reader.in (), ddsstatus); #else - this->impl_->on_requested_deadline_missed (the_reader, status); + this->impl_->on_requested_deadline_missed (dds_reader.in (), status); #endif } @@ -51,16 +50,15 @@ namespace CIAO const ::DDS_RequestedIncompatibleQosStatus & status) { DDS4CCM_TRACE ("CCM_DDS_DataReaderListener_i::on_requested_incompatible_qos"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::RequestedIncompatibleQosStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_requested_incompatible_qos (dds_reader.in (), ddsstatus); #else - this->impl_->on_requested_incompatible_qos (the_reader, status); + this->impl_->on_requested_incompatible_qos (dds_reader.in (), status); #endif } @@ -70,16 +68,15 @@ namespace CIAO const ::DDS_SampleRejectedStatus & status) { DDS4CCM_TRACE ("CCM_DDS_DataReaderListener_i::on_sample_rejected"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::SampleRejectedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_sample_rejected (dds_reader.in (), ddsstatus); #else - this->impl_->on_sample_rejected (the_reader, status); + this->impl_->on_sample_rejected (dds_reader.in (), status); #endif } @@ -89,16 +86,15 @@ namespace CIAO const ::DDS_LivelinessChangedStatus & status) { DDS4CCM_TRACE ("CCM_DDS_DataReaderListener_i::on_liveliness_changed"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::LivelinessChangedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_liveliness_changed (dds_reader.in (), ddsstatus); #else - this->impl_->on_liveliness_changed (the_reader, status); + this->impl_->on_liveliness_changed (dds_reader.in (), status); #endif } @@ -106,14 +102,13 @@ namespace CIAO CCM_DDS_DataReaderListener_i::on_data_available(::DDSDataReader *the_reader) { DDS4CCM_TRACE ("CCM_DDS_DataReaderListener_i::on_data_available"); -#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); +#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) this->impl_->on_data_available (dds_reader.in ()); #else - this->impl_->on_data_available (the_reader); + this->impl_->on_data_available (dds_reader.in ()); #endif } @@ -123,16 +118,15 @@ namespace CIAO const ::DDS_SubscriptionMatchedStatus & status) { DDS4CCM_TRACE ("CCM_DDS_DataReaderListener_i::on_subscription_matched"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::SubscriptionMatchedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_subscription_matched (dds_reader.in (), ddsstatus); #else - this->impl_->on_subscription_matched (the_reader, status); + this->impl_->on_subscription_matched (dds_reader.in (), status); #endif } @@ -142,16 +136,15 @@ namespace CIAO const ::DDS_SampleLostStatus & status) { DDS4CCM_TRACE ("CCM_DDS_DataReaderListener_i::on_sample_lost"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::SampleLostStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_sample_lost (dds_reader.in (), ddsstatus); #else - this->impl_->on_sample_lost (the_reader, status); + this->impl_->on_sample_lost (dds_reader.in (), status); #endif } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp index c790541bf37..705d35d1398 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp @@ -84,9 +84,6 @@ namespace CIAO "Successfully created a DDSPublisher\n")); rti_pub->enable (); - CCM_DDS_Publisher_i *rti_p = dynamic_cast < CCM_DDS_Publisher_i *> (retval.in ()); - rti_p->set_impl (rti_pub); - return retval._retn (); } #endif @@ -130,14 +127,10 @@ namespace CIAO CCM_DDS_Publisher_i (rti_pub), CORBA::NO_MEMORY ()); - DDS4CCM_DEBUG (6, (LM_INFO, CLINFO "CCM_DDS_DomainParticipant_i::create_publisher - " "Successfully created a DDSPublisher\n")); rti_pub->enable (); - CCM_DDS_Publisher_i *rti_p = dynamic_cast < CCM_DDS_Publisher_i *> (retval.in ()); - rti_p->set_impl (rti_pub); - return retval._retn (); #else return this->impl ()->create_publisher (qos, a_listener, mask); @@ -221,9 +214,6 @@ namespace CIAO "Successfully created a DDSSubscriber\n")); rti_sub->enable (); - CCM_DDS_Subscriber_i *rti_s = dynamic_cast < CCM_DDS_Subscriber_i *> (retval.in ()); - rti_s->set_impl (rti_sub); - return retval._retn (); } #endif @@ -272,14 +262,9 @@ namespace CIAO "Successfully created a DDSSubscriber\n")); rti_sub->enable (); - CCM_DDS_Subscriber_i *rti_s = dynamic_cast < CCM_DDS_Subscriber_i *> (retval.in ()); - rti_s->set_impl (rti_sub); - return retval._retn (); #else - return this->impl ()->create_subscriber (qos, - a_listener, - mask); + return this->impl ()->create_subscriber (qos, a_listener, mask); #endif } @@ -307,8 +292,11 @@ namespace CIAO "Error: RTI delete_subscriber returned non-ok error code %C\n", translate_retcode (retval))); } - else DDS4CCM_DEBUG (6, (LM_INFO, CLINFO "CCM_DDS_DomainParticipant_i::delete_subscriber - " + else + { + DDS4CCM_DEBUG (6, (LM_INFO, CLINFO "CCM_DDS_DomainParticipant_i::delete_subscriber - " "Provided subscriber successfully deleted\n")); + } return retval; #else @@ -322,14 +310,20 @@ namespace CIAO ::DDS::Subscriber_var retval = ::DDS::Subscriber::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSSubscriber* sub = this->impl ()->get_builtin_subscriber (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_Subscriber_i (sub), - CORBA::NO_MEMORY ()); + if (sub) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_Subscriber_i (sub), + CORBA::NO_MEMORY ()); + } #else ::DDS::Subscriber_var sub = this->impl ()->get_builtin_subscriber (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_Subscriber_i (sub.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_nil (sub.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_Subscriber_i (sub.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } @@ -399,9 +393,6 @@ namespace CIAO "Successfully created topic with name %C and type %C\n", impl_name, type_name)); - CCM_DDS_Topic_i *tp = dynamic_cast < CCM_DDS_Topic_i *> (retval.in ()); - tp->set_impl (rti_topic); - return retval._retn (); #else return this->impl ()->create_topic (impl_name, @@ -477,9 +468,6 @@ namespace CIAO "Successfully created topic with name %C and type %C\n", impl_name, type_name)); - CCM_DDS_Topic_i *tp = dynamic_cast < CCM_DDS_Topic_i *> (retval.in ()); - tp->set_impl (rti_topic); - return retval._retn (); } else @@ -518,8 +506,11 @@ namespace CIAO "Error: RTI delete_topic returned non-ok error code %C\n", translate_retcode (retval))); } - else DDS4CCM_DEBUG (6, (LM_INFO, CLINFO "CCM_DDS_DomainParticipant_i::delete_topic - " + else + { + DDS4CCM_DEBUG (6, (LM_INFO, CLINFO "CCM_DDS_DomainParticipant_i::delete_topic - " "Provided topic successfully deleted\n")); + } return retval; #else @@ -560,14 +551,20 @@ namespace CIAO ::DDS::TopicDescription_var retval = ::DDS::TopicDescription::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDSTopicDescription* topic = this->impl ()->lookup_topicdescription (name); - ACE_NEW_THROW_EX (retval, - CCM_DDS_TopicDescription_i (topic), - CORBA::NO_MEMORY ()); + if (topic) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_TopicDescription_i (topic), + CORBA::NO_MEMORY ()); + } #else ::DDSTopicDescription_var topic = this->impl ()->lookup_topicdescription (name); - ACE_NEW_THROW_EX (retval, - CCM_DDS_TopicDescription_i (topic.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_ni (topic.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_TopicDescription_i (topic.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } @@ -623,9 +620,6 @@ namespace CIAO "Successfully created topic with name <%C> and filter expression <%C>\n", name, filter_expression)); - CCM_DDS_ContentFilteredTopic_i *tp = dynamic_cast < CCM_DDS_ContentFilteredTopic_i *> (retval.in ()); - tp->set_impl (rti_cft); - return retval._retn (); #else return this->impl ()->create_contentfilteredtopic ( @@ -690,7 +684,6 @@ namespace CIAO DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_qos"); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_DomainParticipantQos rti_qos; - rti_qos <<= qos; ::DDS::ReturnCode_t retcode = this->impl()-> get_qos (rti_qos); qos <<= rti_qos; return retcode; @@ -816,9 +809,7 @@ namespace CIAO DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_default_publisher_qos"); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_PublisherQos rti_qos; - rti_qos <<= qos; - ::DDS::ReturnCode_t retcode = - this->impl()-> get_default_publisher_qos (rti_qos); + ::DDS::ReturnCode_t retcode = this->impl()-> get_default_publisher_qos (rti_qos); qos <<= rti_qos; return retcode; #else @@ -845,7 +836,6 @@ namespace CIAO DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_default_subscriber_qos"); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_SubscriberQos rti_qos; - rti_qos <<= qos; ::DDS::ReturnCode_t retcode = this->impl()-> get_default_subscriber_qos (rti_qos); qos <<= rti_qos; @@ -874,7 +864,6 @@ namespace CIAO DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_default_topic_qos"); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_TopicQos rti_qos; - rti_qos <<= qos; ::DDS::ReturnCode_t retcode = this->impl()-> get_default_topic_qos (rti_qos); qos <<= rti_qos; @@ -903,7 +892,6 @@ namespace CIAO { DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_discovered_participant_data"); throw CORBA::NO_IMPLEMENT (); - } ::DDS::ReturnCode_t @@ -925,7 +913,6 @@ namespace CIAO { DDS4CCM_TRACE ("DDS_DomainParticipant_i::get_discovered_topic_data"); throw CORBA::NO_IMPLEMENT (); - } ::CORBA::Boolean @@ -965,14 +952,20 @@ namespace CIAO ::DDS::StatusCondition_var retval = ::DDS::StatusCondition::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSStatusCondition* sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_StatusCondition_i (sc), - CORBA::NO_MEMORY ()); + if (sc) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_StatusCondition_i (sc), + CORBA::NO_MEMORY ()); + } #else ::DDS::StatusCondition_var sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_StatusCondition_i (sc.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_nil (sc.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_StatusCondition_i (sc.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.cpp index fe61d91b23b..8cd479f7d89 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/PublisherListener.cpp @@ -34,15 +34,13 @@ namespace CIAO DDS4CCM_TRACE ("CCM_DDS_PublisherListener_i::on_offered_deadline_missed"); ::DDS::DataWriter_var dds_writer = ::DDS::DataWriter::_nil (); + ACE_NEW (dds_writer, + CCM_DDS_DataWriter_i (writer)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::OfferedDeadlineMissedStatus ddsstatus; ddsstatus <<= status; - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_offered_deadline_missed (dds_writer.in (), ddsstatus); #else - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_offered_deadline_missed (dds_writer.in (), status); #endif } @@ -55,15 +53,13 @@ namespace CIAO DDS4CCM_TRACE ("CCM_DDS_PublisherListener_i::on_offered_incompatible_qos"); ::DDS::DataWriter_var dds_writer = ::DDS::DataWriter::_nil (); + ACE_NEW (dds_writer, + CCM_DDS_DataWriter_i (writer)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::OfferedIncompatibleQosStatus ddsstatus; ddsstatus <<= status; - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_offered_incompatible_qos (dds_writer.in (), ddsstatus); #else - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_offered_incompatible_qos (dds_writer.in (), status); #endif } @@ -76,15 +72,13 @@ namespace CIAO DDS4CCM_TRACE ("CCM_DDS_PublisherListener_i::on_liveliness_lost"); ::DDS::DataWriter_var dds_writer = ::DDS::DataWriter::_nil (); + ACE_NEW (dds_writer, + CCM_DDS_DataWriter_i (writer)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::LivelinessLostStatus ddsstatus; ddsstatus <<= status; - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_liveliness_lost (dds_writer.in (), ddsstatus); #else - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_liveliness_lost (dds_writer.in (), status); #endif } @@ -97,15 +91,13 @@ namespace CIAO DDS4CCM_TRACE ("CCM_DDS_PublisherListener_i::on_publication_matched"); ::DDS::DataWriter_var dds_writer = ::DDS::DataWriter::_nil (); + ACE_NEW (dds_writer, + CCM_DDS_DataWriter_i (writer)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::PublicationMatchedStatus ddsstatus; ddsstatus <<= status; - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_publication_matched (dds_writer.in (), ddsstatus); #else - ACE_NEW (dds_writer, - CCM_DDS_DataWriter_i (writer)); this->impl_->on_publication_matched (dds_writer.in (), status); #endif } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.cpp b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.cpp index b6c2fe40e40..2d9b6b8ee97 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.cpp @@ -13,8 +13,8 @@ namespace CIAO { namespace DDS4CCM { - CCM_DDS_QueryCondition_i::CCM_DDS_QueryCondition_i () - : impl_ (0) + CCM_DDS_QueryCondition_i::CCM_DDS_QueryCondition_i (DDSQueryCondition * qc) + : impl_ (qc) { } @@ -49,19 +49,25 @@ namespace CIAO ::DDS::DataReader_ptr CCM_DDS_QueryCondition_i::get_datareader (void) { -#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW_THROW_EX (dds_reader, - CCM_DDS_DataReader_i (), - CORBA::NO_MEMORY ()); +#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDSDataReader* reader = this->impl ()->get_datareader (); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (reader); - - return dds_reader._retn (); + if (reader) + { + ACE_NEW_THROW_EX (dds_reader, + CCM_DDS_DataReader_i (reader), + CORBA::NO_MEMORY ()); + } #else - return this->impl ()->get_datareader (); + ::DDS::DataReader_var reader = this->impl ()->get_datareader (); + if (!CORBA::is_nil (reader.in ())) + { + ACE_NEW_THROW_EX (dds_reader, + CCM_DDS_DataReader_i (reader.in ()), + CORBA::NO_MEMORY ()); + } #endif + return dds_reader._retn (); } char * @@ -80,8 +86,7 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDS_StringSeq parameters; - ::DDS::ReturnCode_t retval = this->impl ()->get_query_parameters ( - parameters); + ::DDS::ReturnCode_t const retval = this->impl ()->get_query_parameters (parameters); query_parameters <<= parameters; return retval; #else diff --git a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.h b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.h index e7f7bd0dc17..e0a5abee529 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/QueryCondition.h @@ -37,36 +37,28 @@ namespace CIAO { public: /// Constructor - CCM_DDS_QueryCondition_i (void); + CCM_DDS_QueryCondition_i (DDSQueryCondition * qc); /// Destructor virtual ~CCM_DDS_QueryCondition_i (void); - virtual ::CORBA::Boolean - get_trigger_value (void); + virtual ::CORBA::Boolean get_trigger_value (void); - virtual ::DDS::SampleStateMask - get_sample_state_mask (void); + virtual ::DDS::SampleStateMask get_sample_state_mask (void); - virtual ::DDS::ViewStateMask - get_view_state_mask (void); + virtual ::DDS::ViewStateMask get_view_state_mask (void); - virtual ::DDS::InstanceStateMask - get_instance_state_mask (void); + virtual ::DDS::InstanceStateMask get_instance_state_mask (void); - virtual ::DDS::DataReader_ptr - get_datareader (void); + virtual ::DDS::DataReader_ptr get_datareader (void); - virtual char * - get_query_expression (void); + virtual char *get_query_expression (void); virtual ::DDS::ReturnCode_t - get_query_parameters ( - ::DDS::StringSeq & query_parameters); + get_query_parameters (::DDS::StringSeq & query_parameters); virtual ::DDS::ReturnCode_t - set_query_parameters ( - const ::DDS::StringSeq & query_parameters); + set_query_parameters (const ::DDS::StringSeq & query_parameters); DDSQueryCondition * get_impl (void); diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.cpp b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.cpp index c34642dab63..e8459b51e0a 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.cpp @@ -7,8 +7,8 @@ namespace CIAO { namespace DDS4CCM { - CCM_DDS_ReadCondition_i::CCM_DDS_ReadCondition_i (void) - : impl_ (0) + CCM_DDS_ReadCondition_i::CCM_DDS_ReadCondition_i (DDSReadCondition * rc) + : impl_ (rc) { } @@ -44,13 +44,13 @@ namespace CIAO CCM_DDS_ReadCondition_i::get_datareader (void) { ::DDS::DataReader_var retval = ::DDS::DataReader::_nil (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DataReader_i (), - CORBA::NO_MEMORY ()); - DDSDataReader* rd = this->impl ()->get_datareader (); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(retval.in ()); - rti_dr->set_impl (rd); - + ::DDSDataReader* rd = this->impl ()->get_datareader (); + if (rd) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DataReader_i (rd), + CORBA::NO_MEMORY ()); + } return retval._retn (); } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.h b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.h index 7bf2c6325b2..10ee871c817 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/ReadCondition.h @@ -37,7 +37,7 @@ namespace CIAO { public: /// Constructor - CCM_DDS_ReadCondition_i (void); + CCM_DDS_ReadCondition_i (DDSReadCondition * rc); /// Destructor virtual ~CCM_DDS_ReadCondition_i (void); diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp index ad31da57975..41ea04b1552 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/Subscriber.cpp @@ -45,14 +45,20 @@ namespace CIAO ::DDS::StatusCondition_var retval = ::DDS::StatusCondition::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSStatusCondition* sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_StatusCondition_i (sc), - CORBA::NO_MEMORY ()); + if (sc) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_StatusCondition_i (sc), + CORBA::NO_MEMORY ()); + } #else ::DDS::StatusCondition_var sc = this->impl ()->get_statuscondition (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_StatusCondition_i (sc.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_nil (sc.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_StatusCondition_i (sc.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } @@ -163,10 +169,6 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_Subscriber_i::create_datareader"); ::DDS::DataReader_var retval = ::DDS::DataReader::_nil (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DataReader_i (), - CORBA::NO_MEMORY ()); - DDSDataReaderListener *rti_drl = 0; if (!CORBA::is_nil (a_listener)) { @@ -209,9 +211,9 @@ namespace CIAO } rti_dr->enable (); - CCM_DDS_DataReader_i *dr = dynamic_cast < CCM_DDS_DataReader_i *>(retval.in ()); - dr->set_impl (rti_dr); - + ACE_NEW_THROW_EX (retval, + CCM_DDS_DataReader_i (rti_dr), + CORBA::NO_MEMORY ()); return retval._retn (); } @@ -225,10 +227,6 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_Subscriber_i::create_datareader_with_profile"); ::DDS::DataReader_var retval = ::DDS::DataReader::_nil (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DataReader_i (), - CORBA::NO_MEMORY ()); - DDSDataReaderListener *rti_drl = 0; if (!CORBA::is_nil (a_listener)) { @@ -281,9 +279,9 @@ namespace CIAO } rti_dr->enable (); - CCM_DDS_DataReader_i *dr = dynamic_cast < CCM_DDS_DataReader_i *>(retval.in ()); - dr->set_impl (rti_dr); - + ACE_NEW_THROW_EX (retval, + CCM_DDS_DataReader_i (rti_dr), + CORBA::NO_MEMORY ()); return retval._retn (); } @@ -310,8 +308,11 @@ namespace CIAO "Error: Returned non-ok error code %C\n", translate_retcode (retval))); } - else DDS4CCM_DEBUG (6, (LM_INFO, CLINFO "CCM_DDS_Subscriber_i::delete_datareader - " + else + { + DDS4CCM_DEBUG (6, (LM_INFO, CLINFO "CCM_DDS_Subscriber_i::delete_datareader - " "Datareader successfully deleted\n")); + } return retval; } @@ -327,12 +328,13 @@ namespace CIAO const char * impl_name) { ::DDS::DataReader_var retval = ::DDS::DataReader::_nil (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DataReader_i (), - CORBA::NO_MEMORY ()); DDSDataReader* dr = this->impl ()->lookup_datareader (impl_name); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(retval.in ()); - rti_dr->set_impl (dr); + if (dr) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DataReader_i (dr), + CORBA::NO_MEMORY ()); + } return retval._retn (); } @@ -374,7 +376,6 @@ namespace CIAO CIAO_TRACE ("CCM_DDS_Subscriber_i::get_qos"); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_SubscriberQos rti_qos; - rti_qos <<= qos; ::DDS::ReturnCode_t retcode = this->impl ()->get_qos (rti_qos); qos <<= rti_qos; return retcode; @@ -434,14 +435,20 @@ namespace CIAO ::DDS::DomainParticipant_var retval = ::DDS::DomainParticipant::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSDomainParticipant* p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DomainParticipant_i (p), - CORBA::NO_MEMORY ()); + if (p) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DomainParticipant_i (p), + CORBA::NO_MEMORY ()); + } #else ::DDS::DomainParticipant_var p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DomainParticipant_i (p.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_nil (p.in)) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DomainParticipant_i (p.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } @@ -467,9 +474,7 @@ namespace CIAO CIAO_TRACE ("CCM_DDS_Subscriber_i::get_default_datareader_qos"); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_DataReaderQos rti_qos; - rti_qos <<= qos; - ::DDS::ReturnCode_t retcode = - this->impl ()->get_default_datareader_qos (rti_qos); + ::DDS::ReturnCode_t retcode = this->impl ()->get_default_datareader_qos (rti_qos); qos <<= rti_qos; return retcode; #else diff --git a/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.cpp index 0328e563935..f5897fa3945 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/SubscriberListener.cpp @@ -46,16 +46,15 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_SubscriberListener_i::on_requested_deadline_missed"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::RequestedDeadlineMissedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_requested_deadline_missed (dds_reader.in (), ddsstatus); #else - this->impl_->on_requested_deadline_missed (the_reader, status); + this->impl_->on_requested_deadline_missed (dds_reader.in (), status); #endif } @@ -66,16 +65,15 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_SubscriberListener_i::on_requested_incompatible_qos"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::RequestedIncompatibleQosStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_requested_incompatible_qos (dds_reader.in (), ddsstatus); #else - this->impl_->on_requested_incompatible_qos (the_reader, status); + this->impl_->on_requested_incompatible_qos (dds_reader.in (), status); #endif } @@ -86,16 +84,15 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_SubscriberListener_i::on_sample_rejected"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::SampleRejectedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_sample_rejected (dds_reader.in (), ddsstatus); #else - this->impl_->on_sample_rejected (the_reader, status); + this->impl_->on_sample_rejected (dds_reader.in (), status); #endif } @@ -106,16 +103,15 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_SubscriberListener_i::on_liveliness_changed"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::LivelinessChangedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_liveliness_changed (dds_reader.in (), ddsstatus); #else - this->impl_->on_liveliness_changed (the_reader, status); + this->impl_->on_liveliness_changed (dds_reader.in (), status); #endif } @@ -125,15 +121,10 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_SubscriberListener_i::on_data_available"); -#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); this->impl_->on_data_available (dds_reader.in ()); -#else - this->impl_->on_data_available (the_reader); -#endif } void @@ -143,16 +134,15 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_SubscriberListener_i::on_subscription_matched"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::SubscriptionMatchedStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_subscription_matched (dds_reader.in (), ddsstatus); #else - this->impl_->on_subscription_matched (the_reader, status); + this->impl_->on_subscription_matched (dds_reader.in (), status); #endif } @@ -163,16 +153,15 @@ namespace CIAO { DDS4CCM_TRACE ("CCM_DDS_SubscriberListener_i::on_sample_lost"); + ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); + ACE_NEW (dds_reader, + CCM_DDS_DataReader_i (the_reader)); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS::SampleLostStatus ddsstatus; ddsstatus <<= status; - ::DDS::DataReader_var dds_reader = ::DDS::DataReader::_nil (); - ACE_NEW (dds_reader, CCM_DDS_DataReader_i ()); - CCM_DDS_DataReader_i *rti_dr = dynamic_cast < CCM_DDS_DataReader_i *>(dds_reader.in ()); - rti_dr->set_impl (the_reader); this->impl_->on_sample_lost (dds_reader.in (), ddsstatus); #else - this->impl_->on_sample_lost (the_reader, status); + this->impl_->on_sample_lost (dds_reader.in (), status); #endif } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/Topic.cpp b/CIAO/connectors/dds4ccm/impl/ndds/Topic.cpp index 3492cb4c9d6..935db7d77e3 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/Topic.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/Topic.cpp @@ -39,7 +39,6 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) ::DDS_TopicQos ddsqos; - ddsqos <<= qos; ::DDS_ReturnCode_t const retval = this->impl ()->get_qos (ddsqos); qos <<= ddsqos; return retval; @@ -95,8 +94,9 @@ namespace CIAO { #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDS_InconsistentTopicStatus ddsstatus; - ddsstatus <<= a_status; - return this->impl ()->get_inconsistent_topic_status (ddsstatus); + ::DDS::ReturnCode_t const retval = this->impl ()->get_inconsistent_topic_status (ddsstatus); + a_status <<= ddsstatus;; + return retval; #else return this->impl ()->get_inconsistent_topic_status (a_status); #endif @@ -171,14 +171,20 @@ namespace CIAO ::DDS::DomainParticipant_var retval = ::DDS::DomainParticipant::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSDomainParticipant* p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DomainParticipant_i (p), - CORBA::NO_MEMORY ()); + if (p) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DomainParticipant_i (p), + CORBA::NO_MEMORY ()); + } #else ::DDS::DomainParticipant_var p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DomainParticipant_i (p.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_nil (p.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DomainParticipant_i (p.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.cpp b/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.cpp index f9f8fc37b4c..95a71927d4c 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/TopicDescription.cpp @@ -46,14 +46,20 @@ namespace CIAO ::DDS::DomainParticipant_var retval = ::DDS::DomainParticipant::_nil (); #if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) DDSDomainParticipant* p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DomainParticipant_i (p), - CORBA::NO_MEMORY ()); + if (p) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DomainParticipant_i (p), + CORBA::NO_MEMORY ()); + } #else ::DDS::DomainParticipant_var p = this->impl ()->get_participant (); - ACE_NEW_THROW_EX (retval, - CCM_DDS_DomainParticipant_i (p.in ()), - CORBA::NO_MEMORY ()); + if (!CORBA::is_nil (p.in ())) + { + ACE_NEW_THROW_EX (retval, + CCM_DDS_DomainParticipant_i (p.in ()), + CORBA::NO_MEMORY ()); + } #endif return retval._retn (); } diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.cpp b/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.cpp index 6f25052d232..0a2b0f673a8 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.cpp +++ b/CIAO/connectors/dds4ccm/impl/ndds/TopicListener.cpp @@ -26,17 +26,14 @@ namespace CIAO ::DDSTopic* the_topic, const ::DDS_InconsistentTopicStatus & status) { -#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) - ::DDS::InconsistentTopicStatus ddsstatus; - ddsstatus <<= status; ::DDS::Topic_var dds_topic = ::DDS::Topic::_nil (); ACE_NEW (dds_topic, CCM_DDS_Topic_i (the_topic)); +#if defined (CIAO_DDS4CCM_NDDS) && (CIAO_DDS4CCM_NDDS==1) + ::DDS::InconsistentTopicStatus ddsstatus; + ddsstatus <<= status; this->impl_->on_inconsistent_topic (dds_topic.in (), ddsstatus); #else - ::DDS::Topic_var dds_topic = ::DDS::Topic::_nil (); - ACE_NEW (dds_topic, - CCM_DDS_Topic_i (the_topic)); this->impl_->on_inconsistent_topic (dds_topic.in (), status); #endif } |