summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CIAO/ChangeLog151
-rw-r--r--CIAO/MPC/config/ciaoidldefaults.mpb2
-rw-r--r--CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp219
-rw-r--r--CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp9
-rw-r--r--CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp447
-rw-r--r--CIAO/connectors/dds4ccm/impl/DomainParticipantManager.h198
-rw-r--r--CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc1
-rw-r--r--CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp228
-rw-r--r--CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp275
-rw-r--r--CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp329
-rw-r--r--CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h107
-rw-r--r--CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp3
-rw-r--r--CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc1
-rw-r--r--CIAO/connectors/dds4ccm/tests/Getter/Sender/Getter_Test_Sender_exec.cpp12
-rwxr-xr-xCIAO/connectors/dds4ccm/tests/PortUsage/descriptors/run_test.pl4
-rw-r--r--CIAO/connectors/dds4ccm/tests/QueryCondition/Different/Receiver/Different_Test_Receiver_exec.cpp3
-rw-r--r--CIAO/connectors/dds4ccm/tests/SLManyByMany/Sender/SL_ManyByMany_Sender_exec.h2
-rw-r--r--CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl1
-rw-r--r--CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp62
-rw-r--r--CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h39
-rw-r--r--CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp19
21 files changed, 1314 insertions, 798 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog
index b34d6b499b5..050a6bf49b1 100644
--- a/CIAO/ChangeLog
+++ b/CIAO/ChangeLog
@@ -1,3 +1,154 @@
+Thu Jun 7 07:48:27 UTC 2012 Marcel Smit <msmit@remedy.nl>
+
+ * MPC/config/ciaoidldefaults.mpb:
+ Fixed compile issue related to GEN_OSTREAM.
+
+
+ Merged DDS4CCM_QOS_Handler branch into trunk.
+ Made the DomainParticipantManager more generic.
+ This manager manages the re-use of the DomainParticipants and
+ Topics and was implemented for RTI DDS. After the move, it's
+ available for other vendors (openDDS).
+
+ commit 8a0b18b8170de5e17b809c4ac66e9bf12f721598
+ Merge: ed688a4 c4917dd
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Thu Jun 7 08:48:42 2012 +0200
+
+ Merge branch 'master' into DDS4CCM_QOS_Handler
+
+ commit ed688a4c9dda6280686e8f8e2782d8e5266d7014
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Thu Jun 7 08:39:03 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ Optimized logging.
+
+ commit 3f272fbdc84e3e4983d6e15bcdb8fa7b43637f02
+ Merge: 9c0d8ab 0e4ff1a
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Thu Jun 7 08:32:03 2012 +0200
+
+ Merge branch 'DDS4CCM_QOS_Handler' of http://git.remedy.nl/git/atcd into DDS4CCM_QOS_Handler
+
+ commit 9c0d8abb9d3d9814dce1877aa3ed357468e0c632
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Thu Jun 7 08:31:49 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.h:
+ Renamed add_xxx and remove_xxx methods to register_xxx and
+ unregister_xxx respectively.
+ Also guard the list when a topic is registered or
+ unregistered.
+
+ * CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp:
+ Due to rename action. Also check the return value of the
+ register methods. If a participant or topic cannot be
+ registered log an error and throw in Internal exception.
+
+ commit 0e4ff1aa6eed5ab1c5454ff66020a3f36b8fc9c7
+ Author: Johnny Willemsen <jwillemsen@remedy.nl>
+ Date: Thu Jun 7 08:16:46 2012 +0200
+
+ * CIAO/connectors/dds4ccm/tests/QueryCondition/Different/Receiver/Different_Test_Receiver_exec.cpp:
+ Fixed logging, really bail out when we have a problem
+
+ commit c94b19372a805a33248a409aabd0b11f5fb6ac33
+ Author: Johnny Willemsen <jwillemsen@remedy.nl>
+ Date: Wed Jun 6 21:06:43 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ Shutdown opendds when no dp's are registered anymore
+
+ commit 878e648328179ceaa0b1b69e8feb4a0cd8d3b4bb
+ Author: Johnny Willemsen <jwillemsen@remedy.nl>
+ Date: Wed Jun 6 20:56:30 2012 +0200
+
+ * CIAO/connectors/dds4ccm/tests/Getter/Sender/Getter_Test_Sender_exec.cpp:
+ Check done_ in ccm_remove
+
+ commit 755de847ca5258281e8ffb570c23d646d136713a
+ Author: Johnny Willemsen <jwillemsen@remedy.nl>
+ Date: Wed Jun 6 20:42:46 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ Documentation fix
+
+ commit 6c0e018a313be100d79b545e556fa6d95ba884ed
+ Author: Johnny Willemsen <jwillemsen@remedy.nl>
+ Date: Wed Jun 6 20:41:32 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ Handle that qos_profile pointer can be zero
+
+ * CIAO/connectors/dds4ccm/tests/PortUsage/descriptors/run_test.pl:
+ Increased timeout
+
+ commit dad7f336d79e24b1897f446355453383738cc277
+ Author: Johnny Willemsen <jwillemsen@remedy.nl>
+ Date: Wed Jun 6 20:21:48 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp:
+ Added some commented out code
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ When we don't have any dp left, we could shutdown opendds, but
+ kept that commented out, it leads to all kind of shutdown
+ crashes
+
+ * CIAO/connectors/dds4ccm/tests/SLManyByMany/Sender/SL_ManyByMany_Sender_exec.h:
+ Removed export
+
+ * CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl:
+ * CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp:
+ * CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h:
+ * CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp:
+ Use publication_matched status
+
+ commit 423cc156dc943b94eac55676d8566102d9d8afaa
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Wed Jun 6 16:17:52 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp:
+ Added the domain participant handle to the logging.
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ Fixed runtime issue.
+
+ commit 737b8684e03e4ef575b9acafe7c75d85d3eaad80
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Wed Jun 6 16:03:52 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ Added the domain participant instance to the logging.
+
+ commit 8712ac32bee2d5b63e6f2c3e349b19e4fb280f36
+ Merge: 8f3614e 645e935
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Wed Jun 6 15:33:07 2012 +0200
+
+ Merge branch 'DDS4CCM_QOS_Handler' of http://git.remedy.nl/git/atcd into DDS4CCM_QOS_Handler
+
+ commit 8f3614e7bdd325e89b497ba1c80ded8277a3223d
+ Author: Marcel Smit <msmit@remedy.nl>
+ Date: Wed Jun 6 15:25:37 2012 +0200
+
+ * CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp:
+ Added the use of the DPMANAGER.
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp:
+ Added missing duplicate.
+ Refactored some of the reference counting on topics.
+
+ * CIAO/connectors/dds4ccm/impl/DomainParticipantManager.h:
+ Added some documentation.
+
+ * CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp:
+ * CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp:
+ Removed the use of the DPMANAGER.
+
+
Wed Jun 6 11:25:57 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl>
* connectors/dds4ccm/tests/QueryCondition/Different/Receiver/Different_Test_Receiver_exec.h:
diff --git a/CIAO/MPC/config/ciaoidldefaults.mpb b/CIAO/MPC/config/ciaoidldefaults.mpb
index 453c4219d04..1f77fe93390 100644
--- a/CIAO/MPC/config/ciaoidldefaults.mpb
+++ b/CIAO/MPC/config/ciaoidldefaults.mpb
@@ -1,7 +1,7 @@
// -*- MPC -*-
// $Id$
-project : ccm_lw, ccm_noevent, ccm_direct_collocation, taobaseidldefaults {
+project : ccm_lw, ccm_noevent, ccm_direct_collocation, taoidldefaults {
idlflags += -I$(CIAO_ROOT) -I$(CIAO_ROOT)/ccm
Modify_Custom (IDL) {
diff --git a/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp
index eed6fb4d96a..2ed2f459f69 100644
--- a/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp
+++ b/CIAO/connectors/dds4ccm/impl/DDS_Base_Connector_T.cpp
@@ -10,6 +10,8 @@
#include "dds4ccm/impl/PublisherListener.h"
#include "dds4ccm/impl/SubscriberListener.h"
+#include "dds4ccm/impl/DomainParticipantManager.h"
+
#if (CIAO_DDS4CCM_NDDS==1)
# include "dds4ccm/impl/ndds/TypeSupport.h"
# include "dds4ccm/impl/ndds/DomainParticipant.h"
@@ -19,12 +21,16 @@
# include "dds/DCPS/Marked_Default_Qos.h"
# include "dds/DCPS/RcHandle_T.h"
# include "dds/DCPS/RTPS/RtpsDiscovery.h"
+# include "dds/DCPS/Discovery.h"
# include "dds/DCPS/transport/framework/TransportType_rch.h"
# include "dds/DCPS/transport/rtps_udp/RtpsUdpInst_rch.h"
# include "dds/DCPS/transport/rtps_udp/RtpsUdpInst.h"
# include "dds/DCPS/transport/framework/TransportRegistry.h"
# include "dds/DCPS/transport/framework/TransportConfig_rch.h"
-# include "dds/DCPS/transport/framework/TransportDebug.h"
+#endif
+
+#if defined (GEN_OSTREAM_OPS)
+#include <sstream>
#endif
template <typename CCM_TYPE>
@@ -38,6 +44,10 @@ DDS_Base_Connector_T<CCM_TYPE>::DDS_Base_Connector_T (void)
ACE_Env_Value<int> id (ACE_TEXT("DDS4CCM_DEFAULT_DOMAIN_ID"), this->domain_id_);
this->domain_id_ = id;
+#if (CIAO_DDS4CCM_OPENDDS==1)
+ ACE_Env_Value<int> oid (ACE_TEXT("OPENDDS_RTPS_DEFAULT_D0"), this->domain_id_);
+ this->domain_id_ = oid;
+#endif
this->dlf_ =
ACE_Dynamic_Service<CIAO::DDS4CCM::Logger_Service>::instance ("DDS4CCM_Logger");
if (this->dlf_)
@@ -45,12 +55,6 @@ DDS_Base_Connector_T<CCM_TYPE>::DDS_Base_Connector_T (void)
this->dlf_->init ();
}
qos_xml_ = new DDS_XML_QOS_PARSER_TYPE;
-#if (CIAO_DDS4CCM_OPENDDS==1)
- ACE_Env_Value<int> dcpsdl (ACE_TEXT("DDS4CCM_OPENDDS_LOG_LEVEL"), 0);
- OpenDDS::DCPS::DCPS_debug_level = dcpsdl;
- ACE_Env_Value<int> dcpsdtl (ACE_TEXT("DDS4CCM_OPENDDS_TRANSPORT_LOG_LEVEL"), 0);
- OpenDDS::DCPS::Transport_debug_level = dcpsdtl;
-#endif
this->create_dds_participant_factory ();
}
@@ -62,9 +66,6 @@ DDS_Base_Connector_T<CCM_TYPE>::~DDS_Base_Connector_T (void)
DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_TRACE, DDS4CCM_INFO
"DDS_Base_Connector_T::~DDS_Base_Connector_T - "
"Connector has been destructed\n"));
-#if (CIAO_DDS4CCM_OPENDDS==1)
- //TheServiceParticipant->shutdown ();
-#endif
delete this->qos_xml_;
this->qos_xml_ = 0;
}
@@ -111,6 +112,7 @@ DDS_Base_Connector_T<CCM_TYPE>::create_dds_participant_factory (void)
TheServiceParticipant->add_discovery(OpenDDS::DCPS::static_rchandle_cast<OpenDDS::DCPS::Discovery>(disc));
TheServiceParticipant->set_repo_domain(this->domain_id (), disc->key());
+ //TheServiceParticipant->set_default_discovery (OpenDDS::DCPS::Discovery::DEFAULT_RTPS);
#else
this->participant_factory_ =
new ::CIAO::NDDS::DDS_DomainParticipantFactory_i;
@@ -217,11 +219,40 @@ DDS_Base_Connector_T<CCM_TYPE>::init_domain (
this->participant_factory_->set_default_participant_qos_with_profile (
this->qos_profile_.in ());
- participant = this->participant_factory_->create_participant_with_profile (
- this->domain_id_,
- this->qos_profile_.in (),
- ::DDS::DomainParticipantListener::_nil (),
- 0);
+ DDS::DomainParticipant_var dds_dp =
+ DPMANAGER->get_participant (this->domain_id_, this->qos_profile_.in ());
+
+ if (::CORBA::is_nil (dds_dp.in ()))
+ {
+ // Create a new participant for this qos profile and domain ID.
+ participant = this->participant_factory_->create_participant_with_profile (
+ this->domain_id_,
+ this->qos_profile_.in (),
+ ::DDS::DomainParticipantListener::_nil (),
+ 0);
+ if (!DPMANAGER->register_participant (this->qos_profile_.in (), participant))
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_domain - "
+ "Error: Unable to register DomainParticipant for domain <%d>\n",
+ this->domain_id_));
+ throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0);
+ }
+ }
+ else
+ {
+ // Re-use the domain_participant for this QOS profile and domain ID
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_domain - "
+ "Re-using domainparticipant "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
+ ". domain <%d> - "
+ "qos_profile <%C>\n",
+ DDS_INSTANCE_HANDLE_LOG (dds_dp->get_instance_handle ()),
+ this->domain_id_, this->qos_profile_.in ()));
+
+ participant = ::DDS::DomainParticipant::_duplicate (dds_dp.in ());
+ }
}
else
#endif
@@ -268,11 +299,48 @@ DDS_Base_Connector_T<CCM_TYPE>::init_domain (
}
#endif
- participant = this->participant_factory_->create_participant (
- this->domain_id_,
- qos,
- ::DDS::DomainParticipantListener::_nil (),
- 0);
+ DDS::DomainParticipant_var dds_dp =
+ DPMANAGER->get_participant (this->domain_id_, this->qos_profile_.in ());
+ if (::CORBA::is_nil (dds_dp.in ()))
+ {
+ // Create a new participant for this qos profile and domain ID.
+ participant = this->participant_factory_->create_participant (
+ this->domain_id_,
+ qos,
+ ::DDS::DomainParticipantListener::_nil (),
+ 0);
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_domain - "
+ "Created domainparticipant "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
+ ". domain <%d> - "
+ "qos_profile <%C>\n",
+ DDS_INSTANCE_HANDLE_LOG (participant->get_instance_handle ()),
+ this->domain_id_, this->qos_profile_.in ()));
+
+ if (!DPMANAGER->register_participant (this->qos_profile_.in (), participant))
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_domain - "
+ "Error: Unable to register DomainParticipant for domain <%d>\n",
+ this->domain_id_));
+ throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0);
+ }
+ }
+ else
+ {
+ // Re-use the domain_participant for this QOS profile and domain ID
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_domain - "
+ "Re-using domainparticipant "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
+ ". domain <%d> - "
+ "qos_profile <%C>\n",
+ DDS_INSTANCE_HANDLE_LOG (dds_dp->get_instance_handle ()),
+ this->domain_id_, this->qos_profile_.in ()));
+ participant = ::DDS::DomainParticipant::_duplicate (dds_dp.in ());
+ }
}
if (::CORBA::is_nil (participant))
@@ -381,15 +449,43 @@ DDS_Base_Connector_T<CCM_TYPE>::init_topic (
{
DDS4CCM_TRACE ("DDS_Base_Connector_T::init_topic");
- ::DDS::Topic_var tp;
+ ::DDS::TopicDescription_var tpd =
+ participant->lookup_topicdescription (topic_name);
+
+ ::DDS::Topic_var dds_tp = ::DDS::Topic::_narrow (tpd.in ());
+
+
#if (CIAO_DDS4CCM_NDDS==1)
if (!::CORBA::is_nil (this->qos_profile_.in ()))
{
- tp = participant->create_topic_with_profile (topic_name,
- typesupport_name,
- this->qos_profile_.in (),
- ::DDS::TopicListener::_nil (),
- 0);
+ if (CORBA::is_nil (dds_tp.in ()))
+ {
+ // Create a new topic
+ topic = participant->create_topic_with_profile (topic_name,
+ typesupport_name,
+ this->qos_profile_.in (),
+ ::DDS::TopicListener::_nil (),
+ 0);
+ if (!DPMANAGER->register_topic (participant, topic))
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_topic - "
+ "Error: Unable to register topic <%C>\n",
+ topic_name));
+ throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0);
+ }
+ }
+ else
+ {
+ // Re-use topic.
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_topic - "
+ "Re-using topic. topic_name <%C>\n",
+ topic_name));
+
+ topic = ::DDS::Topic::_duplicate (dds_tp);
+ DPMANAGER->_inc_ref (participant, topic);
+ }
}
else
#endif
@@ -437,21 +533,41 @@ DDS_Base_Connector_T<CCM_TYPE>::init_topic (
}
#endif
- tp = participant->create_topic (topic_name,
- typesupport_name,
- tqos,
- ::DDS::TopicListener::_nil (),
- 0);
+ if (CORBA::is_nil (dds_tp.in ()))
+ {
+ // Create a new topic
+ topic = participant->create_topic (topic_name,
+ typesupport_name,
+ tqos,
+ ::DDS::TopicListener::_nil (),
+ 0);
+ if (!DPMANAGER->register_topic (participant, topic))
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_topic - "
+ "Error: Unable to register topic <%C>\n",
+ topic_name));
+ throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0);
+ }
+ }
+ else
+ {
+ // Re-use topic.
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T::init_topic - "
+ "Re-using topic. topic_name <%C>\n",
+ topic_name));
+ topic = ::DDS::Topic::_duplicate (dds_tp);
+ DPMANAGER->_inc_ref (participant, topic);
+ }
}
- if (::CORBA::is_nil (tp.in ()))
+ if (::CORBA::is_nil (topic))
{
DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO
"DDS_Base_Connector_T::init_topic - "
"Error: Proxy returned a nil topic\n"));
throw ::CCM_DDS::InternalError (::DDS::RETCODE_ERROR, 0);
}
-
- topic = tp._retn ();
}
template <typename CCM_TYPE>
@@ -815,7 +931,17 @@ void DDS_Base_Connector_T<CCM_TYPE>::remove_topic (
{
DDS4CCM_TRACE ("DDS_Base_Connector_T::remove_topic");
- DDS::ReturnCode_t retcode = participant->delete_topic (topic);
+ DDS::ReturnCode_t retcode = ::DDS::RETCODE_OK;
+
+ if (DPMANAGER->unregister_topic (participant, topic))
+ {
+ CORBA::String_var name = topic->get_name ();
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION_STARTING, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T::remove_topic - "
+ "Going to delete topic <%C>\n",
+ name.in ()));
+ retcode = participant->delete_topic (topic);
+ }
if (retcode != ::DDS::RETCODE_OK)
{
throw ::CCM_DDS::InternalError (retcode, 0);
@@ -851,8 +977,27 @@ DDS_Base_Connector_T<CCM_TYPE>::remove_domain (
{
DDS4CCM_TRACE ("DDS_Base_Connector_T::remove_domain");
- DDS::ReturnCode_t retcode =
- this->participant_factory_->delete_participant (participant);
+ DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
+
+ if (DPMANAGER->unregister_participant (participant))
+ {
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T"
+ "::remove_domain - "
+ "Going to delete participant "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
+ ".\n",
+ DDS_INSTANCE_HANDLE_LOG (participant->get_instance_handle ())));
+
+ retcode = this->participant_factory_->delete_participant (participant);
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_TRACE, DDS4CCM_INFO
+ "DDS_Base_Connector_T"
+ "::remove_domain - "
+ "Deleted participant. Result <%C>\n",
+ ::CIAO::DDS4CCM::translate_retcode (retcode)));
+ }
+
if (retcode != ::DDS::RETCODE_OK)
{
throw ::CCM_DDS::InternalError (retcode, 0);
diff --git a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp
index bdaaa9b908b..90e7b3aeeba 100644
--- a/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp
+++ b/CIAO/connectors/dds4ccm/impl/DDS_TopicBase_Connector_T.cpp
@@ -245,6 +245,11 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::register_type (
{
DDS4CCM_TRACE ("DDS_TopicBase_Connector_T::register_type");
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ ACE_TEXT ("DDS_TopicBase_Connector_T::register_type - ")
+ ACE_TEXT ("Going to register type <%C>.\n"),
+ typesupport_name));
+
::DDS::ReturnCode_t retcode = ::DDS::RETCODE_ERROR;
#if (CIAO_DDS4CCM_NDDS==1)
::CIAO::NDDS::DDS_DomainParticipant_i *part =
@@ -273,7 +278,7 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::register_type (
}
retcode = DDS_TYPE::type_support::register_type(
- part->get_rti_entity (), typesupport_name);
+ part->get_rti_entity (), typesupport_name);
#else
typename DDS_TYPE::type_support::_var_type ts = new typename DDS_TYPE::type_support;
retcode = ts->register_type (participant, typesupport_name);
@@ -282,7 +287,7 @@ DDS_TopicBase_Connector_T<CCM_TYPE, DDS_TYPE, SEQ_TYPE>::register_type (
{
DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
"DDS_TopicBase_Connector_T::register_type - "
- "Error registering type <%C>\n",
+ "Error registering type <%C> in DDS\n",
::CIAO::DDS4CCM::translate_retcode (retcode)));
throw ::CCM_DDS::InternalError (retcode, 0);
}
diff --git a/CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp b/CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp
new file mode 100644
index 00000000000..2616bdd70d9
--- /dev/null
+++ b/CIAO/connectors/dds4ccm/impl/DomainParticipantManager.cpp
@@ -0,0 +1,447 @@
+// $Id$
+
+#include "dds4ccm/impl/DomainParticipantManager.h"
+#include "dds4ccm/impl/logger/Log_Macros.h"
+#include "dds4ccm/impl/Utils.h"
+#include "ace/Env_Value_T.h"
+
+#if (CIAO_DDS4CCM_NDDS==1)
+# include "ndds/convertors/InstanceHandle_t.h"
+#endif
+
+#if (CIAO_DDS4CCM_OPENDDS==1)
+# include "dds/DCPS/transport/framework/TransportDebug.h"
+# include "dds/DCPS/Service_Participant.h"
+#endif
+
+namespace CIAO
+{
+ namespace DDS4CCM
+ {
+ //============================================================
+ // DomainParticipantManager::DDSParticipantTopic::DDSParticipantTopic
+ //============================================================
+ DomainParticipantManager::DDSParticipantTopic::DDSParticipantTopic (
+ DDS::DomainParticipant_ptr dp)
+ : ref_count_ (1),
+ dp_ (DDS::DomainParticipant::_duplicate(dp))
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::DDSParticipantTopic");
+ }
+
+ DomainParticipantManager::DDSParticipantTopic::~DDSParticipantTopic (void)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::~DDSParticipantTopic");
+ }
+
+ DDS::DomainParticipant_ptr
+ DomainParticipantManager::DDSParticipantTopic::get_participant ()
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::get_participant");
+
+ return DDS::DomainParticipant::_duplicate(this->dp_);
+ }
+
+ bool
+ DomainParticipantManager::DDSParticipantTopic::register_topic (DDS::Topic_ptr tp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::register_topic");
+
+ CORBA::String_var name = tp->get_name ();
+ if (this->tps_.find (name.in ()) == this->tps_.end ())
+ {
+ std::pair <Topics_iterator, bool> to_insert =
+ this->tps_.insert (std::make_pair<std::string, int>(name.in (), 1));
+ if (!to_insert.second)
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DomainParticipantManager::DDSParticipantTopic"
+ "::register_topic - Unable to register topic <%C>\n",
+ name.in ()));
+ return false;
+ }
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::DDSParticipantTopic"
+ "::register_topic - Registered provided topic <%C> - "
+ "ref_count <%d>\n",
+ name.in (), to_insert.first->second));
+ return true;
+ }
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::DDSParticipantTopic"
+ "::register_topic - Topic <%C> already registered. "
+ "No need to register it again.\n",
+ name.in ()));
+ return true;
+ }
+
+ bool
+ DomainParticipantManager::DDSParticipantTopic::unregister_topic (DDS::Topic_ptr tp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::unregister_topic");
+
+ CORBA::String_var name = tp->get_name ();
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::DDSParticipantTopic"
+ "::unregister_topic - Check if topic <%C> with "
+ "ref_count <%d> can be unregistered\n",
+ name.in (),
+ this->tps_[name.in ()]));
+
+ Topics_iterator it = this->tps_.find(name.in ());
+ if (it != this->tps_.end ())
+ {
+ if (it->second == 1)
+ {
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::DDSParticipantTopic"
+ "::unregister_topic - Save to unregister topic <%C>\n",
+ name.in ()));
+ return true;
+ }
+ }
+ --it->second;
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::DDSParticipantTopic"
+ "::unregister_topic - Decremented ref_count for topic <%C>: "
+ "ref_count <%d>\n",
+ name.in (),
+ it->second));
+ return false;
+ }
+
+ int
+ DomainParticipantManager::DDSParticipantTopic::_ref_count ()
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_ref_count");
+
+ return this->ref_count_;
+ }
+
+ void
+ DomainParticipantManager::DDSParticipantTopic::_inc_ref ()
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_inc_ref");
+
+ ++this->ref_count_;
+ }
+
+ void
+ DomainParticipantManager::DDSParticipantTopic::_dec_ref ()
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_dec_ref");
+
+ --this->ref_count_;
+ }
+
+ void
+ DomainParticipantManager::DDSParticipantTopic::_inc_ref_topic (DDS::Topic_ptr tp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_inc_ref_topic");
+
+ CORBA::String_var name = tp->get_name ();
+ Topics_iterator it = this->tps_.find (name.in ());
+ if (it == this->tps_.end ())
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DomainParticipantManager::register_topic - "
+ "Unable to find provided topic <%C>\n",
+ name.in ()));
+ }
+
+ ++this->tps_[name.in ()];
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::DDSParticipantTopic"
+ "::_inc_ref_topic - Increment topic ref_count. topic <%C> "
+ "- ref_count <%d>\n",
+ tp->get_name (),
+ this->tps_[name.in ()]));
+ }
+
+ //============================================================
+ // DomainParticipantManager::DomainParticipantManager
+ //============================================================
+ DomainParticipantManager::DomainParticipantManager (void)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::DomainParticipantManager");
+
+#if (CIAO_DDS4CCM_NDDS==1)
+ ACE_Env_Value<int> verbosity (ACE_TEXT("DDS4CCM_NDDS_LOG_VERBOSITY"),
+ NDDS_CONFIG_LOG_VERBOSITY_SILENT);
+
+ NDDS_Config_LogVerbosity n_verbosity =
+ static_cast <NDDS_Config_LogVerbosity> (verbosity.operator int());
+ NDDSConfigLogger::get_instance()->set_verbosity (n_verbosity);
+#elif (CIAO_DDS4CCM_OPENDDS==1)
+ ACE_Env_Value<int> dcpsdl (ACE_TEXT("DDS4CCM_OPENDDS_LOG_LEVEL"), 0);
+ OpenDDS::DCPS::DCPS_debug_level = dcpsdl;
+ ACE_Env_Value<int> dcpsdtl (ACE_TEXT("DDS4CCM_OPENDDS_TRANSPORT_LOG_LEVEL"), 0);
+ OpenDDS::DCPS::Transport_debug_level = dcpsdtl;
+#endif
+ }
+
+ DomainParticipantManager::~DomainParticipantManager (void)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::~DomainParticipantManager");
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::~DomainParticipantManager - "
+ "Finalizing DDS\n"));
+
+#if (CIAO_DDS4CCM_NDDS==1)
+ DDSDomainParticipantFactory::finalize_instance ();
+#elif (CIAO_DDS4CCM_OPENDDS==1)
+// TheServiceParticipant->shutdown ();
+#endif
+ }
+
+ bool
+ DomainParticipantManager::register_topic (DDS::DomainParticipant_ptr dp,
+ DDS::Topic_ptr tp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::register_topic");
+
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard,
+ this->dps_mutex_, CORBA::INTERNAL ());
+
+ DomainParticipants_iterator iter =
+ this->get_participanttopic_by_participant (dp);
+
+ if (iter != this->dps_.end ())
+ {
+ return iter->second->register_topic (tp);
+ }
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DomainParticipantManager::register_topic - "
+ "Unable to find provided DomainParticipant with handle "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER ".\n",
+ DDS_INSTANCE_HANDLE_LOG (dp->get_instance_handle ())));
+ return false;
+ }
+
+ bool
+ DomainParticipantManager::unregister_topic (DDS::DomainParticipant_ptr dp,
+ DDS::Topic_ptr tp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::unregister_topic");
+
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard,
+ this->dps_mutex_, CORBA::INTERNAL ());
+
+ DomainParticipants_iterator iter =
+ this->get_participanttopic_by_participant (dp);
+
+ if (iter != this->dps_.end ())
+ {
+ return iter->second->unregister_topic (tp);
+ }
+
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DomainParticipantManager::unregister_topic - "
+ "Unable to find provided DomainParticipant with handle "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER ".\n",
+ DDS_INSTANCE_HANDLE_LOG (dp->get_instance_handle ())));
+ return false;
+ }
+
+ DDS::DomainParticipant_ptr
+ DomainParticipantManager::get_participant (const DDS::DomainId_t domain_id,
+ const char * qos_profile)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::get_participant");
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::get_participant - "
+ "Searching DomainParticipant for domain <%d> "
+ "with profile <%C>\n",
+ domain_id, qos_profile));
+
+ std::string profile;
+ if (qos_profile)
+ {
+ profile = qos_profile;
+ }
+ IdQosProfile idqos =
+ std::make_pair<std::string, DDS::DomainId_t>(profile, domain_id);
+ DomainParticipants_iterator it_found = this->dps_.find (idqos);
+
+ if (it_found != this->dps_.end () && it_found->second)
+ {
+ ::DDS::DomainParticipant_var dp = it_found->second->get_participant ();
+ it_found->second->_inc_ref ();
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::get_participant - "
+ "DomainParticipant found. domain <%d> - "
+ "profile <%C> - ref_count <%d> - handle "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER "\n",
+ domain_id,
+ qos_profile,
+ it_found->second->_ref_count (),
+ DDS_INSTANCE_HANDLE_LOG (dp->get_instance_handle ())));
+
+ return dp._retn ();
+ }
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::get_participant - "
+ "DomainParticipant for domain <%d> with profile <%C> "
+ "does not exist.\n",
+ domain_id, qos_profile));
+ return ::DDS::DomainParticipant::_nil ();
+ }
+
+ bool
+ DomainParticipantManager::register_participant (const char * qos_profile,
+ DDS::DomainParticipant_ptr dp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::register_participant");
+
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard,
+ this->dps_mutex_, CORBA::INTERNAL ());
+
+ DDS::DomainId_t const domain_id = dp->get_domain_id ();
+ std::string profile;
+ if (qos_profile)
+ {
+ profile = qos_profile;
+ }
+ IdQosProfile idqos =
+ std::make_pair<std::string, DDS::DomainId_t>(profile, domain_id);
+ DomainParticipants_iterator it_found = this->dps_.find (idqos);
+
+ if (it_found == this->dps_.end())
+ {
+ DDSParticipantTopic * dpt = 0;
+ ACE_NEW_THROW_EX (dpt,
+ DDSParticipantTopic (dp),
+ ::CORBA::NO_MEMORY ());
+ std::pair <DomainParticipants_iterator, bool> to_insert =
+ this->dps_.insert (std::make_pair<IdQosProfile,
+ DDSParticipantTopic *>(idqos, dpt));
+ if (!to_insert.second)
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DomainParticipantManager::register_participant - "
+ "Unable to insert a new DomainParticipant/Topic "
+ "combination for <%d, %C>.\n",
+ domain_id, qos_profile));
+ return false;
+ }
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::register_participant - "
+ "Added a new DomainParticipant/Topic "
+ "combination for <%d, %C>. Handle "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER ".\n",
+ domain_id, qos_profile,
+ DDS_INSTANCE_HANDLE_LOG (dp->get_instance_handle ())));
+ return true;
+
+ }
+
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::register_participant - "
+ "Don't add participant for domain <%d> with profile <%C> since it already "
+ "exists : <"
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER ">\n",
+ domain_id, qos_profile,
+ DDS_INSTANCE_HANDLE_LOG (dp->get_instance_handle ())));
+ return false;
+ }
+
+ bool
+ DomainParticipantManager::unregister_participant (DDS::DomainParticipant_ptr dp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::unregister_participant");
+
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard,
+ this->dps_mutex_, CORBA::INTERNAL ());
+
+ DDS::DomainId_t const domain_id = dp->get_domain_id ();
+ DomainParticipants_iterator iter =
+ this->get_participanttopic_by_participant (dp);
+ if (iter != this->dps_.end ())
+ {
+ if (iter->second->_ref_count () == 1)
+ {
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO
+ "DomainParticipantManager::unregister_participant - "
+ "Delete participant "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
+ " for domain <%d> since ref_count is one.\n",
+ DDS_INSTANCE_HANDLE_LOG (dp->get_instance_handle ()),
+ domain_id));
+ delete iter->second;
+
+ // Save to remove from list
+ this->dps_.erase (iter);
+ }
+ else
+ {
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO
+ "DomainParticipantManager::unregister_participant - "
+ "Don't delete participant "
+ DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
+ " for domain <%d> since "
+ "it's still used - ref_count is <%d>\n",
+ DDS_INSTANCE_HANDLE_LOG (dp->get_instance_handle ()),
+ domain_id,
+ iter->second->_ref_count ()));
+ iter->second->_dec_ref ();
+ return false;
+ }
+ }
+
+#if (CIAO_DDS4CCM_OPENDDS==1)
+ if (this->dps_.empty ())
+ {
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DomainParticipantManager::unregister_participant - "
+ "No participants anymore, shutting down OpenDDS.\n"));
+ // TheServiceParticipant->shutdown ();
+ }
+#endif
+
+ return true;
+ }
+
+ void
+ DomainParticipantManager::_inc_ref (DDS::DomainParticipant_ptr dp,
+ DDS::Topic_ptr tp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::_inc_ref");
+
+ DomainParticipants_iterator iter =
+ this->get_participanttopic_by_participant (dp);
+ if (iter != this->dps_.end ())
+ {
+ iter->second->_inc_ref_topic (tp);
+ }
+ }
+
+ DomainParticipantManager::DomainParticipants_iterator
+ DomainParticipantManager::get_participanttopic_by_participant (DDS::DomainParticipant_ptr dp)
+ {
+ DDS4CCM_TRACE ("DomainParticipantManager::get_participanttopic_by_participant");
+
+ DomainParticipants_iterator pos = this->dps_.begin();
+ while (pos != this->dps_.end())
+ {
+ if (pos->second && pos->second->get_participant ()->get_instance_handle () ==
+ dp->get_instance_handle ())
+ {
+ break;
+ }
+ ++pos;
+ }
+ return pos;
+ }
+ }
+}
+
+#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
+template ACE_Singleton<CIAO::DDS4CCM::DomainParticipantManager, TAO_SYNCH_MUTEX> *
+ ACE_Singleton<CIAO::DDS4CCM::DomainParticipantManager, TAO_SYNCH_MUTEX>::singleton_;
+#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
diff --git a/CIAO/connectors/dds4ccm/impl/DomainParticipantManager.h b/CIAO/connectors/dds4ccm/impl/DomainParticipantManager.h
new file mode 100644
index 00000000000..13687fae0d5
--- /dev/null
+++ b/CIAO/connectors/dds4ccm/impl/DomainParticipantManager.h
@@ -0,0 +1,198 @@
+/**
+ * @author William R. Otte <wotte@dre.vanderbilt.edu>
+ * @author Johnny Willemsen (jwillemsen@remedy.nl)
+ *
+ * $Id$
+ *
+ */
+
+#ifndef DOMAINPARTICIPANTMANAGER_H_
+#define DOMAINPARTICIPANTMANAGER_H_
+
+#include "dds4ccm/impl/dds4ccm_dds_impl_export.h"
+
+#include "ace/Singleton.h"
+#include "tao/orbconf.h"
+
+#include "dds4ccm/idl/dds_rtf2_dcpsC.h"
+
+#include <map>
+#include <string>
+
+namespace CIAO
+{
+ namespace DDS4CCM
+ {
+ /**
+ *
+ * @class : DomainParticipantManager
+ *
+ * @brief :
+ *
+ * Stores a DDSParticipantTopic per domain ID and QOS profile string.
+ * When several connectors are joining the same domain ID, using the
+ * same QOS settings (ie have the same QOS profile string),
+ * the DomainParticipant for that combination is shared. This is done
+ * to save resources (running threads/memory usage).
+ *
+ * The DomainParticipantManager is a singleton.
+ *
+ */
+ class DDS4CCM_DDS_IMPL_Export DomainParticipantManager : private ACE_Copy_Disabled
+ {
+ friend class ACE_Singleton<DomainParticipantManager, TAO_SYNCH_MUTEX>;
+
+ /**
+ *
+ * @class : DDSParticipantTopic
+ *
+ * @brief :
+ *
+ * Stores a list of topics for a specific domain. If
+ * several connectors run in the same process and those
+ * connectors are making use of the same topic, the topics
+ * are shared amongst the connectors.
+ *
+ * This class maintains a reference count. It's save to remove
+ * a topic once the reference count becomes one.
+ *
+ */
+ class DDSParticipantTopic
+ {
+ public:
+ DDSParticipantTopic (DDS::DomainParticipant_ptr dp);
+ ~DDSParticipantTopic (void);
+
+ DDS::DomainParticipant_ptr get_participant ();
+
+ /**
+ * Adds a topic to the internal list. Returns
+ * false if the topic is already there or when
+ * the insertion fails.
+ */
+ bool register_topic (DDS::Topic_ptr tp);
+
+ /**
+ * Removes a topic from the internal list when
+ * the reference count for that specific topic
+ * is one. If not, it decrements the reference
+ * count for the given topic.
+ * Returns true if deleted from the list.
+ * Returns false if reference count != 1.
+ */
+ bool unregister_topic (DDS::Topic_ptr tp);
+
+ /**
+ * Returns the reference count of this class
+ */
+ int _ref_count ();
+ /**
+ * Increments the reference count of this class
+ */
+ void _inc_ref ();
+ /**
+ * Decrements the reference count of this class
+ */
+ void _dec_ref ();
+
+ /**
+ * Increments the reference count of the given
+ * topic (ie: search for the topic in the internal
+ * map and increments its refcount
+ */
+ void _inc_ref_topic (DDS::Topic_ptr tp);
+ private:
+ int ref_count_;
+ DDS::DomainParticipant_var dp_;
+
+ typedef std::map <std::string, int> Topics;
+ typedef Topics::iterator Topics_iterator;
+ Topics tps_;
+ };
+
+ private:
+ /// Constructor
+ DomainParticipantManager (void);
+
+ public:
+ /// Destructor
+ ~DomainParticipantManager (void);
+
+ /**
+ * Invokes register_topic on the corresponding
+ * DDSParticipantTopic instance.
+ * DDSParticipantTopic is found based on the
+ * given DomainParticipant_ptr
+ */
+ bool register_topic (DDS::DomainParticipant_ptr dp,
+ DDS::Topic_ptr tp);
+
+ /**
+ * Invokes remove_topic on the corresponding
+ * DDSParticipantTopic instance.
+ * DDSParticipantTopic is found based on the
+ * given DomainParticipant_ptr
+ */
+ bool unregister_topic (DDS::DomainParticipant_ptr dp,
+ DDS::Topic_ptr tp);
+
+ /**
+ * Searches for the DomainParticipant_ptr in the internal map.
+ * Search is based on the given domain ID and the given QOS
+ * (QOS profile string). If found, it'll increment the
+ * reference count of the DDSParticipantTopic instance.
+ */
+ DDS::DomainParticipant_ptr get_participant (const DDS::DomainId_t domain_id,
+ const char * qos_profile);
+
+ /**
+ * Adding a DDSParticipantTopic instance when the
+ * internal maps doesn't contain a reference. Returns
+ * false if there's already an DDSParticipantTopic
+ * available (base on domain ID and QOS)
+ */
+ bool register_participant (const char * qos_profile,
+ DDS::DomainParticipant_ptr dp);
+
+ /**
+ * Removes the DDSParticipantTopic instance when the
+ * reference count is one.
+ * Returns false if the reference count of the corresponding
+ * DDSParticipantTopic was not nil
+ */
+ bool unregister_participant (DDS::DomainParticipant_ptr dp);
+
+ void _inc_ref (DDS::DomainParticipant_ptr dp,
+ DDS::Topic_ptr tp);
+
+ private:
+ TAO_SYNCH_MUTEX dps_mutex_;
+
+ typedef std::pair <std::string, DDS::DomainId_t> IdQosProfile;
+ typedef std::map < IdQosProfile, DDSParticipantTopic *> DomainParticipants;
+ DomainParticipants dps_;
+
+ typedef DomainParticipants::iterator DomainParticipants_iterator;
+
+ /**
+ * Search for the DomainParticipant in the internal map.
+ * Result is base on the instance handles of the
+ * DomainParticipants
+ */
+ DomainParticipants_iterator
+ get_participanttopic_by_participant (DDS::DomainParticipant_ptr dp);
+ };
+
+ typedef ACE_Singleton<DomainParticipantManager,
+ TAO_SYNCH_MUTEX> Domain_Participant_Manager;
+ }
+}
+
+#define DPMANAGER ::CIAO::DDS4CCM::Domain_Participant_Manager::instance ()
+
+/// Declare a process wide singleton
+DDS4CCM_DDS_IMPL_SINGLETON_DECLARE (ACE_Singleton,
+ ::CIAO::DDS4CCM::DomainParticipantManager,
+ TAO_SYNCH_MUTEX)
+
+#endif
diff --git a/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc b/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc
index f6cdb899543..08e131fdcfc 100644
--- a/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc
+++ b/CIAO/connectors/dds4ccm/impl/dds4ccm_impl.mpc
@@ -26,6 +26,7 @@ project(CIAO_DDS4CCM_DDS_Impl) : install, dds4ccm_skel, dds4ccm_lem_stub, taolib
SubscriberListener.cpp
TopicListener.cpp
Utils.cpp
+ DomainParticipantManager.cpp
}
specific {
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp
index 942c7b1419f..a91d70de9f6 100644
--- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp
+++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipant.cpp
@@ -12,7 +12,6 @@
#include "dds4ccm/impl/ndds/StatusCondition.h"
#include "dds4ccm/impl/ndds/TopicListener.h"
-#include "dds4ccm/impl/ndds/DomainParticipantManager.h"
#include "dds4ccm/impl/ndds/Utils.h"
#include "dds4ccm/impl/ndds/convertors/PublisherQos.h"
@@ -452,80 +451,51 @@ namespace CIAO
::CORBA::NO_MEMORY ());
}
- DDSTopicDescription * dds_td =
- this->rti_entity ()->lookup_topicdescription (impl_name);
- DDSTopic * dds_tp = 0;
- if (dds_td)
+ DDS_TopicQos ccm_dds_qos;
+ DDS_ReturnCode_t const retcode = this->rti_entity ()->get_default_topic_qos (ccm_dds_qos);
+ if (retcode != DDS_RETCODE_OK)
{
- dds_tp = DDSTopic::narrow (dds_td);
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_DomainParticipant_i"
+ "::create_topic - "
+ "Error: Unable to retrieve default topic qos\n"));
+ return ::DDS::Topic::_nil ();
}
+ ccm_dds_qos <<= qos;
+
+ DDSTopic * dds_tp = this->rti_entity ()->create_topic (impl_name,
+ type_name,
+ ccm_dds_qos,
+ ccm_dds_tl,
+ mask);
if (!dds_tp)
{
- DDS_TopicQos ccm_dds_qos;
- DDS_ReturnCode_t const retcode = this->rti_entity ()->get_default_topic_qos (ccm_dds_qos);
- if (retcode != DDS_RETCODE_OK)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipant_i"
- "::create_topic - "
- "Error: Unable to retrieve default topic qos\n"));
- return ::DDS::Topic::_nil ();
- }
- ccm_dds_qos <<= qos;
-
- dds_tp = this->rti_entity ()->create_topic (impl_name,
- type_name,
- ccm_dds_qos,
- ccm_dds_tl,
- mask);
-
- if (!dds_tp)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipant_i::create_topic - "
- "Error: RTI DDS returned a nil topic "
- "with name <%C> and type <%C>\n",
- impl_name, type_name));
- delete ccm_dds_tl;
- return ::DDS::Topic::_nil ();
- }
-
- ::DDS::Topic_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_Topic_i (dds_tp, this),
- ::CORBA::NO_MEMORY ());
-
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO
"DDS_DomainParticipant_i::create_topic - "
- "Successfully created topic with name <%C> and type <%C>\n",
+ "Error: RTI DDS returned a nil topic "
+ "with name <%C> and type <%C>\n",
impl_name, type_name));
-
- DPMANAGER->add_topic (this->rti_entity (), dds_tp);
-
- if (ccm_dds_tl)
- {
- ccm_dds_tl->set_dds_topic (retval.in ());
- }
-
- return retval._retn ();
+ delete ccm_dds_tl;
+ return ::DDS::Topic::_nil ();
}
- else
- {
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DDS_DomainParticipant_i::create_topic - "
- "Re-using topic with name <%C> and type <%C>.\n",
- impl_name, type_name));
- DPMANAGER->_inc_ref (this->rti_entity (), dds_tp);
+ ::DDS::Topic_var retval;
+ ACE_NEW_THROW_EX (retval,
+ DDS_Topic_i (dds_tp, this),
+ ::CORBA::NO_MEMORY ());
- ::DDS::Topic_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_Topic_i (dds_tp, this),
- ::CORBA::NO_MEMORY ());
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
+ "DDS_DomainParticipant_i::create_topic - "
+ "Successfully created topic with name <%C> and type <%C>\n",
+ impl_name, type_name));
- return retval._retn ();
+ if (ccm_dds_tl)
+ {
+ ccm_dds_tl->set_dds_topic (retval.in ());
}
+
+ return retval._retn ();
}
@@ -572,80 +542,50 @@ namespace CIAO
::CORBA::NO_MEMORY ());
}
- DDSTopicDescription * dds_td =
- this->rti_entity ()->lookup_topicdescription (impl_name);
DDSTopic * dds_tp = 0;
- if (dds_td)
+
+ char * lib_name = get_library_name(qos_profile);
+ char * prof_name = get_profile_name(qos_profile);
+
+ if (lib_name != 0 && prof_name != 0)
{
- dds_tp = DDSTopic::narrow (dds_td);
+ dds_tp = this->rti_entity ()->create_topic_with_profile (
+ impl_name,
+ type_name,
+ lib_name,
+ prof_name,
+ ccm_dds_tl,
+ mask);
}
+ ACE_OS::free (lib_name);
+ ACE_OS::free (prof_name);
if (!dds_tp)
{
- char * lib_name = get_library_name(qos_profile);
- char * prof_name = get_profile_name(qos_profile);
-
- if (lib_name != 0 && prof_name != 0)
- {
- dds_tp = this->rti_entity ()->create_topic_with_profile (
- impl_name,
- type_name,
- lib_name,
- prof_name,
- ccm_dds_tl,
- mask);
- }
- ACE_OS::free (lib_name);
- ACE_OS::free (prof_name);
-
- if (!dds_tp)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipant_i::create_topic_with_profile <%C> - "
- "Error: RTI DDS returned a nil topic\n",
- qos_profile));
- delete ccm_dds_tl;
- return ::DDS::Topic::_nil ();
- }
-
- ::DDS::Topic_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_Topic_i (dds_tp, this),
- ::CORBA::NO_MEMORY ());
-
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_DDS_NIL_RETURN, (LM_ERROR, DDS4CCM_INFO
"DDS_DomainParticipant_i::create_topic_with_profile <%C> - "
- "Successfully created topic with name %C and type %C\n",
- qos_profile,
- impl_name, type_name));
+ "Error: RTI DDS returned a nil topic\n",
+ qos_profile));
+ delete ccm_dds_tl;
+ return ::DDS::Topic::_nil ();
+ }
- if (ccm_dds_tl)
- {
- ccm_dds_tl->set_dds_topic (retval.in ());
- }
- DPMANAGER->add_topic (this->rti_entity (), dds_tp);
+ ::DDS::Topic_var retval;
+ ACE_NEW_THROW_EX (retval,
+ DDS_Topic_i (dds_tp, this),
+ ::CORBA::NO_MEMORY ());
- return retval._retn ();
- }
- else
- {
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DDS_DomainParticipant_i::create_topic_with_profile <%C> - "
- "Re-using topic with name %C and type %C.\n",
- qos_profile,
- impl_name, type_name));
- DPMANAGER->_inc_ref (this->rti_entity (), dds_tp);
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
+ "DDS_DomainParticipant_i::create_topic_with_profile <%C> - "
+ "Successfully created topic with name %C and type %C\n",
+ qos_profile,
+ impl_name, type_name));
- ::DDS::Topic_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_Topic_i (dds_tp, this),
- ::CORBA::NO_MEMORY ());
- if (ccm_dds_tl)
- {
- ccm_dds_tl->set_dds_topic (retval.in ());
- }
- return retval._retn ();
+ if (ccm_dds_tl)
+ {
+ ccm_dds_tl->set_dds_topic (retval.in ());
}
+ return retval._retn ();
}
@@ -676,28 +616,24 @@ namespace CIAO
"Successfully casted provided object reference to servant.\n",
topic_name.in ()));
- ::DDS::ReturnCode_t retval = DDS::RETCODE_OK;
- if (DPMANAGER->remove_topic (this->rti_entity (), tp))
+ const DDS_ReturnCode_t retcode = this->rti_entity ()->delete_topic (tp);
+ if (retcode != DDS_RETCODE_OK)
{
- retval = this->rti_entity ()->delete_topic (tp);
-
- if (retval != DDS_RETCODE_OK)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipant_i::delete_topic <%C> - "
- "Error: RTI delete_topic returned non-ok error code %C\n",
- topic_name.in (),
- ::CIAO::DDS4CCM::translate_retcode (retval)));
- }
- else
- {
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
- "DDS_DomainParticipant_i::delete_topic <%C> - "
- "Provided topic successfully deleted\n",
- topic_name.in ()));
- }
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_DomainParticipant_i::delete_topic <%C> - "
+ "Error: delete_topic returned non-ok error code %C\n",
+ topic_name.in (),
+ ::CIAO::DDS4CCM::translate_retcode (retcode)));
}
- return retval;
+ else
+ {
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
+ "DDS_DomainParticipant_i::delete_topic <%C> - "
+ "Provided topic successfully deleted\n",
+ topic_name.in ()));
+ }
+
+ return retcode;
}
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp
index dc22ba31724..b7368c30e2f 100644
--- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp
+++ b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp
@@ -8,7 +8,6 @@
#include "dds4ccm/impl/ndds/Utils.h"
#include "dds4ccm/impl/Utils.h"
#include "dds4ccm/impl/logger/Log_Macros.h"
-#include "dds4ccm/impl/ndds/DomainParticipantManager.h"
namespace CIAO
{
@@ -47,79 +46,58 @@ namespace CIAO
ACE_CString qos_profile = "default";
- DDSDomainParticipant *dds_dp =
- DPMANAGER->get_participant (domain_id, qos_profile.c_str ());
+ DDS_DomainParticipantQos ccm_dds_qos;
+ DDS_ReturnCode_t retcode = DDSDomainParticipantFactory::get_instance()->get_default_participant_qos (ccm_dds_qos);
+ if (retcode != DDS_RETCODE_OK)
+ {
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_DomainParticipantFactory_i"
+ "::create_participant - "
+ "Error: Unable to retrieve default participant qos\n"));
+ return ::DDS::DomainParticipant::_nil ();
+ }
+ ccm_dds_qos <<= qos;
+ DDSDomainParticipant * dds_dp = DDSDomainParticipantFactory::get_instance ()->
+ create_participant (domain_id,
+ ccm_dds_qos,
+ ccm_dds_dpl,
+ mask);
if (!dds_dp)
{
- DDS_DomainParticipantQos ccm_dds_qos;
- DDS_ReturnCode_t retcode = DDSDomainParticipantFactory::get_instance()->get_default_participant_qos (ccm_dds_qos);
- if (retcode != DDS_RETCODE_OK)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i"
- "::create_participant - "
- "Error: Unable to retrieve default participant qos\n"));
- return ::DDS::DomainParticipant::_nil ();
- }
- ccm_dds_qos <<= qos;
- dds_dp = DDSDomainParticipantFactory::get_instance ()->
- create_participant (domain_id,
- ccm_dds_qos,
- ccm_dds_dpl,
- mask);
-
- if (!dds_dp)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i"
- "::create_participant - "
- "Error: Unable to create DomainParticipant for domain <%d>\n",
- domain_id));
- delete ccm_dds_dpl;
- return ::DDS::DomainParticipant::_nil ();
- }
-
- ::DDS::DomainParticipant_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_DomainParticipant_i (dds_dp),
- ::CORBA::NO_MEMORY ());
- retcode = dds_dp->enable ();
- if (retcode != DDS_RETCODE_OK)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i"
- "::create_participant - "
- "Error: Unable to enable the domainparticipant "
- "for domain <%d>: <%C>\n",
- domain_id,
- ::CIAO::DDS4CCM::translate_retcode (retcode)));
- delete ccm_dds_dpl;
- throw ::CORBA::INTERNAL ();
- }
-
- if (ccm_dds_dpl)
- {
- ccm_dds_dpl->set_dds_dp (retval.in ());
- }
-
- DPMANAGER->add_participant (qos_profile.c_str (), dds_dp);
-
- return retval._retn ();
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_DomainParticipantFactory_i"
+ "::create_participant - "
+ "Error: Unable to create DomainParticipant for domain <%d>\n",
+ domain_id));
+ delete ccm_dds_dpl;
+ return ::DDS::DomainParticipant::_nil ();
}
- else
+
+ ::DDS::DomainParticipant_var retval;
+ ACE_NEW_THROW_EX (retval,
+ DDS_DomainParticipant_i (dds_dp),
+ ::CORBA::NO_MEMORY ());
+ retcode = dds_dp->enable ();
+ if (retcode != DDS_RETCODE_OK)
{
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i::create_participant - Re-using participant "
- "for QOS profile <%C> and domain <%d>.\n",
- qos_profile.c_str (),
- domain_id));
- ::DDS::DomainParticipant_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_DomainParticipant_i (dds_dp),
- ::CORBA::NO_MEMORY ());
- return retval._retn ();
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_DomainParticipantFactory_i"
+ "::create_participant - "
+ "Error: Unable to enable the domainparticipant "
+ "for domain <%d>: <%C>\n",
+ domain_id,
+ ::CIAO::DDS4CCM::translate_retcode (retcode)));
+ delete ccm_dds_dpl;
+ throw ::CORBA::INTERNAL ();
}
+
+ if (ccm_dds_dpl)
+ {
+ ccm_dds_dpl->set_dds_dp (retval.in ());
+ }
+
+ return retval._retn ();
}
@@ -146,85 +124,67 @@ namespace CIAO
::CORBA::NO_MEMORY ());
}
- DDSDomainParticipant *dds_dp =
- DPMANAGER->get_participant (domain_id, qos_profile);
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
+ "DDS_DomainParticipantFactory_i::create_participant_with_profile - "
+ "Creating participant: profile <%C> - domain <%d>\n",
+ qos_profile,
+ domain_id));
+
+ char * lib_name = get_library_name(qos_profile);
+ char * prof_name = get_profile_name(qos_profile);
+
+ DDSDomainParticipant * dds_dp = 0;
+ if (lib_name != 0 && prof_name != 0)
+ {
+ dds_dp = DDSDomainParticipantFactory::get_instance ()->
+ create_participant_with_profile (domain_id,
+ lib_name,
+ prof_name,
+ ccm_dds_dpl,
+ mask);
+ }
+
+ ACE_OS::free (lib_name);
+ ACE_OS::free (prof_name);
if (!dds_dp)
{
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i::create_participant_with_profile - "
- "Creating participant: profile <%C> - domain <%d>\n",
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_DomainParticipantFactory_i::create_participant_with_profile <%C> - "
+ "Error: Unable to create DomainParticipant for domain <%d>\n",
qos_profile,
domain_id));
-
- char * lib_name = get_library_name(qos_profile);
- char * prof_name = get_profile_name(qos_profile);
-
- if (lib_name != 0 && prof_name != 0)
- {
- dds_dp = DDSDomainParticipantFactory::get_instance ()->
- create_participant_with_profile (domain_id,
- lib_name,
- prof_name,
- ccm_dds_dpl,
- mask);
- }
-
- ACE_OS::free (lib_name);
- ACE_OS::free (prof_name);
-
- if (!dds_dp)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i::create_participant_with_profile <%C> - "
- "Error: Unable to create DomainParticipant for domain <%d>\n",
- qos_profile,
- domain_id));
- delete ccm_dds_dpl;
- return ::DDS::DomainParticipant::_nil ();
- }
- ::DDS::DomainParticipant_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_DomainParticipant_i (dds_dp),
- ::CORBA::NO_MEMORY ());
- DDS_ReturnCode_t retcode = dds_dp->enable ();
- if (retcode != DDS_RETCODE_OK)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i::create_participant_with_profile <%C> - "
- "Error: Unable to enable DomainParticipant for domain <%d>: <%C>\n",
- qos_profile,
- domain_id,
- ::CIAO::DDS4CCM::translate_retcode (retcode)));
- delete ccm_dds_dpl;
- throw ::CORBA::INTERNAL ();
- }
-
- if (ccm_dds_dpl)
- {
- ccm_dds_dpl->set_dds_dp (retval.in ());
- }
- DDS_DomainParticipant_i * typed_dp =
- dynamic_cast < DDS_DomainParticipant_i *>
- (retval.in ());
-
- typed_dp->set_rti_entity (dds_dp);
- DPMANAGER->add_participant (qos_profile, dds_dp);
- return retval._retn ();
+ delete ccm_dds_dpl;
+ return ::DDS::DomainParticipant::_nil ();
}
- else
+ ::DDS::DomainParticipant_var retval;
+ ACE_NEW_THROW_EX (retval,
+ DDS_DomainParticipant_i (dds_dp),
+ ::CORBA::NO_MEMORY ());
+ DDS_ReturnCode_t retcode = dds_dp->enable ();
+ if (retcode != DDS_RETCODE_OK)
{
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i::create_participant_with_profile - Re-using "
- "participant for QOS profile <%C> and domain <%d>.\n",
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
+ "DDS_DomainParticipantFactory_i::create_participant_with_profile <%C> - "
+ "Error: Unable to enable DomainParticipant for domain <%d>: <%C>\n",
qos_profile,
- domain_id));
- ::DDS::DomainParticipant_var retval;
- ACE_NEW_THROW_EX (retval,
- DDS_DomainParticipant_i (dds_dp),
- ::CORBA::NO_MEMORY ());
- return retval._retn ();
+ domain_id,
+ ::CIAO::DDS4CCM::translate_retcode (retcode)));
+ delete ccm_dds_dpl;
+ throw ::CORBA::INTERNAL ();
}
+
+ if (ccm_dds_dpl)
+ {
+ ccm_dds_dpl->set_dds_dp (retval.in ());
+ }
+ DDS_DomainParticipant_i * typed_dp =
+ dynamic_cast < DDS_DomainParticipant_i *>
+ (retval.in ());
+
+ typed_dp->set_rti_entity (dds_dp);
+
+ return retval._retn ();
}
::DDS::ReturnCode_t
@@ -251,35 +211,24 @@ namespace CIAO
"::delete_participant - "
"Successfully casted provided object reference to servant type.\n"));
- ::DDS::ReturnCode_t retval = DDS::RETCODE_OK;
-
- if (DPMANAGER->remove_participant (part->get_rti_entity ()))
+ const DDS_ReturnCode_t retcode = DDSDomainParticipantFactory::get_instance ()->
+ delete_participant (part->get_rti_entity ());
+ if (retcode != DDS_RETCODE_OK)
{
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_TRACE, DDS4CCM_INFO
+ DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
"DDS_DomainParticipantFactory_i"
"::delete_participant - "
- "Going to delete participant.\n"));
-
- retval = DDSDomainParticipantFactory::get_instance ()->
- delete_participant (part->get_rti_entity ());
-
- if (retval != DDS::RETCODE_OK)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i"
- "::delete_participant - "
- "RTI delete_participant returned non-ok error code %C\n",
- ::CIAO::DDS4CCM::translate_retcode (retval)));
- }
- else
- {
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
- "DDS_DomainParticipantFactory_i"
- "::delete_participant - "
- "Successfully deleted provided participant.\n"));
- }
+ "delete_participant returned non-ok error code %C\n",
+ ::CIAO::DDS4CCM::translate_retcode (retcode)));
}
- return retval;
+ else
+ {
+ DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
+ "DDS_DomainParticipantFactory_i"
+ "::delete_participant - "
+ "Successfully deleted provided participant.\n"));
+ }
+ return retcode;
}
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp
deleted file mode 100644
index 38525ae84c5..00000000000
--- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-// $Id$
-
-#include "dds4ccm/impl/ndds/DomainParticipantManager.h"
-#include "dds4ccm/impl/ndds/TypeSupport.h"
-#include "dds4ccm/impl/logger/Log_Macros.h"
-#include "dds4ccm/impl/Utils.h"
-#include "ace/Env_Value_T.h"
-
-namespace CIAO
-{
- namespace NDDS
- {
- //============================================================
- // DomainParticipantManager::DDSParticipantTopic::DDSParticipantTopic
- //============================================================
- DomainParticipantManager::DDSParticipantTopic::DDSParticipantTopic (
- DDSDomainParticipant * dp)
- : ref_count_ (1),
- dp_ (dp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::DDSParticipantTopic");
- }
-
- DomainParticipantManager::DDSParticipantTopic::~DDSParticipantTopic (void)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::~DDSParticipantTopic");
- }
-
- DDSDomainParticipant *
- DomainParticipantManager::DDSParticipantTopic::get_participant ()
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::get_participant");
-
- return this->dp_;
- }
-
- bool
- DomainParticipantManager::DDSParticipantTopic::add_topic (DDSTopic * tp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::add_topic");
-
- if (this->tps_.find (tp) == this->tps_.end ())
- {
- this->tps_[tp] = 1;
-
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::DDSParticipantTopic"
- "::add_topic - Added provided topic. topic <%C> - "
- "ref_count <%d>\n",
- tp->get_name (),
- this->tps_[tp]));
- return true;
- }
- return false;
- }
-
- bool
- DomainParticipantManager::DDSParticipantTopic::remove_topic (DDSTopic * tp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::remove_topic");
- if (this->tps_[tp] == 1)
- {
- return true;
- }
- --this->tps_[tp];
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::DDSParticipantTopic"
- "::remove_topic - Decremented ref_count. topic <%C> - "
- "ref_count <%d>\n",
- tp->get_name (),
- this->tps_[tp]));
- return false;
- }
-
- int
- DomainParticipantManager::DDSParticipantTopic::_ref_count ()
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_ref_count");
-
- return this->ref_count_;
- }
-
- void
- DomainParticipantManager::DDSParticipantTopic::_inc_ref ()
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_inc_ref");
-
- ++this->ref_count_;
- }
-
- void
- DomainParticipantManager::DDSParticipantTopic::_dec_ref ()
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_dec_ref");
-
- --this->ref_count_;
- }
-
- void
- DomainParticipantManager::DDSParticipantTopic::_inc_ref_topic (DDSTopic * tp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DDSParticipantTopic::_inc_ref_topic");
-
- ++this->tps_[tp];
-
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::DDSParticipantTopic"
- "::_inc_ref_topic - Increment topic ref_count. topic <%C> "
- "- ref_count <%d>\n",
- tp->get_name (),
- this->tps_[tp]));
- }
-
- //============================================================
- // DomainParticipantManager::DomainParticipantManager
- //============================================================
- DomainParticipantManager::DomainParticipantManager (void)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::DomainParticipantManager");
-
- ACE_Env_Value<int> verbosity (ACE_TEXT("DDS4CCM_NDDS_LOG_VERBOSITY"),
- NDDS_CONFIG_LOG_VERBOSITY_SILENT);
-
- NDDS_Config_LogVerbosity n_verbosity =
- static_cast <NDDS_Config_LogVerbosity> (verbosity.operator int());
- NDDSConfigLogger::get_instance()->set_verbosity (n_verbosity);
- }
-
- DomainParticipantManager::~DomainParticipantManager (void)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::~DomainParticipantManager");
-
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::~DomainParticipantManager - "
- "Finalizing DDS\n"));
-
- DDSDomainParticipantFactory::finalize_instance ();
- }
-
- bool
- DomainParticipantManager::add_topic (DDSDomainParticipant * dp,
- DDSTopic * tp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::add_topic");
-
- DomainParticipants_iterator iter =
- this->get_participanttopic_by_participant (dp);
- if (iter != this->dps_.end ())
- {
- return iter->second->add_topic (tp);
- }
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DomainParticipantManager::add_topic - "
- "Unable to find provided DomainParticipant for.\n"));
- return false;
- }
-
- bool
- DomainParticipantManager::remove_topic (DDSDomainParticipant * dp,
- DDSTopic * tp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::remove_topic");
-
- DomainParticipants_iterator iter =
- this->get_participanttopic_by_participant (dp);
- if (iter != this->dps_.end ())
- {
- return iter->second->remove_topic (tp);
- }
-
- return false;
- }
-
- DDSDomainParticipant *
- DomainParticipantManager::get_participant (const DDS_DomainId_t domain_id,
- const char * qos_profile)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::get_participant");
-
- IdQosProfile idqos =
- std::make_pair<std::string, DDS_DomainId_t>(qos_profile, domain_id);
- DomainParticipants_iterator it_found = this->dps_.find (idqos);
-
- if (it_found != this->dps_.end () && it_found->second)
- {
- it_found->second->_inc_ref ();
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::get_participant - "
- "DomainParticipant found. domain <%d> - "
- "profile <%C> - ref_count <%d>\n",
- domain_id,
- qos_profile,
- it_found->second->_ref_count ()));
- return it_found->second->get_participant ();
- }
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::get_participant - "
- "DomainParticipant for domain <%d> with profile <%C> "
- "does not exist.\n",
- domain_id, qos_profile));
- return 0;
- }
-
- bool
- DomainParticipantManager::add_participant (const char * qos_profile,
- DDSDomainParticipant * dp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::add_participant");
-
- ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard,
- this->dps_mutex_, CORBA::INTERNAL ());
-
- const DDS_DomainId_t domain_id = dp->get_domain_id ();
- IdQosProfile idqos =
- std::make_pair<std::string, DDS_DomainId_t>(qos_profile, domain_id);
- DomainParticipants_iterator it_found = this->dps_.find (idqos);
-
- if (it_found == this->dps_.end())
- {
- DDSParticipantTopic * dpt = 0;
- ACE_NEW_THROW_EX (dpt,
- DDSParticipantTopic (dp),
- ::CORBA::NO_MEMORY ());
- std::pair <DomainParticipants_iterator, bool> to_insert =
- this->dps_.insert (std::make_pair<IdQosProfile,
- DDSParticipantTopic *>(idqos, dpt));
- if (!to_insert.second)
- {
- DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO
- "DomainParticipantManager::add_participant - "
- "Unable to insert a new DomainParticipant/Topic "
- "combination for <%d, %C>.\n",
- domain_id, qos_profile));
- return false;
- }
-
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::add_participant - "
- "Added a new DomainParticipant/Topic "
- " combination for <%d, %C>.\n",
- domain_id, qos_profile));
- return true;
-
- }
-
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_DEBUG, DDS4CCM_INFO
- "DomainParticipantManager::add_participant - "
- "Don't add participant for domain <%d> with profile <%C> since it already "
- "exists.\n",
- domain_id, qos_profile));
- return false;
- }
-
- bool
- DomainParticipantManager::remove_participant (DDSDomainParticipant * dp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::remove_participant");
-
- ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, _guard,
- this->dps_mutex_, CORBA::INTERNAL ());
-
- const DDS_DomainId_t domain_id = dp->get_domain_id ();
- DomainParticipants_iterator iter =
- this->get_participanttopic_by_participant (dp);
- if (iter != this->dps_.end ())
- {
- if (iter->second->_ref_count () == 1)
- {
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO
- "DomainParticipantManager::remove_participant - "
- "Delete participant for domain <%d> since ref_count is one. \n",
- domain_id));
- delete iter->second;
-
- // Save to remove from list
- this->dps_.erase (iter);
- }
- else
- {
- iter->second->_dec_ref ();
- DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_UNIMP_ACTION, (LM_TRACE, DDS4CCM_INFO
- "DomainParticipantManager::remove_participant - "
- "Don't delete participant for domain <%d> since "
- "it's still used - ref_count is still <%d>\n",
- domain_id,
- iter->second->_ref_count ()));
- return false;
- }
- }
- return true;
- }
-
- void
- DomainParticipantManager::_inc_ref (DDSDomainParticipant * dp,
- DDSTopic * tp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::_inc_ref");
-
- DomainParticipants_iterator iter =
- this->get_participanttopic_by_participant (dp);
- if (iter != this->dps_.end ())
- {
- iter->second->_inc_ref_topic (tp);
- }
- }
-
- DomainParticipantManager::DomainParticipants_iterator
- DomainParticipantManager::get_participanttopic_by_participant (DDSDomainParticipant * dp)
- {
- DDS4CCM_TRACE ("DomainParticipantManager::get_participanttopic_by_participant");
-
- DomainParticipants_iterator pos = this->dps_.begin();
- while (pos != this->dps_.end())
- {
- if (pos->second && pos->second->get_participant () == dp)
- {
- break;
- }
- ++pos;
- }
- return pos;
- }
- }
-}
-
-#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
-template ACE_Singleton<CIAO::DDS4CCM::DomainParticipantManager, TAO_SYNCH_MUTEX> *
- ACE_Singleton<CIAO::DDS4CCM::DomainParticipantManager, TAO_SYNCH_MUTEX>::singleton_;
-#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h b/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h
deleted file mode 100644
index 0a5bb224e31..00000000000
--- a/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantManager.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * @author William R. Otte <wotte@dre.vanderbilt.edu>
- * @author Johnny Willemsen (jwillemsen@remedy.nl)
- *
- * $Id$
- *
- * Wrapper facade for NDDS.
- */
-
-#ifndef DOMAINPARTICIPANTMANAGER_H_
-#define DOMAINPARTICIPANTMANAGER_H_
-
-#include "dds4ccm/impl/ndds/dds4ccm_ndds_export.h"
-
-#include "ace/Singleton.h"
-#include "ace/SString.h"
-#include "tao/orbconf.h"
-
-#include "ndds/ndds_cpp.h"
-
-#include <map>
-
-namespace CIAO
-{
- namespace NDDS
- {
- class DDS4CCM_NDDS_Export DomainParticipantManager : private ACE_Copy_Disabled
- {
- friend class ACE_Singleton<DomainParticipantManager, TAO_SYNCH_MUTEX>;
-
- class DDSParticipantTopic
- {
- public:
- DDSParticipantTopic (DDSDomainParticipant * dp);
- ~DDSParticipantTopic (void);
-
- DDSDomainParticipant * get_participant ();
-
- bool add_topic (DDSTopic * tp);
- bool remove_topic (DDSTopic * tp);
-
- int _ref_count ();
- void _inc_ref ();
- void _dec_ref ();
-
- void _inc_ref_topic (DDSTopic * tp);
- private:
- int ref_count_;
- DDSDomainParticipant * dp_;
-
- typedef std::map <DDSTopic *, int> Topics;
- typedef Topics::iterator Topics_iterator;
- Topics tps_;
- };
-
- private:
- /// Constructor
- DomainParticipantManager (void);
-
- public:
- /// Destructor
- ~DomainParticipantManager (void);
-
- bool add_topic (DDSDomainParticipant *dp,
- DDSTopic * tp);
-
- bool remove_topic (DDSDomainParticipant * dp,
- DDSTopic *tp);
-
- DDSDomainParticipant * get_participant (const DDS_DomainId_t domain_id,
- const char * qos_profile);
-
- bool
- add_participant (const char * qos_profile,
- DDSDomainParticipant * dp);
-
- bool remove_participant (DDSDomainParticipant * dp);
-
- void _inc_ref (DDSDomainParticipant * dp,
- DDSTopic * tp);
-
- private:
- TAO_SYNCH_MUTEX dps_mutex_;
-
- typedef std::pair <std::string, DDS_DomainId_t> IdQosProfile;
- typedef std::map < IdQosProfile, DDSParticipantTopic *> DomainParticipants;
- DomainParticipants dps_;
-
- typedef DomainParticipants::iterator DomainParticipants_iterator;
-
- DomainParticipants_iterator
- get_participanttopic_by_participant (DDSDomainParticipant * dp);
- };
-
- typedef ACE_Singleton<DomainParticipantManager,
- TAO_SYNCH_MUTEX> Domain_Participant_Factory;
- }
-}
-
-#define DPMANAGER ::CIAO::NDDS::Domain_Participant_Factory::instance ()
-
-/// Declare a process wide singleton
-DDS4CCM_DDS_NDDS_SINGLETON_DECLARE (ACE_Singleton,
- ::CIAO::NDDS::DomainParticipantManager,
- TAO_SYNCH_MUTEX)
-
-#endif
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp b/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp
index 31fffbecff3..a9e80f40fc5 100644
--- a/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp
+++ b/CIAO/connectors/dds4ccm/impl/ndds/TypeSupport.cpp
@@ -185,9 +185,10 @@ namespace CIAO
type));
return false;
}
+
DDS4CCM_DEBUG (DDS4CCM_LOG_LEVEL_ACTION, (LM_INFO, DDS4CCM_INFO
"DDS_TypeSupport_i::register_type - "
- "Registered factory for type <%C> and participant <%@>\n",
+ "Going to register factory for type <%C> and participant <%@>\n",
type, dp));
return register_factory_i (type, f, dp);
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc b/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc
index 677f9eba314..1c54f59c015 100644
--- a/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc
+++ b/CIAO/connectors/dds4ccm/impl/ndds/ndds_idltocpp.mpc
@@ -21,7 +21,6 @@ project(CIAO_DDS4CCM_DDS_NDDS) : install, ndds_idltocpp_stub, taolib, \
DomainParticipant.cpp
DomainParticipantFactory.cpp
DomainParticipantListener.cpp
- DomainParticipantManager.cpp
Publisher.cpp
PublisherListener.cpp
QueryCondition.cpp
diff --git a/CIAO/connectors/dds4ccm/tests/Getter/Sender/Getter_Test_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/Getter/Sender/Getter_Test_Sender_exec.cpp
index d0576a5303d..5acdaba5651 100644
--- a/CIAO/connectors/dds4ccm/tests/Getter/Sender/Getter_Test_Sender_exec.cpp
+++ b/CIAO/connectors/dds4ccm/tests/Getter/Sender/Getter_Test_Sender_exec.cpp
@@ -226,7 +226,7 @@ namespace CIAO_Getter_Test_Sender_Impl
ACE_Time_Value (0, 500000)) == -1)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ")
- ACE_TEXT ("Error scheduling timer")));
+ ACE_TEXT ("Error scheduling timer\n")));
}
}
}
@@ -351,14 +351,18 @@ namespace CIAO_Getter_Test_Sender_Impl
void
Sender_exec_i::ccm_passivate (void)
{
- /* Your code here. */
+ this->reactor ()->cancel_timer (this->ticker_);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender_exec_i::stop : Timer canceled.\n")));
}
void
Sender_exec_i::ccm_remove (void)
{
- this->reactor ()->cancel_timer (this->ticker_);
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender_exec_i::stop : Timer canceled.\n")));
+ if (!this->done_)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::ccm_remove : ")
+ ACE_TEXT ("Never got start signal\n")));
+ }
}
extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr
diff --git a/CIAO/connectors/dds4ccm/tests/PortUsage/descriptors/run_test.pl b/CIAO/connectors/dds4ccm/tests/PortUsage/descriptors/run_test.pl
index 029997017f1..dbf352c961d 100755
--- a/CIAO/connectors/dds4ccm/tests/PortUsage/descriptors/run_test.pl
+++ b/CIAO/connectors/dds4ccm/tests/PortUsage/descriptors/run_test.pl
@@ -198,8 +198,8 @@ foreach $file (@files) {
"-x $file -k file://$ior_emfile");
$E->SpawnWaitKill (5 * $tg_executor->ProcessStartWaitInterval ());
- print "Sleeping 30 seconds to allow task to complete\n";
- sleep (30);
+ print "Sleeping 60 seconds to allow task to complete\n";
+ sleep (60);
print "Teardown the application\n";
$E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher",
diff --git a/CIAO/connectors/dds4ccm/tests/QueryCondition/Different/Receiver/Different_Test_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/QueryCondition/Different/Receiver/Different_Test_Receiver_exec.cpp
index 891c2118e7a..378e41fced1 100644
--- a/CIAO/connectors/dds4ccm/tests/QueryCondition/Different/Receiver/Different_Test_Receiver_exec.cpp
+++ b/CIAO/connectors/dds4ccm/tests/QueryCondition/Different/Receiver/Different_Test_Receiver_exec.cpp
@@ -237,7 +237,7 @@ namespace CIAO_Different_Test_Receiver_Impl
if (sample.iteration > ACE_OS::atoi (MAX_ITERATION))
{
ACE_ERROR ((LM_ERROR, "ERROR: GET ALL: "
- "Didn't expect samples with iteration &C"
+ "Didn't expect samples with iteration %C"
"> %C\n", sample.iteration,
MAX_ITERATION));
return false;
@@ -305,6 +305,7 @@ namespace CIAO_Different_Test_Receiver_Impl
ACE_ERROR ((LM_ERROR, "Receiver_exec_i::get_all - "
"ERROR: got unexpected "
"sample, bailing out\n"));
+ break;
}
}
}
diff --git a/CIAO/connectors/dds4ccm/tests/SLManyByMany/Sender/SL_ManyByMany_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/SLManyByMany/Sender/SL_ManyByMany_Sender_exec.h
index cf784f81176..51236d4e137 100644
--- a/CIAO/connectors/dds4ccm/tests/SLManyByMany/Sender/SL_ManyByMany_Sender_exec.h
+++ b/CIAO/connectors/dds4ccm/tests/SLManyByMany/Sender/SL_ManyByMany_Sender_exec.h
@@ -73,7 +73,7 @@ namespace CIAO_SL_ManyByMany_Sender_Impl
* ConnectorStatusListener_exec_i
*/
- class SENDER_EXEC_Export ConnectorStatusListener_exec_i
+ class ConnectorStatusListener_exec_i
: public virtual ::CCM_DDS::CCM_ConnectorStatusListener,
public virtual ::CORBA::LocalObject
{
diff --git a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl
index 7a0be74da94..05d63808e5a 100644
--- a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl
+++ b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender.idl
@@ -17,6 +17,7 @@ module SL_OneByOne
component Sender
{
port SL_OneByOneConnector::DDS_Update test_topic_update;
+ provides CCM_DDS::ConnectorStatusListener test_topic_connector_status;
};
};
diff --git a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp
index a0f8ca82d4d..28394253186 100644
--- a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp
+++ b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.cpp
@@ -49,6 +49,61 @@ namespace CIAO_SL_OneByOne_Sender_Impl
return 0;
}
+ /**
+ * ConnectorStatusListener_exec_i
+ */
+
+ ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (
+ Sender_exec_i &callback)
+ : callback_ (callback)
+ {
+ }
+
+ ConnectorStatusListener_exec_i::~ConnectorStatusListener_exec_i (void)
+ {
+ }
+
+ // Operations from ::CCM_DDS::ConnectorStatusListener
+ void ConnectorStatusListener_exec_i::on_inconsistent_topic (
+ ::DDS::Topic_ptr /*the_topic*/,
+ const DDS::InconsistentTopicStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_exec_i::on_requested_incompatible_qos (
+ ::DDS::DataReader_ptr /*the_reader*/,
+ const DDS::RequestedIncompatibleQosStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_exec_i::on_sample_rejected (
+ ::DDS::DataReader_ptr /*the_reader*/,
+ const DDS::SampleRejectedStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_exec_i::on_offered_deadline_missed(
+ ::DDS::DataWriter_ptr /*the_writer*/,
+ const DDS::OfferedDeadlineMissedStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_exec_i::on_offered_incompatible_qos(
+ ::DDS::DataWriter_ptr /*the_writer*/,
+ const DDS::OfferedIncompatibleQosStatus & /*status*/)
+ {
+ }
+
+ void ConnectorStatusListener_exec_i::on_unexpected_status(
+ ::DDS::Entity_ptr /*the_entity*/,
+ ::DDS::StatusKind status_kind)
+ {
+ if (status_kind == ::DDS::PUBLICATION_MATCHED_STATUS)
+ {
+ this->callback_.start ();
+ }
+ }
+
/**
* Component Executor Implementation Class: Sender_exec_i
*/
@@ -67,6 +122,12 @@ namespace CIAO_SL_OneByOne_Sender_Impl
delete this->ticker_;
}
+ ::CCM_DDS::CCM_ConnectorStatusListener_ptr
+ Sender_exec_i::get_test_topic_connector_status (void)
+ {
+ return new ConnectorStatusListener_exec_i (*this);
+ }
+
// Supported operations and attributes.
ACE_Reactor*
Sender_exec_i::reactor (void)
@@ -421,7 +482,6 @@ namespace CIAO_SL_OneByOne_Sender_Impl
Sender_exec_i::ccm_activate (void)
{
this->add_instances_of_topic ();
- this->start ();
}
void
diff --git a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h
index 34beffbdfa9..8098258b587 100644
--- a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h
+++ b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Sender/SL_OneByOne_Sender_exec.h
@@ -69,6 +69,40 @@ namespace CIAO_SL_OneByOne_Sender_Impl
Sender_exec_i &pulse_callback_;
};
+ /**
+ * ConnectorStatusListener_exec_i
+ */
+
+ class ConnectorStatusListener_exec_i
+ : public virtual ::CCM_DDS::CCM_ConnectorStatusListener,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ ConnectorStatusListener_exec_i (Sender_exec_i &callback);
+ virtual ~ConnectorStatusListener_exec_i (void);
+
+ virtual
+ void on_inconsistent_topic (::DDS::Topic_ptr the_topic,
+ const DDS::InconsistentTopicStatus & status);
+ virtual
+ void on_requested_incompatible_qos (::DDS::DataReader_ptr the_reader,
+ const DDS::RequestedIncompatibleQosStatus & status);
+ virtual
+ void on_sample_rejected (::DDS::DataReader_ptr the_reader,
+ const DDS::SampleRejectedStatus & status);
+ virtual
+ void on_offered_deadline_missed (::DDS::DataWriter_ptr the_writer,
+ const DDS::OfferedDeadlineMissedStatus & status);
+ virtual
+ void on_offered_incompatible_qos (::DDS::DataWriter_ptr the_writer,
+ const DDS::OfferedIncompatibleQosStatus & status);
+ virtual
+ void on_unexpected_status (::DDS::Entity_ptr the_entity,
+ ::DDS::StatusKind status_kind);
+ private:
+ Sender_exec_i &callback_;
+ };
+
/**
* Component Executor Implementation Class: Sender_exec_i
*/
@@ -88,6 +122,8 @@ namespace CIAO_SL_OneByOne_Sender_Impl
//@{
/** Component attributes and port operations. */
+ virtual ::CCM_DDS::CCM_ConnectorStatusListener_ptr
+ get_test_topic_connector_status (void);
//@}
//@{
@@ -102,7 +138,7 @@ namespace CIAO_SL_OneByOne_Sender_Impl
//@{
/** User defined public operations. */
void tick (void);
-
+ void start (void);
//@}
private:
@@ -125,7 +161,6 @@ namespace CIAO_SL_OneByOne_Sender_Impl
//@{
/** User defined private operations. */
- void start (void);
void stop (void);
void add_instances_of_topic (void);
CORBA::Boolean create_one (void);
diff --git a/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp b/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp
index 87e3b60455a..8d66f7dd2fc 100644
--- a/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp
+++ b/CIAO/connectors/dds4ccm/tests/SLOneByOne/descriptors/Plan.cdp
@@ -330,6 +330,25 @@
<instance xmi:idref="SL_OneByOne_ConnectorComponentInstance" />
</internalEndpoint>
</connection>
+ <connection>
+ <name>test_topic_connector_status_sender</name>
+ <deployRequirement>
+ <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name>
+ <resourceType>Local_Interface</resourceType>
+ </deployRequirement>
+ <internalEndpoint>
+ <portName>test_topic_connector_status</portName>
+ <provider>true</provider>
+ <kind>Facet</kind>
+ <instance xmi:idref="SenderComponentInstance" />
+ </internalEndpoint>
+ <internalEndpoint>
+ <portName>error_listener</portName>
+ <provider>false</provider>
+ <kind>SimplexReceptacle</kind>
+ <instance xmi:idref="SL_OneByOne_ConnectorComponentInstance" />
+ </internalEndpoint>
+ </connection>
<artifact xmi:id="Sender_ExecArtifact">
<name>Sender_exec</name>