diff options
Diffstat (limited to 'modules/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp')
-rw-r--r-- | modules/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/modules/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp b/modules/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp new file mode 100644 index 00000000000..252a809898c --- /dev/null +++ b/modules/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp @@ -0,0 +1,220 @@ +// -*- C++ -*- +// $Id$ + +#include "CSL_DeadlineTest_Receiver_exec.h" +#include "ciao/Logger/Log_Macros.h" +#include "tao/ORB_Core.h" + +namespace CIAO_CSL_DeadlineTest_Receiver_Impl +{ + +//============================================================ + // Facet Executor Implementation Class: ConnectorStatusListener_exec_i + //============================================================ + + ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (Atomic_Boolean &incompatible) + : incompatible_ (incompatible) + { + } + + 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*/) { + this->incompatible_ = true; + } + + 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*/) { + } + + //============================================================ + // Facet Executor Implementation Class: TestTopic_RawListener_exec_i + //============================================================ + + TestTopic_RawListener_exec_i::TestTopic_RawListener_exec_i (Atomic_ULong &received) + : received_ (received) + { + } + + TestTopic_RawListener_exec_i::~TestTopic_RawListener_exec_i (void) + { + } + + // Operations from ::CCM_DDS::TestTopic_RawListener + + void + TestTopic_RawListener_exec_i::on_one_data ( + const TestTopic & an_instance , + const ::CCM_DDS::ReadInfo & /* info */) + { + ++this->received_; + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TestTopic_RawListener: ") + ACE_TEXT ("received test_topic_info for <%C> at %u\n"), + an_instance.key.in (), + an_instance.x)); + } + + void + TestTopic_RawListener_exec_i::on_many_data ( + const TestTopic_Seq & /*an_instance */, + const ::CCM_DDS::ReadInfoSeq & /* info */) + { + } + //============================================================ + // Facet Executor Implementation Class: PortStatusListener_exec_i + //============================================================ + + PortStatusListener_exec_i::PortStatusListener_exec_i (void) + { + } + + PortStatusListener_exec_i::~PortStatusListener_exec_i (void) + { + } + + // Operations from ::CCM_DDS::PortStatusListener + + void + PortStatusListener_exec_i::on_requested_deadline_missed ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::RequestedDeadlineMissedStatus & /* status */) + { + } + + void + PortStatusListener_exec_i::on_sample_lost ( + ::DDS::DataReader_ptr /* the_reader */, + const ::DDS::SampleLostStatus & /* status */) + { + } + + //============================================================ + // Component Executor Implementation Class: Receiver_exec_iTestTopic_RawListener_exec_i (); + //============================================================ + Receiver_exec_i::Receiver_exec_i (void) + : incompatible_ (false) + { + } + + Receiver_exec_i::~Receiver_exec_i (void) + { + } + + // Supported operations and attributes. + // Component attributes. + // Port operations. + ::CCM_DDS::TestTopic::CCM_Listener_ptr + Receiver_exec_i::get_info_out_data_listener (void) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("new TestTopic RAW listener\n"))); + return new TestTopic_RawListener_exec_i (this->received_); + } + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_out_status (void) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("new PortStatuslistener\n"))); + return new PortStatusListener_exec_i (); + } + + ::CCM_DDS::CCM_ConnectorStatusListener_ptr + Receiver_exec_i::get_info_out_connector_status (void) + { + return new ConnectorStatusListener_exec_i (this->incompatible_); + } + + // Operations from Components::SessionComponent. + void + Receiver_exec_i::set_session_context ( + ::Components::SessionContext_ptr ctx) + { + this->context_ = + ::CSL_DeadlineTest::CCM_Receiver_Context::_narrow (ctx); + if ( ::CORBA::is_nil (this->context_.in ())) + { + throw ::CORBA::INTERNAL (); + } + } + + void + Receiver_exec_i::configuration_complete (void) + { + + } + + void + Receiver_exec_i::ccm_activate (void) + { + ::CCM_DDS::DataListenerControl_var lc = + this->context_->get_connection_info_out_data_control (); + + if (CORBA::is_nil (lc.in ())) + { + ACE_ERROR ((LM_INFO, ACE_TEXT ("Error: Listener control receptacle is null!\n"))); + throw CORBA::INTERNAL (); + } + lc->mode (::CCM_DDS::ONE_BY_ONE); + } + + void + Receiver_exec_i::ccm_passivate (void) + { + } + + void + Receiver_exec_i::ccm_remove (void) + { + if(this->incompatible_.value ()) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: did receive the unexpected ") + ACE_TEXT (" error 'on_offered_deadline_missed' in Receiver") + )); + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("OK : Haven't received the un-expected ") + ACE_TEXT ("'on_offered_deadline_missed' in Receiver\n") + )); + } + } + + extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_CSL_DeadlineTest_Receiver_Impl (void) + { + ::Components::EnterpriseComponent_ptr retval = + ::Components::EnterpriseComponent::_nil (); + + ACE_NEW_NORETURN ( + retval, + Receiver_exec_i); + + return retval; + } +} |