diff options
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver')
6 files changed, 0 insertions, 1120 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl deleted file mode 100644 index 4322dffca5d..00000000000 --- a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.idl +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @file - * @author Marcel Smit (msmit@remedy.nl) - */ - -#ifndef RECEIVER_IDL -#define RECEIVER_IDL - -#include "Connector/RG_ResetTopic_Connector.idl" -#include "Base/Reader_Starter.idl" - -module RG_ResetTopic -{ - component Receiver - { - port RG_ResetTopicSampleConnector::DDS_Get info_get; - port RG_ResetTopicSampleConnector::DDS_Read info_read; - - provides ReaderStarter start_reading; - }; -}; - -#endif diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc deleted file mode 100644 index 2d24cf4f6a5..00000000000 --- a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver.mpc +++ /dev/null @@ -1,155 +0,0 @@ -project (RG_ResetTopicReceiver_idl_gen) : componentidldefaults, dds4ccm { - custom_only = 1 - after += RG_ResetTopicConnector_idl_gen - idlflags += -Wb,stub_export_macro=RECEIVER_STUB_Export \ - -Wb,stub_export_include=Receiver_stub_export.h \ - -Wb,skel_export_macro=RECEIVER_SVNT_Export \ - -Wb,skel_export_include=Receiver_svnt_export.h \ - -Wb,svnt_export_macro=RECEIVER_SVNT_Export \ - -Wb,svnt_export_include=Receiver_svnt_export.h \ - -Wb,exec_export_macro=RECEIVER_EXEC_Export \ - -Wb,exec_export_include=Receiver_exec_export.h \ - -I.. - IDL_Files { - RG_ResetTopic_Receiver.idl - } -} - -project (RG_ResetTopicReceiver_lem_gen) : ciaoidldefaults, dds4ccm { - after += RG_ResetTopicReceiver_idl_gen - custom_only = 1 - idlflags += -Wb,stub_export_macro=RECEIVER_LEM_STUB_Export \ - -Wb,stub_export_include=Receiver_lem_stub_export.h \ - -SS -Gxhst -I.. - - IDL_Files { - RG_ResetTopic_ReceiverE.idl - } -} - -project (RG_ResetTopicReceiver_lem_stub) : ccm_svnt, dds4ccm_base { - after += RG_ResetTopicReceiver_lem_gen RG_ResetTopicReceiver_stub RG_ResetTopicConnector_stub \ - RG_ResetTopicBase_stub reader_starter_rt_stub - libs += Receiver_stub RG_ResetTopicConnector_stub RG_ResetTopicBase_stub \ - reader_starter_rt_stub - libpaths += ../lib - libout = ../lib - includes += .. - sharedname = Receiver_lem_stub - dynamicflags += RECEIVER_LEM_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - RG_ResetTopic_ReceiverEC.cpp - } - - Header_Files { - RG_ResetTopic_ReceiverEC.h - Receiver_lem_stub_export.h - } - - Inline_Files { - RG_ResetTopic_ReceiverEC.inl - } -} - -project (RG_ResetTopicReceiver_stub) : ccm_stub, dds4ccm_base { - after += RG_ResetTopicReceiver_idl_gen RG_ResetTopicConnector_stub \ - RG_ResetTopicBase_stub RG_ResetTopicConnector_lem_gen \ - reader_starter_rt_stub reader_starter_rt_lem_stub - libs += RG_ResetTopicConnector_stub RG_ResetTopicBase_stub \ - reader_starter_rt_stub - libpaths += ../lib - libout = ../lib - includes += .. - sharedname = Receiver_stub - dynamicflags += RECEIVER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - RG_ResetTopic_ReceiverC.cpp - } - - Header_Files { - RG_ResetTopic_ReceiverC.h - Receiver_stub_export.h - } - - Inline_Files { - RG_ResetTopic_ReceiverC.inl - } -} - -project (RG_ResetTopicReceiver_exec) : ciao_executor, dds4ccm_lem_stub { - after += RG_ResetTopicReceiver_lem_stub RG_ResetTopicReceiver_stub \ - RG_ResetTopicBase_stub RG_ResetTopicConnector_stub \ - RG_ResetTopicConnector_lem_stub \ - reader_starter_rt_lem_stub reader_starter_rt_stub - sharedname = Receiver_exec - libs += Receiver_stub Receiver_lem_stub RG_ResetTopicBase_stub \ - RG_ResetTopicConnector_stub RG_ResetTopicConnector_lem_stub \ - reader_starter_rt_lem_stub reader_starter_rt_stub - libpaths += ../lib - libout = ../lib - includes += .. - dynamicflags += RECEIVER_EXEC_BUILD_DLL - - IDL_Files { - } - - Source_Files { - RG_ResetTopic_Receiver_exec.cpp - RG_ResetTopic_Receiver_impl.cpp - } - - Header_Files { - RG_ResetTopic_Receiver_exec.h - RG_ResetTopic_Receiver_impl.h - Receiver_exec_export.h - } - - Inline_Files { - } -} - - -project (RG_ResetTopicReceiver_svnt) : ciao_servant, dds4ccm_lem_stub, dds4ccm_skel { - after += RG_ResetTopicReceiver_lem_stub RG_ResetTopicBase_stub \ - RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ - RG_ResetTopicReceiver_exec RG_ResetTopicConnector_lem_stub \ - reader_starter_rt_stub \ - reader_starter_rt_svnt reader_starter_rt_lem_stub - sharedname = Receiver_svnt - libs += Receiver_stub Receiver_lem_stub RG_ResetTopicBase_stub \ - RG_ResetTopicConnector_stub RG_ResetTopicConnector_svnt \ - Receiver_exec RG_ResetTopicConnector_lem_stub \ - reader_starter_rt_stub reader_starter_rt_svnt \ - reader_starter_rt_lem_stub - libpaths += ../lib - libout = ../lib - includes += .. - dynamicflags += RECEIVER_SVNT_BUILD_DLL - - IDL_Files { - } - - Source_Files { - RG_ResetTopic_ReceiverS.cpp - RG_ResetTopic_Receiver_svnt.cpp - } - - Header_Files { - RG_ResetTopic_ReceiverS.h - RG_ResetTopic_Receiver_svnt.h - Receiver_svnt_export.h - } - - Inline_Files { - } -} - - diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp deleted file mode 100644 index 885a5ef4cb0..00000000000 --- a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.cpp +++ /dev/null @@ -1,281 +0,0 @@ -// -*- C++ -*- -#include "RG_ResetTopic_Receiver_exec.h" -#include "RG_ResetTopic_Receiver_impl.h" - -namespace CIAO_RG_ResetTopic_Receiver_Impl -{ - - /** - * Facet Executor Implementation Class: info_get_status_exec_i - */ - - info_get_status_exec_i::info_get_status_exec_i ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx) - : ciao_context_ ( - ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) - { - } - - info_get_status_exec_i::~info_get_status_exec_i (void) - { - } - - // Operations from ::CCM_DDS::PortStatusListener - - void - info_get_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */, - const ::DDS::RequestedDeadlineMissedStatus & /* status */) - { - /* Your code here. */ - } - - void - info_get_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 ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx) - : ciao_context_ ( - ::RG_ResetTopic::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: start_reading_exec_i - */ - - start_reading_exec_i::start_reading_exec_i ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, - Receiver_exec_i &callback) - : ciao_context_ ( - ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) - , callback_ (callback) - { - } - - start_reading_exec_i::~start_reading_exec_i (void) - { - } - - // Operations from ::ReaderStarter - - void - start_reading_exec_i::start_read (const char * topic_name) - { - this->callback_.start_read (topic_name); - } - - void - start_reading_exec_i::set_reader_properties (::CORBA::UShort nr_keys, - ::CORBA::UShort nr_iterations) - { - this->callback_.keys (nr_keys); - this->callback_.iterations (nr_iterations); - } - - /** - * Component Executor Implementation Class: Receiver_exec_i - */ - - Receiver_exec_i::Receiver_exec_i (void) - : iterations_ (10) - , keys_ (5) - , impl_(0) - { - } - - Receiver_exec_i::~Receiver_exec_i (void) - { - delete this->impl_; - } - - // Supported operations and attributes. - ::CORBA::UShort - Receiver_exec_i::iterations (void) - { - return this->iterations_; - } - - void - Receiver_exec_i::iterations ( - const ::CORBA::UShort iterations) - { - this->iterations_ = iterations; - if (this->impl_) - { - this->impl_->iterations (iterations); - } - } - - ::CORBA::UShort - Receiver_exec_i::keys (void) - { - return this->keys_; - } - - void - Receiver_exec_i::keys ( - const ::CORBA::UShort keys) - { - this->keys_ = keys; - if (this->impl_) - { - this->impl_->keys (keys); - } - } - - void - Receiver_exec_i::start_read (const char * topic_name) - { - if (!this->impl_) - ACE_NEW_THROW_EX (this->impl_, - RG_ResetTopic_Receiver_impl ( - this->ciao_context_.in (), - this->iterations_, - this->keys_), - ::CORBA::INTERNAL ()); - this->impl_->start (topic_name); - } - - // Component attributes and port operations. - - ::CCM_DDS::CCM_PortStatusListener_ptr - Receiver_exec_i::get_info_get_status (void) - { - if ( ::CORBA::is_nil (this->ciao_info_get_status_.in ())) - { - info_get_status_exec_i *tmp = 0; - ACE_NEW_RETURN ( - tmp, - info_get_status_exec_i ( - this->ciao_context_.in ()), - ::CCM_DDS::CCM_PortStatusListener::_nil ()); - - this->ciao_info_get_status_ = tmp; - } - - return - ::CCM_DDS::CCM_PortStatusListener::_duplicate ( - this->ciao_info_get_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_ReaderStarter_ptr - Receiver_exec_i::get_start_reading (void) - { - if ( ::CORBA::is_nil (this->ciao_start_reading_.in ())) - { - start_reading_exec_i *tmp = 0; - ACE_NEW_RETURN ( - tmp, - start_reading_exec_i ( - this->ciao_context_.in (), - *this), - ::CCM_ReaderStarter::_nil ()); - - this->ciao_start_reading_ = tmp; - } - - return - ::CCM_ReaderStarter::_duplicate ( - this->ciao_start_reading_.in ()); - } - - // Operations from Components::SessionComponent. - - void - Receiver_exec_i::set_session_context ( - ::Components::SessionContext_ptr ctx) - { - this->ciao_context_ = - ::RG_ResetTopic::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) - { - /* Your code here. */ - } - - void - Receiver_exec_i::ccm_passivate (void) - { - /* Your code here. */ - } - - void - Receiver_exec_i::ccm_remove (void) - { - /* Your code here. */ - } - - extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_RG_ResetTopic_Receiver_Impl (void) - { - ::Components::EnterpriseComponent_ptr retval = - ::Components::EnterpriseComponent::_nil (); - - ACE_NEW_NORETURN ( - retval, - Receiver_exec_i); - - return retval; - } -} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h deleted file mode 100644 index c079a0b39af..00000000000 --- a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_exec.h +++ /dev/null @@ -1,192 +0,0 @@ -// -*- C++ -*- -#ifndef CIAO_RG_RESETTOPIC_RECEIVER_EXEC_MMKH3G_H_ -#define CIAO_RG_RESETTOPIC_RECEIVER_EXEC_MMKH3G_H_ - -#include /**/ "ace/pre.h" - -#include "RG_ResetTopic_ReceiverEC.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include /**/ "Receiver_exec_export.h" -#include "tao/LocalObject.h" - -namespace CIAO_RG_ResetTopic_Receiver_Impl -{ - class Receiver_exec_i; - class RG_ResetTopic_Receiver_impl; - /** - * Provider Executor Implementation Class: info_get1_status_exec_i - */ - - class info_get_status_exec_i - : public virtual ::CCM_DDS::CCM_PortStatusListener, - public virtual ::CORBA::LocalObject - { - public: - info_get_status_exec_i ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx); - virtual ~info_get_status_exec_i (void); - - /** @name Operations and attributes from CCM_DDS::PortStatusListener */ - //@{ - - virtual - void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, - const ::DDS::RequestedDeadlineMissedStatus & status); - - virtual - void on_sample_lost (::DDS::DataReader_ptr the_reader, - const ::DDS::SampleLostStatus & status); - //@} - - private: - ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; - }; - - /** - * Provider Executor Implementation Class: info_read1_status_exec_i - */ - - class info_read_status_exec_i - : public virtual ::CCM_DDS::CCM_PortStatusListener, - public virtual ::CORBA::LocalObject - { - public: - info_read_status_exec_i ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx); - virtual ~info_read_status_exec_i (void); - - /** @name Operations and attributes from CCM_DDS::PortStatusListener */ - //@{ - - virtual - void on_requested_deadline_missed (::DDS::DataReader_ptr the_reader, - const ::DDS::RequestedDeadlineMissedStatus & status); - - virtual - void on_sample_lost (::DDS::DataReader_ptr the_reader, - const ::DDS::SampleLostStatus & status); - //@} - - private: - ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; - }; - - /** - * Provider Executor Implementation Class: start_reading_exec_i - */ - - class start_reading_exec_i - : public virtual ::CCM_ReaderStarter, - public virtual ::CORBA::LocalObject - { - public: - start_reading_exec_i ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, - Receiver_exec_i &callback_); - virtual ~start_reading_exec_i (void); - - /** @name Operations and attributes from ReaderStarter */ - //@{ - - virtual - void start_read (const char * topic_name); - - virtual - void set_reader_properties (::CORBA::UShort nr_keys, - ::CORBA::UShort nr_iterations); - //@} - - private: - ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; - Receiver_exec_i &callback_; - }; - - /** - * Component Executor Implementation Class: Receiver_exec_i - */ - - class Receiver_exec_i - : public virtual Receiver_Exec, - public virtual ::CORBA::LocalObject - { - public: - Receiver_exec_i (void); - virtual ~Receiver_exec_i (void); - - /** @name Supported operations and attributes. */ - //@{ - - //@} - - /** @name Component attributes and port operations. */ - //@{ - - virtual ::CCM_DDS::CCM_PortStatusListener_ptr - get_info_get_status (void); - - virtual ::CCM_DDS::CCM_PortStatusListener_ptr - get_info_read_status (void); - - virtual ::CCM_ReaderStarter_ptr - get_start_reading (void); - - virtual ::CORBA::UShort iterations (void); - - virtual void iterations (::CORBA::UShort iterations); - - virtual ::CORBA::UShort keys (void); - - virtual void keys (::CORBA::UShort keys); - //@} - - /** @name Operations from Components::SessionComponent. */ - //@{ - virtual void set_session_context (::Components::SessionContext_ptr ctx); - virtual void configuration_complete (void); - virtual void ccm_activate (void); - virtual void ccm_passivate (void); - virtual void ccm_remove (void); - //@} - - /** @name User defined public operations. */ - //@{ - void - start_read (const char * topic_name); - //@} - - private: - ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; - - /** @name Component attributes. */ - //@{ - ::CCM_DDS::CCM_PortStatusListener_var ciao_info_get_status_; - ::CCM_DDS::CCM_PortStatusListener_var ciao_info_read_status_; - ::CCM_ReaderStarter_var ciao_start_reading_; - - ::CORBA::UShort iterations_; - - ::CORBA::UShort keys_; - //@} - - /** @name User defined members. */ - //@{ - RG_ResetTopic_Receiver_impl *impl_; - //@} - - /** @name User defined private operations. */ - //@{ - - //@} - }; - - extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_RG_ResetTopic_Receiver_Impl (void); -} - -#include /**/ "ace/post.h" - -#endif /* ifndef */ diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp deleted file mode 100644 index 79686951697..00000000000 --- a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.cpp +++ /dev/null @@ -1,394 +0,0 @@ -#include "RG_ResetTopic_Receiver_impl.h" -#include "tao/ORB_Core.h" -#include "ace/Reactor.h" - -namespace CIAO_RG_ResetTopic_Receiver_Impl -{ - - /** - * Check last - */ - LastSampleChecker::LastSampleChecker (RG_ResetTopic_Receiver_impl &callback, - const ::CORBA::UShort &iterations) - : callback_ (callback) - , iterations_ (iterations) - { - } - - LastSampleChecker::~LastSampleChecker () - { - } - - int - LastSampleChecker::handle_timeout (const ACE_Time_Value &, const void *) - { - ACE_DEBUG ((LM_DEBUG, "Checking if last sample " - "is available in DDS...\n")); - if (this->callback_.check_last ()) - this->callback_.start_read (); - return 0; - } - - /** - * RG_ResetTopic_Receiver_impl - */ - RG_ResetTopic_Receiver_impl::RG_ResetTopic_Receiver_impl ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, - const ::CORBA::UShort & iterations, - const ::CORBA::UShort & keys) - : ciao_context_ ( - ::RG_ResetTopic::CCM_Receiver_Context::_duplicate (ctx)) - , iterations_ (iterations) - , keys_ (keys) - , expected_per_run_ (keys * iterations) - , checker_ (0) - , topic_name_("") - { - } - - RG_ResetTopic_Receiver_impl::~RG_ResetTopic_Receiver_impl () - { - delete this->checker_; - } - - ACE_Reactor* - RG_ResetTopic_Receiver_impl::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 - RG_ResetTopic_Receiver_impl::iterations (::CORBA::UShort iterations) - { - this->iterations_ = iterations; - } - - void - RG_ResetTopic_Receiver_impl::keys (::CORBA::UShort keys) - { - this->keys_= keys; - } - - bool - RG_ResetTopic_Receiver_impl::check_last (void) - { - ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = - this->ciao_context_->get_connection_info_read_data (); - try - { - ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::check_last - " - "last iteration should be <%02d>\n", - this->iterations_)); - RG_ResetTopicSample datum; - ::CCM_DDS::ReadInfo readinfo; - char key[10]; - ACE_OS::sprintf (key, "KEY_%d", this->keys_); - datum.key = CORBA::string_dup (key); - reader->read_one_last ( - datum, - readinfo, - ::DDS::HANDLE_NIL); - ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::check_last - " - "last iteration <%02d> - <%02d>\n", - datum.iteration, - this->iterations_)); - return datum.iteration >= this->iterations_; - } - catch (const ::CCM_DDS::InternalError &) - { - ACE_DEBUG ((LM_DEBUG, "INTERNAL ERROR\n")); - } - catch (const ::CCM_DDS::NonExistent &) - { - ACE_DEBUG ((LM_DEBUG, "NONEXISTENT\n")); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, "Receiver_exec_i::check_last: " - "ERROR: Unexpected exception caught\n")); - } - return false; - } - - void - RG_ResetTopic_Receiver_impl::start (const char * topic_name) - { - this->topic_name_ = topic_name; - //only the first time... - if (!this->checker_) - this->test_exception (); - this->set_topic_name_reader (topic_name); - - if (!this->checker_) - ACE_NEW_THROW_EX (this->checker_, - LastSampleChecker (*this, - this->iterations_), - ::CORBA::NO_MEMORY ()); - if (this->reactor ()->schedule_timer (this->checker_, - 0, - ACE_Time_Value (1, 0), - ACE_Time_Value (1, 0)) == -1) - { - ACE_ERROR ((LM_ERROR, "Receiver_exec_i::schedule_timer - " - "ERROR: Error while starting LastSampleChecker\n")); - } - } - - void - RG_ResetTopic_Receiver_impl::start_read (void) - { - if (this->checker_) - { - this->reactor ()->cancel_timer (this->checker_); - } - this->start_reading (); - this->set_topic_name_getter (this->topic_name_.c_str()); - this->start_getting (); - } - - void - RG_ResetTopic_Receiver_impl::check_samples ( - const char * test, - const RG_ResetTopicSampleSeq& samples, - const ::CORBA::UShort& expected) - { - bool error = samples.length () != expected; - if (ACE_OS::strcmp (test, "get") == 0) - { - error = !(samples.length () > 0); - } - if (error) - { - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::check_samples - " - "ERROR: Unexpected number of %C samples received: " - "expected <%d> - received <%u>\n", - test, - expected, - samples.length ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::check_samples - " - "%C Samples found: <%u>\n", - test, - samples.length ())); - } - for (::CORBA::ULong i = 0; - i < samples.length (); - ++i) - { - ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::check_samples - " - "Sample %C: sample <%d> - key <%C> - iteration <%d>\n", - test, - i, - samples[i].key.in (), - samples[i].iteration)); - } - } - - void - RG_ResetTopic_Receiver_impl::test_exception (void) - { - try - { - if (! ::CORBA::is_nil (this->ciao_context_.in ())) - { - ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = - this->ciao_context_->get_connection_info_read_data (); - if (::CORBA::is_nil (reader.in ())) - { - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " - "ERROR: Unable to get reader interface from the " - "CIAO context\n")); - return; - } - - RG_ResetTopicSample sample; - ::CCM_DDS::ReadInfo readinfo; - sample.key = CORBA::string_dup ("KEY_1"); - reader->read_one_last (sample, - readinfo, - ::DDS::HANDLE_NIL); - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " - "ERROR: No exception caught before topic name has been set\n")); - } - else - { - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " - "ERROR: CIAO context seems to be NIL\n")); - } - } - catch (const ::CORBA::BAD_INV_ORDER &) - { - ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::test_exception - " - "Expected BAD_INV_ORDER thrown.\n")); - } - catch (const CORBA::Exception &e) - { - e._tao_print_exception("RG_ResetTopic_Receiver_impl::test_exception - " - "ERROR: Unexpected exception"); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::test_exception - " - "ERROR: expected and unknown exception caught\n")); - } - } - - void - RG_ResetTopic_Receiver_impl::start_reading (void) - { - ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::start_reading - " - "Start reading\n")); - ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = - this->ciao_context_->get_connection_info_read_data (); - try - { - RG_ResetTopicSampleSeq samples; - ::CCM_DDS::ReadInfoSeq readinfo_seq; - reader->read_all (samples, readinfo_seq); - - this->check_samples ("read", samples, this->expected_per_run_); - } - catch (const CORBA::Exception &e) - { - e._tao_print_exception("RG_ResetTopic_Receiver_impl::start_reading - " - "ERROR: Unexpected exception"); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::start_reading - " - "ERROR: Caught unknow exception\n")); - } - } - - void - RG_ResetTopic_Receiver_impl::start_getting (void) - { - try - { - ::RG_ResetTopic::RG_ResetTopicSampleConnector::Getter_var getter = - this->ciao_context_->get_connection_info_get_fresh_data (); - if (::CORBA::is_nil (getter.in ())) - { - ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::start_getting - " - "ERROR: Unable to get writer interface from the " - "CIAO context\n")); - return; - } - DDS::Duration_t to; - to.sec = 1; - to.nanosec = 0; - getter->time_out (to); - - RG_ResetTopicSampleSeq samples; - ::CCM_DDS::ReadInfoSeq readinfos; - getter->get_many (samples, readinfos); - this->check_samples ("get", samples); - } - catch (const CORBA::Exception &e) - { - e._tao_print_exception("RG_ResetTopic_Receiver_impl::start_getting - " - "ERROR: Unexpected exception"); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::start_getting - " - "ERROR: expected and unknown exception caught\n")); - } - } - - void - RG_ResetTopic_Receiver_impl::set_topic_name_reader (const char * topic_name) - { - try - { - ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::set_topic_name_reader - " - "Setting topic name to <%C>\n", topic_name)); - ::RG_ResetTopic::RG_ResetTopicSampleConnector::Reader_var reader = - this->ciao_context_->get_connection_info_read_data (); - if (::CORBA::is_nil (reader.in ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " - "Unable to get reader interface\n")); - throw ::CORBA::INTERNAL (); - } - ::CORBA::Object_var cmp = reader->_get_component (); - if (::CORBA::is_nil (cmp.in ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " - "Unable to get component interface\n")); - throw ::CORBA::INTERNAL (); - } - ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_State_var conn = - ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_State::_narrow (cmp.in ()); - if (::CORBA::is_nil (conn.in ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " - "Unable to narrow connector interface\n")); - throw ::CORBA::INTERNAL (); - } - - conn->topic_name (topic_name); - } - catch (const ::CCM_DDS::NonChangeable &) - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_reader - " - "Caught NonChangeable exception.\n")); - } - } - - void - RG_ResetTopic_Receiver_impl::set_topic_name_getter (const char * topic_name) - { - try - { - ACE_DEBUG ((LM_DEBUG, "RG_ResetTopic_Receiver_impl::set_topic_name_getter - " - "Setting topic name to <%C>\n", topic_name)); - ::RG_ResetTopic::RG_ResetTopicSampleConnector::Getter_var getter = - this->ciao_context_->get_connection_info_get_fresh_data (); - if (::CORBA::is_nil (getter.in ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " - "Unable to get getter interface\n")); - throw ::CORBA::INTERNAL (); - } - ::CORBA::Object_var cmp = getter->_get_component (); - if (::CORBA::is_nil (cmp.in ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " - "Unable to get component interface\n")); - throw ::CORBA::INTERNAL (); - } - ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event_var conn = - ::RG_ResetTopic::RG_ResetTopicSampleConnector::CCM_DDS_Event::_narrow (cmp.in ()); - if (::CORBA::is_nil (conn.in ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: RG_ResetTopic_Receiver_impl::set_topic_name_getter - " - "Unable to narrow connector interface\n")); - throw ::CORBA::INTERNAL (); - } - conn->topic_name (topic_name); - } - catch (const ::CCM_DDS::NonChangeable &) - { - ACE_ERROR ((LM_ERROR, "RG_ResetTopic_Receiver_impl::set_topic_name_getter - " - "ERROR: Caught NonChangeable exception.\n")); - } - } -} diff --git a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h b/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h deleted file mode 100644 index f60d7b058a0..00000000000 --- a/CIAO/connectors/dds4ccm/tests/ResetTopic/ReadGet/Receiver/RG_ResetTopic_Receiver_impl.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef RG_RESETTOPIC_RECEIVER_IMPL_H_ -#define RG_RESETTOPIC_RECEIVER_IMPL_H_ - -#include "RG_ResetTopic_ReceiverEC.h" - -namespace CIAO_RG_ResetTopic_Receiver_Impl -{ - class RG_ResetTopic_Receiver_impl; - - /** - * LastSampleChecker - */ - class LastSampleChecker - : public ACE_Event_Handler - { - public: - LastSampleChecker (RG_ResetTopic_Receiver_impl &callback, - const ::CORBA::UShort &iterations); - - virtual ~LastSampleChecker (void); - - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg); - private: - RG_ResetTopic_Receiver_impl &callback_; - const ::CORBA::UShort iterations_; - }; - - /** - * RG_ResetTopic_Receiver_impl - */ - class RG_ResetTopic_Receiver_impl - { - public: - RG_ResetTopic_Receiver_impl ( - ::RG_ResetTopic::CCM_Receiver_Context_ptr ctx, - const ::CORBA::UShort & iterations, - const ::CORBA::UShort & keys); - ~RG_ResetTopic_Receiver_impl (void); - - void start (const char * topic_name); - bool check_last (void); - void start_read (void); - - - void iterations (::CORBA::UShort iterations); - void keys (::CORBA::UShort keys); - - private: - ::RG_ResetTopic::CCM_Receiver_Context_var ciao_context_; - ::CORBA::UShort iterations_; - ::CORBA::UShort keys_; - ::CORBA::UShort expected_per_run_; - - LastSampleChecker * checker_; - - ACE_CString topic_name_; - - void set_topic_name_reader (const char * topic_name); - void set_topic_name_getter (const char * topic_name); - - void start_reading (void); - void start_getting (void); - void test_exception (void); - - void check_samples ( - const char * test, - const RG_ResetTopicSampleSeq& samples, - const ::CORBA::UShort& expected=0); - - ACE_Reactor* reactor (void); - }; -}; - -#endif /* RG_RESETTOPIC_RECEIVER_IMPL_H_ */ |