summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp')
-rw-r--r--CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp573
1 files changed, 0 insertions, 573 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp
deleted file mode 100644
index 5d0e0ba817e..00000000000
--- a/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp
+++ /dev/null
@@ -1,573 +0,0 @@
-// -*- C++ -*-
-/**
- * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.3
- * TAO and the TAO IDL Compiler have been developed by:
- * Center for Distributed Object Computing
- * Washington University
- * St. Louis, MO
- * USA
- * http://www.cs.wustl.edu/~schmidt/doc-center.html
- * and
- * Distributed Object Computing Laboratory
- * University of California at Irvine
- * Irvine, CA
- * USA
- * and
- * Institute for Software Integrated Systems
- * Vanderbilt University
- * Nashville, TN
- * USA
- * http://www.isis.vanderbilt.edu/
- *
- * Information about TAO is available at:
- * http://www.dre.vanderbilt.edu/~schmidt/TAO.html
- **/
-
-#include "CSL_USTest_Receiver_exec.h"
-#include "tao/ORB_Core.h"
-#include "ace/Reactor.h"
-#include "dds4ccm/impl/Utils.h"
-
-#include "dds4ccm/impl/dds4ccm_conf.h"
-
-namespace CIAO_CSL_USTest_Receiver_Impl
-{
- /**
- * Pulser
- */
-
- Pulser::Pulser (Receiver_exec_i &callback)
- : callback_ (callback)
- {
- }
-
- int
- Pulser::handle_timeout (const ACE_Time_Value &, const void *)
- {
- // Notify the subscribers
- this->callback_.read_all ();
- return 0;
- }
-
- /**
- * Facet Executor Implementation Class: info_out_data_listener_exec_i
- */
-
- info_out_data_listener_exec_i::info_out_data_listener_exec_i (
- ::CSL_USTest::CCM_Receiver_Context_ptr ctx)
- : ciao_context_ (
- ::CSL_USTest::CCM_Receiver_Context::_duplicate (ctx))
- {
- }
-
- info_out_data_listener_exec_i::~info_out_data_listener_exec_i (void)
- {
- }
-
- // Operations from ::CSL_US_Connector::Listener
-
- void
- info_out_data_listener_exec_i::on_one_data (const ::TestTopic & /* datum */,
- const ::CCM_DDS::ReadInfo & /* info */)
- {
- }
-
- void
- info_out_data_listener_exec_i::on_many_data (const ::TestTopicSeq & /* data */,
- const ::CCM_DDS::ReadInfoSeq & /* infos */)
- {
- }
-
- /**
- * Facet Executor Implementation Class: info_out_status_exec_i
- */
-
- info_out_status_exec_i::info_out_status_exec_i (
- ::CSL_USTest::CCM_Receiver_Context_ptr ctx)
- : ciao_context_ (
- ::CSL_USTest::CCM_Receiver_Context::_duplicate (ctx))
- {
- }
-
- info_out_status_exec_i::~info_out_status_exec_i (void)
- {
- }
-
- // Operations from ::CCM_DDS::PortStatusListener
-
- void
- info_out_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */,
- const ::DDS::RequestedDeadlineMissedStatus & /* status */)
- {
- /* Your code here. */
- }
-
- void
- info_out_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */,
- const ::DDS::SampleLostStatus & /* status */)
- {
- /* Your code here. */
- }
-
- /**
- * Facet Executor Implementation Class: info_read_status_exec_i
- */
-
- info_read_status_exec_i::info_read_status_exec_i (
- ::CSL_USTest::CCM_Receiver_Context_ptr ctx)
- : ciao_context_ (
- ::CSL_USTest::CCM_Receiver_Context::_duplicate (ctx))
- {
- }
-
- info_read_status_exec_i::~info_read_status_exec_i (void)
- {
- }
-
- // Operations from ::CCM_DDS::PortStatusListener
-
- void
- info_read_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */,
- const ::DDS::RequestedDeadlineMissedStatus & /* status */)
- {
- /* Your code here. */
- }
-
- void
- info_read_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */,
- const ::DDS::SampleLostStatus & /* status */)
- {
- /* Your code here. */
- }
-
- /**
- * Facet Executor Implementation Class: info_out_connector_status_exec_i
- */
-
- info_out_connector_status_exec_i::info_out_connector_status_exec_i (
- ::CSL_USTest::CCM_Receiver_Context_ptr ctx,
- Atomic_Boolean &subscription_matched_received,
- Atomic_Boolean &liveliness_changed_received,
- ACE_Thread_ID &thread_id_subcription_matched,
- ACE_Thread_ID &thread_id_liveliness_changed)
- : ciao_context_ (
- ::CSL_USTest::CCM_Receiver_Context::_duplicate (ctx))
- , subscription_matched_received_ (subscription_matched_received)
- , liveliness_changed_received_ (liveliness_changed_received)
- , thread_id_subcription_matched_ (thread_id_subcription_matched)
- , thread_id_liveliness_changed_ (thread_id_liveliness_changed)
- {
- }
-
- info_out_connector_status_exec_i::~info_out_connector_status_exec_i (void)
- {
- }
-
- // Operations from ::CCM_DDS::ConnectorStatusListener
-
- void
- info_out_connector_status_exec_i::on_inconsistent_topic (::DDS::Topic_ptr /* the_topic */,
- const ::DDS::InconsistentTopicStatus & /* status */)
- {
- /* Your code here. */
- }
-
- void
- info_out_connector_status_exec_i::on_requested_incompatible_qos (::DDS::DataReader_ptr /* the_reader */,
- const ::DDS::RequestedIncompatibleQosStatus & /* status */)
- {
- /* Your code here. */
- }
-
- void
- info_out_connector_status_exec_i::on_sample_rejected (::DDS::DataReader_ptr /* the_reader */,
- const ::DDS::SampleRejectedStatus & /* status */)
- {
- /* Your code here. */
- }
-
- void
- info_out_connector_status_exec_i::on_offered_deadline_missed (::DDS::DataWriter_ptr /* the_writer */,
- const ::DDS::OfferedDeadlineMissedStatus & /* status */)
- {
- /* Your code here. */
- }
-
- void
- info_out_connector_status_exec_i::on_offered_incompatible_qos (::DDS::DataWriter_ptr /* the_writer */,
- const ::DDS::OfferedIncompatibleQosStatus & /* status */)
- {
- /* Your code here. */
- }
-
- void
- info_out_connector_status_exec_i::on_unexpected_status (::DDS::Entity_ptr the_entity,
- ::DDS::StatusKind status_kind)
- {
- ACE_DEBUG ((LM_DEBUG, "RECEIVER\tConnectorStatusListener_exec_i::on_unexpected_status: "
- "received <%C>\n",
- CIAO::DDS4CCM::translate_statuskind (status_kind)));
- ACE_Thread_ID t_id;
-
- if (! ::CORBA::is_nil (the_entity) && status_kind == DDS::SUBSCRIPTION_MATCHED_STATUS)
- {
- this->subscription_matched_received_ = true;
- this->thread_id_subcription_matched_ = t_id;
- }
- else if (! ::CORBA::is_nil(the_entity) && status_kind == DDS::LIVELINESS_CHANGED_STATUS)
- {
- this->liveliness_changed_received_ = true;
- this->thread_id_liveliness_changed_ = t_id;
- }
- }
-
- /**
- * Component Executor Implementation Class: Receiver_exec_i
- */
-
- Receiver_exec_i::Receiver_exec_i (void)
- : subscription_matched_received_ (false)
- , liveliness_changed_received_ (false)
- , thread_id_listener_subscription_matched_ (0, 0)
- , thread_id_listener_liveliness_changed_ (0, 0)
- , received_(0)
- {
- ACE_NEW_THROW_EX (this->pulser_,
- Pulser (*this),
- ::CORBA::NO_MEMORY ());
- }
-
- Receiver_exec_i::~Receiver_exec_i (void)
- {
- delete this->pulser_;
- }
-
- // Supported operations and attributes.
- ACE_Reactor*
- Receiver_exec_i::reactor (void)
- {
- ACE_Reactor* reactor = 0;
- ::CORBA::Object_var ccm_object =
- this->ciao_context_->get_CCM_object();
- if (! ::CORBA::is_nil (ccm_object.in ()))
- {
- ::CORBA::ORB_var orb = ccm_object->_get_orb ();
- if (! ::CORBA::is_nil (orb.in ()))
- {
- reactor = orb->orb_core ()->reactor ();
- }
- }
- if (reactor == 0)
- {
- throw ::CORBA::INTERNAL ();
- }
- return reactor;
- }
-
- void
- Receiver_exec_i::read_all ()
- {
- ::CSL_US_Connector::Reader_var reader =
- this->ciao_context_->get_connection_info_read_data ();
-
- try
- {
- TestTopicSeq readertest_info_seq;
- ::CCM_DDS::ReadInfoSeq readinfo_seq;
- if (this->received_ < 30)
- {
- reader->read_all (readertest_info_seq, readinfo_seq);
- ACE_DEBUG ((LM_DEBUG, "Read %u samples\n",
- readinfo_seq.length ()));
- this->received_ += readinfo_seq.length ();
- }
- else
- {
- this->reactor ()->cancel_timer (this->pulser_);
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender_exec_i::read_all :Stop reading.\n")));
- }
- }
- catch (const CCM_DDS::NonExistent& ex)
- {
- for (CORBA::ULong i = 0; i < ex.indexes.length (); ++i)
- {
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("READ ALL: ")
- ACE_TEXT ("caught expected exception: index <%u>\n"),
- ex.indexes[i]));
- }
- }
- catch (const CCM_DDS::InternalError& ex)
- {
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: READ ALL: ")
- ACE_TEXT ("caught InternalError exception: retval <%u>\n"),
- ex.error_code));
- }
- catch (const ::CORBA::Exception& ex)
- {
- ex._tao_print_exception ("ERROR: READ ALL: ");
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("ERROR: Receiver_exec_i::read_all : Exception caught\n")));
- }
- }
- // Component attributes and port operations.
-
- ::CSL_US_Connector::CCM_Listener_ptr
- Receiver_exec_i::get_info_out_data_listener (void)
- {
- if ( ::CORBA::is_nil (this->ciao_info_out_data_listener_.in ()))
- {
- info_out_data_listener_exec_i *tmp = 0;
- ACE_NEW_RETURN (
- tmp,
- info_out_data_listener_exec_i (
- this->ciao_context_.in ()),
- ::CSL_US_Connector::CCM_Listener::_nil ());
-
- this->ciao_info_out_data_listener_ = tmp;
- }
-
- return
- ::CSL_US_Connector::CCM_Listener::_duplicate (
- this->ciao_info_out_data_listener_.in ());
- }
-
- ::CCM_DDS::CCM_PortStatusListener_ptr
- Receiver_exec_i::get_info_out_status (void)
- {
- if ( ::CORBA::is_nil (this->ciao_info_out_status_.in ()))
- {
- info_out_status_exec_i *tmp = 0;
- ACE_NEW_RETURN (
- tmp,
- info_out_status_exec_i (
- this->ciao_context_.in ()),
- ::CCM_DDS::CCM_PortStatusListener::_nil ());
-
- this->ciao_info_out_status_ = tmp;
- }
-
- return
- ::CCM_DDS::CCM_PortStatusListener::_duplicate (
- this->ciao_info_out_status_.in ());
- }
-
- ::CCM_DDS::CCM_PortStatusListener_ptr
- Receiver_exec_i::get_info_read_status (void)
- {
- if ( ::CORBA::is_nil (this->ciao_info_read_status_.in ()))
- {
- info_read_status_exec_i *tmp = 0;
- ACE_NEW_RETURN (
- tmp,
- info_read_status_exec_i (
- this->ciao_context_.in ()),
- ::CCM_DDS::CCM_PortStatusListener::_nil ());
-
- this->ciao_info_read_status_ = tmp;
- }
-
- return
- ::CCM_DDS::CCM_PortStatusListener::_duplicate (
- this->ciao_info_read_status_.in ());
- }
-
- ::CCM_DDS::CCM_ConnectorStatusListener_ptr
- Receiver_exec_i::get_info_out_connector_status (void)
- {
- if ( ::CORBA::is_nil (this->ciao_info_out_connector_status_.in ()))
- {
- info_out_connector_status_exec_i *tmp = 0;
- ACE_NEW_RETURN (
- tmp,
- info_out_connector_status_exec_i (
- this->ciao_context_.in (),
- this->subscription_matched_received_,
- this->liveliness_changed_received_,
- this->thread_id_listener_subscription_matched_,
- this->thread_id_listener_liveliness_changed_),
- ::CCM_DDS::CCM_ConnectorStatusListener::_nil ());
-
- this->ciao_info_out_connector_status_ = tmp;
- }
-
- return
- ::CCM_DDS::CCM_ConnectorStatusListener::_duplicate (
- this->ciao_info_out_connector_status_.in ());
- }
-
- // Operations from Components::SessionComponent.
-
- void
- Receiver_exec_i::set_session_context (
- ::Components::SessionContext_ptr ctx)
- {
- this->ciao_context_ =
- ::CSL_USTest::CCM_Receiver_Context::_narrow (ctx);
-
- if ( ::CORBA::is_nil (this->ciao_context_.in ()))
- {
- throw ::CORBA::INTERNAL ();
- }
- }
-
- void
- Receiver_exec_i::configuration_complete (void)
- {
- /* Your code here. */
- }
-
- void
- Receiver_exec_i::ccm_activate (void)
- {
- if (this->reactor ()->schedule_timer (
- this->pulser_,
- 0,
- ACE_Time_Value (6, 0),
- ACE_Time_Value (3, 0)) == -1)
- {
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("Sender_exec_i::start : ")
- ACE_TEXT ("Error scheduling timer\n")));
- }
- }
-
- void
- Receiver_exec_i::ccm_passivate (void)
- {
- /* Your code here. */
- }
-
- void
- Receiver_exec_i::ccm_remove (void)
- {
- if (!this->subscription_matched_received_.value ())
- {
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("RECEIVER ERROR: Didn't receive the expected ")
- ACE_TEXT ("'SUBSCRIPTION_MATCHED_STATUS'\n")));
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RECEIVER OK: Received the expected ")
- ACE_TEXT ("'SUBSCRIPTION_MATCHED_STATUS'\n")));
- }
- if (!this->liveliness_changed_received_.value ())
- {
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("RECEIVER ERROR: Didn't receive the expected ")
- ACE_TEXT ("'LIVELINESS_CHANGED_STATUS'\n")));
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RECEIVER OK: Received the expected ")
- ACE_TEXT ("'LIVELINESS_CHANGED_STATUS' \n")));
- }
- char ccm_buf [65];
- ACE_Thread_ID ccm_thread_id;
- ccm_thread_id.to_string (ccm_buf);
-
- char list_buf [65];
- this->thread_id_listener_subscription_matched_.to_string(list_buf);
-
- //test thread switch for SUBSCRIPTION_MATCHED_STATUS
- if (this->thread_id_listener_subscription_matched_.id () == 0)
- {
- ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: "
- "Thread ID for 'SUBSCRIPTION_MATCHED_STATUS' not set!\n"));
- }
- #if (CIAO_DDS4CCM_CONTEXT_SWITCH == 1)
- else if (this->thread_id_listener_subscription_matched_ == ccm_thread_id)
- {
- ACE_DEBUG ((LM_DEBUG, "RECEIVER OK: "
- "Thread switch for 'SUBSCRIPTION_MATCHED_STATUS' seems OK. "
- "(DDS uses the CCM thread for its callback) "
- "listener <%C> - component <%C>\n",
- list_buf,
- ccm_buf));
- }
- else
- {
- ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: "
- "Thread switch for 'SUBSCRIPTION_MATCHED_STATUS' "
- "doesn't seem to work! "
- "listener <%C> - component <%C>\n",
- list_buf,
- ccm_buf));
- }
- #else
- else if (this->thread_id_listener_subscription_matched_ == ccm_thread_id)
- {
- ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: 'SUBSCRIPTION_MATCHED_STATUS': "
- "DDS seems to use a CCM thread for its callback: "
- "listener <%C> - component <%C>\n",
- list_buf,
- ccm_buf));
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG, "RECEIVER OK: 'SUBSCRIPTION_MATCHED_STATUS': "
- "DDS seems to use its own thread for its callback: "
- "listener <%C> - component <%C>\n",
- list_buf,
- ccm_buf));
- }
- #endif
-
- //test thread switch for LIVELINESS_CHANGED_STATUS
- char list_buf_lc [65];
- this->thread_id_listener_liveliness_changed_.to_string(list_buf_lc);
-
- if (this->thread_id_listener_liveliness_changed_.id () == 0)
- {
- ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: "
- "Thread ID for 'LIVELINESS_CHANGED_STATUS' not set!\n"));
- }
- #if (CIAO_DDS4CCM_CONTEXT_SWITCH == 1)
- else if (this->thread_id_listener_liveliness_changed_ == ccm_thread_id)
- {
- ACE_DEBUG ((LM_DEBUG, "RECEIVER OK: "
- "Thread switch for 'LIVELINESS_CHANGED_STATUS' seems OK. "
- "(DDS uses the CCM thread for its callback) "
- "listener <%C> - component <%C>\n",
- list_buf_lc,
- ccm_buf));
- }
- else
- {
- ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: "
- "Thread switch for 'LIVELINESS_CHANGED_STATUS' "
- "doesn't seem to work! "
- "listener <%C> - component <%C>\n",
- list_buf_lc,
- ccm_buf));
- }
- #else
- else if (this->thread_id_listener_liveliness_changed_ == ccm_thread_id)
- {
- ACE_ERROR ((LM_ERROR, "RECEIVER ERROR: 'LIVELINESS_CHANGED_STATUS': "
- "DDS seems to use a CCM thread for its callback: "
- "listener <%C> - component <%C>\n",
- list_buf_lc,
- ccm_buf));
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG, "RECEIVER OK: 'LIVELINESS_CHANGED_STATUS': "
- "DDS seems to use its own thread for its callback: "
- "listener <%C> - component <%C>\n",
- list_buf_lc,
- ccm_buf));
- }
- #endif
- }
-
- extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr
- create_CSL_USTest_Receiver_Impl (void)
- {
- ::Components::EnterpriseComponent_ptr retval =
- ::Components::EnterpriseComponent::_nil ();
-
- ACE_NEW_NORETURN (
- retval,
- Receiver_exec_i);
-
- return retval;
- }
-}