From 08f4df24547750cd3bd969f210c789d5e2a22bac Mon Sep 17 00:00:00 2001 From: msmit Date: Thu, 28 Oct 2010 10:22:45 +0000 Subject: Thu Oct 28 10:28:24 UTC 2010 Marcel Smit * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h: * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: Prevented double code by introducing a new method. --- CIAO/ChangeLog | 8 +++++++ .../dds4ccm/impl/DDS_Event_Connector_T.cpp | 15 +----------- .../dds4ccm/impl/DDS_State_Connector_T.cpp | 15 +----------- .../dds4ccm/impl/DDS_TopicBase_Connector_T.cpp | 27 ++++++++++++++++++++++ .../dds4ccm/impl/DDS_TopicBase_Connector_T.h | 1 + 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 7afff2de15c..40b541db97f 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,11 @@ +Thu Oct 28 10:28:24 UTC 2010 Marcel Smit + + * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_State_Connector_T.cpp: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h: + * connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp: + Prevented double code by introducing a new method. + Thu Oct 28 10:04:59 UTC 2010 Marcel Smit * connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp: diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp index 7341da0d917..4396c6635f5 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_Event_Connector_T.cpp @@ -184,24 +184,11 @@ DDS_Event_Connector_T::topic_name ( { DDS4CCM_TRACE ("DDS_Event_Connector_T::topic_name"); - this->late_binding (ACE_OS::strlen (topic_name) == 0); - - if (this->late_binding () && - ACE_OS::strlen (topic_name) > 0 && - ACE_OS::strlen (this->topic_name_.in ()) == 0) + if (this->late_binded (topic_name)) { - TopicBaseConnector::topic_name (topic_name); this->do_configuration_complete (); this->do_ccm_activate (); } - else if (this->configuration_complete_) - { - throw ::CCM_DDS::NonChangeable (); - } - else - { - TopicBaseConnector::topic_name (topic_name); - } } template diff --git a/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp index f1dd8ab5106..4bf2cb8068f 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_State_Connector_T.cpp @@ -300,24 +300,11 @@ DDS_State_Connector_T::topic_name ( { DDS4CCM_TRACE ("DDS_State_Connector_T::topic_name"); - this->late_binding (ACE_OS::strlen (topic_name) == 0); - - if (this->late_binding () && - ACE_OS::strlen (topic_name) > 0 && - ACE_OS::strlen (this->topic_name_.in ()) == 0) + if (this->late_binded (topic_name)) { - TopicBaseConnector::topic_name (topic_name); this->do_configuration_complete (); this->do_ccm_activate (); } - else if (this->configuration_complete_) - { - throw ::CCM_DDS::NonChangeable (); - } - else - { - TopicBaseConnector::topic_name (topic_name); - } } template diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp index ef748a03ab1..8559ae5fdfd 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp @@ -32,6 +32,33 @@ DDS_TopicBase_Connector_T::late_binding (bool l this->late_binding_ |= late_binding; } +template +bool +DDS_TopicBase_Connector_T::late_binded ( + const char * topic_name) +{ + DDS4CCM_TRACE ("DDS_TopicBase_Connector_T::late_binded"); + + this->late_binding (ACE_OS::strlen (topic_name) == 0); + + if (this->late_binding () && + ACE_OS::strlen (topic_name) > 0 && + ACE_OS::strlen (this->topic_name_.in ()) == 0) + { + DDS_TopicBase_Connector_T::topic_name (topic_name); + return true; + } + else if (this->configuration_complete_) + { + throw ::CCM_DDS::NonChangeable (); + } + else + { + DDS_TopicBase_Connector_T::topic_name (topic_name); + } + return false; +} + template void DDS_TopicBase_Connector_T::configuration_complete (void) diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h index 9032c5b6950..dec4a2a239b 100644 --- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h +++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.h @@ -55,6 +55,7 @@ protected: bool late_binding (void); void late_binding (bool late_binding); + bool late_binded (const char * topic_name); CORBA::String_var topic_name_; DDS::StringSeq key_fields_; -- cgit v1.2.1