summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/impl/ndds/DDS_State_Connector_T.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/connectors/dds4ccm/impl/ndds/DDS_State_Connector_T.cpp')
-rw-r--r--CIAO/connectors/dds4ccm/impl/ndds/DDS_State_Connector_T.cpp183
1 files changed, 175 insertions, 8 deletions
diff --git a/CIAO/connectors/dds4ccm/impl/ndds/DDS_State_Connector_T.cpp b/CIAO/connectors/dds4ccm/impl/ndds/DDS_State_Connector_T.cpp
index b833c64b4d4..86cfaca2845 100644
--- a/CIAO/connectors/dds4ccm/impl/ndds/DDS_State_Connector_T.cpp
+++ b/CIAO/connectors/dds4ccm/impl/ndds/DDS_State_Connector_T.cpp
@@ -3,9 +3,7 @@
#include "dds4ccm/impl/ndds/DataReaderListener_T.h"
#include "dds4ccm/impl/ndds/DataWriterListener_T.h"
-#include "dds4ccm/impl/ndds/Writer_T.h"
#include "dds4ccm/impl/ndds/Updater_T.h"
-#include "dds4ccm/impl/ndds/Getter_T.h"
#include "dds4ccm/impl/ndds/Reader_T.h"
#include "dds4ccm/impl/ndds/DataListenerControl.h"
@@ -13,7 +11,9 @@
template <typename DDS_TYPE, typename CCM_TYPE>
DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::DDS_State_Connector_T (void) :
- DDS_TopicBase_Connector_T<DDS_TYPE, CCM_TYPE>()
+ DDS_TopicBase_Connector_T<DDS_TYPE, CCM_TYPE>(),
+ listen_datalistener_mode_ ( ::CCM_DDS::NOT_ENABLED),
+ listen_datalistener_max_delivered_data_ (0)
{
}
@@ -26,14 +26,15 @@ template <typename DDS_TYPE, typename CCM_TYPE>
typename CCM_TYPE::updater_type::_ptr_type
DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::get_observable_data (void)
{
- return 0;
+ return new CIAO::DDS4CCM::RTI::Updater_T<DDS_TYPE, CCM_TYPE>
+ (this->observable_data_.in ());
}
template <typename DDS_TYPE, typename CCM_TYPE>
::DDS::CCM_DataWriter_ptr
DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::get_observable_dds_entity (void)
{
- return 0;
+ return this->observable_data_.in ();
}
template <typename DDS_TYPE, typename CCM_TYPE>
@@ -75,21 +76,24 @@ template <typename DDS_TYPE, typename CCM_TYPE>
typename CCM_TYPE::reader_type::_ptr_type
DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::get_push_observer_data (void)
{
- return 0;
+ return new CIAO::DDS4CCM::RTI::Reader_T<DDS_TYPE, CCM_TYPE> (
+ this->push_consumer_data_.in ());
}
template <typename DDS_TYPE, typename CCM_TYPE>
::CCM_DDS::CCM_DataListenerControl_ptr
DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::get_push_observer_data_control (void)
{
- return 0;
+ return new CCM_DDS_DataListenerControl_i (
+ this->listen_datalistener_mode_,
+ this->listen_datalistener_max_delivered_data_);
}
template <typename DDS_TYPE, typename CCM_TYPE>
::DDS::CCM_DataReader_ptr
DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::get_push_observer_dds_entity (void)
{
- return 0;
+ return ::DDS::CCM_DataReader::_nil ();
}
template <typename DDS_TYPE, typename CCM_TYPE>
@@ -140,3 +144,166 @@ DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::ccm_remove (void)
{
DDS_Base_Connector_T<DDS_TYPE, CCM_TYPE>::ccm_remove ();
}
+
+template <typename DDS_TYPE, typename CCM_TYPE>
+void
+DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::configure_port_dds_update (void)
+{
+ this->configure_default_topic ();
+
+ try
+ {
+ if (CORBA::is_nil (this->supplier_publisher_.in ()))
+ {
+ if (this->library_name_ && this->profile_name_)
+ {
+ this->supplier_publisher_ = this->domain_participant_->
+ create_publisher_with_profile (
+ this->library_name_,
+ this->profile_name_,
+ 0,
+ 0);
+ }
+ else
+ {
+ ::DDS::PublisherQos pqos;
+ this->supplier_publisher_ = this->domain_participant_->create_publisher (pqos,
+ 0,
+ 0);
+ }
+ }
+
+ if (CORBA::is_nil (this->observable_data_.in ()))
+ {
+ this->supplier_listener_ = new ::CIAO::DDS4CCM::DataWriterListener_T
+ <DDS_TYPE, CCM_TYPE> (
+ this->context_,
+ this->listen_datalistener_mode_,
+ this->listen_datalistener_max_delivered_data_);
+
+ if (this->library_name_ && this->profile_name_)
+ {
+ ::DDS::DataWriter_var dwv_tmp = this->supplier_publisher_->
+ create_datawriter_with_profile (
+ this->topic_.in (),
+ this->library_name_,
+ this->profile_name_,
+ this->supplier_listener_.in (),
+ DDS_OFFERED_DEADLINE_MISSED_STATUS | DDS_OFFERED_INCOMPATIBLE_QOS_STATUS | DDS_LIVELINESS_LOST_STATUS | DDS_PUBLICATION_MATCHED_STATUS);
+ this->observable_data_ = ::DDS::CCM_DataWriter::_narrow (dwv_tmp);
+ }
+ else
+ {
+ ::DDS::DataWriterQos dwqos;
+ ::DDS::DataWriter_var dwv_tmp = this->supplier_publisher_->
+ create_datawriter (
+ this->topic_.in (),
+ dwqos,
+ this->supplier_listener_.in (),
+ DDS_OFFERED_DEADLINE_MISSED_STATUS | DDS_OFFERED_INCOMPATIBLE_QOS_STATUS | DDS_LIVELINESS_LOST_STATUS | DDS_PUBLICATION_MATCHED_STATUS);
+ this->observable_data_ = ::DDS::CCM_DataWriter::_narrow (dwv_tmp);
+ }
+ }
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_ERROR, "Caught unknown C++ exception while configuring port info_in_\n"));
+ throw CORBA::INTERNAL ();
+ }
+}
+
+template <typename DDS_TYPE, typename CCM_TYPE>
+void
+DDS_State_Connector_T<DDS_TYPE, CCM_TYPE>::configure_port_dds_listen (void)
+{
+ this->configure_default_topic ();
+
+ try
+ {
+ if (CORBA::is_nil (this->listen_subscriber_.in ()))
+ {
+ if (this->library_name_ && this->profile_name_)
+ {
+ this->listen_subscriber_ = this->domain_participant_->
+ create_subscriber_with_profile (
+ this->library_name_,
+ this->profile_name_,
+ 0,
+ 0);
+ }
+ else
+ {
+ ::DDS::SubscriberQos sqos;
+ this->listen_subscriber_ = this->domain_participant_->
+ create_subscriber (sqos,
+ 0,
+ 0);
+ }
+ }
+
+ if (CORBA::is_nil (this->__listen_datareaderlistener.in ()))
+ {
+ this->__listen_datareaderlistener = new ::CIAO::DDS4CCM::RTI::DataReaderListener_T
+ <DDS_TYPE, CCM_TYPE> (
+ this->context_,
+ this->context_->get_connection_push_observer_data_listener (),
+ this->context_->get_connection_pull_observer_status (),
+ this->listen_datalistener_mode_,
+ this->listen_datalistener_max_delivered_data_);
+ }
+
+ if (CORBA::is_nil (this->push_consumer_data_.in ()))
+ {
+ if (this->library_name_ && this->profile_name_)
+ {
+ this->push_consumer_data_ =
+ this->listen_subscriber_->create_datareader_with_profile (
+ this->topic_.in (),
+ this->library_name_,
+ this->profile_name_,
+ this->__listen_datareaderlistener.in (),
+ DDS_DATA_AVAILABLE_STATUS | DDS_REQUESTED_DEADLINE_MISSED_STATUS | DDS_SAMPLE_LOST_STATUS | DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS);
+ }
+ else
+ {
+ ::DDS::DataReaderQos drqos;
+ this->push_consumer_data_ =
+ this->listen_subscriber_->create_datareader (
+ this->topic_.in (),
+ drqos,
+ this->__listen_datareaderlistener.in (),
+ DDS_DATA_AVAILABLE_STATUS | DDS_REQUESTED_DEADLINE_MISSED_STATUS | DDS_SAMPLE_LOST_STATUS | DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS);
+ }
+ }
+
+ if (CORBA::is_nil (this->pull_consumer_fresh_data_.in ()))
+ {
+ if (this->profile_name_ && this->library_name_)
+ {
+ this->pull_consumer_fresh_data_ =
+ this->listen_subscriber_->create_datareader_with_profile (
+ this->topic_.in (),
+ this->library_name_,
+ this->profile_name_,
+ this->__listen_datareaderlistener.in (),
+ DDS_DATA_AVAILABLE_STATUS | DDS_REQUESTED_DEADLINE_MISSED_STATUS | DDS_SAMPLE_LOST_STATUS | DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS);
+ }
+ else
+ {
+ ::DDS::DataReaderQos drqos;
+ this->pull_consumer_fresh_data_ =
+ this->listen_subscriber_->create_datareader (
+ this->topic_.in (),
+ drqos,
+ this->__listen_datareaderlistener.in (),
+ DDS_DATA_AVAILABLE_STATUS | DDS_REQUESTED_DEADLINE_MISSED_STATUS | DDS_SAMPLE_LOST_STATUS | DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS);
+ }
+
+ }
+ }
+ catch (...)
+ {
+ CIAO_ERROR ((LM_EMERGENCY, "Caught unknown c++ exception while creating subscriber entities\n"));
+ throw CORBA::INTERNAL ();
+ }
+}