diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2010-10-21 12:26:24 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2010-10-21 12:26:24 +0000 |
commit | 0d163867b2b585780b2ae7d25a7056942936e472 (patch) | |
tree | b459a4c28328070e5e87fb2bf5eba1274a64302e /CIAO/connectors/dds4ccm/tests/CoherentUpdater | |
parent | 61e78277a19f57a14c90ddcc522b36af8731951f (diff) | |
download | ATCD-0d163867b2b585780b2ae7d25a7056942936e472.tar.gz |
Thu Oct 21 12:21:33 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
* connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver.idl:
* connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.h:
* connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.cpp:
Regenerated using -Gex and -Gexr and added the test code again
Diffstat (limited to 'CIAO/connectors/dds4ccm/tests/CoherentUpdater')
3 files changed, 146 insertions, 85 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver.idl b/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver.idl index 7bc5ab200ee..f0aeb97c1e9 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver.idl +++ b/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver.idl @@ -21,6 +21,7 @@ module CoherentUpdate_Test uses CoherentUpdateRestarter updater_restart; attribute unsigned short nr_runs; + attribute unsigned short iterations; }; }; diff --git a/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.cpp index 0cc03a5c873..65892de8c88 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.cpp @@ -1,11 +1,9 @@ // -*- C++ -*- -// // $Id$ #include "CoherentUpdate_Test_Receiver_exec.h" - -#include "ace/OS_NS_unistd.h" #include "tao/ORB_Core.h" +#include "ace/OS_NS_unistd.h" #include "ace/Reactor.h" #include "ace/Log_Msg.h" @@ -36,36 +34,46 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl } //============================================================ - // Starter_exec_i + // Facet Executor Implementation Class: reader_start_exec_i //============================================================ - Starter_exec_i::Starter_exec_i (Receiver_exec_i & callback) - : callback_ (callback) + + reader_start_exec_i::reader_start_exec_i ( + ::CoherentUpdate_Test::CCM_Receiver_Context_ptr ctx, + Receiver_exec_i & callback) + : ciao_context_ ( + ::CoherentUpdate_Test::CCM_Receiver_Context::_duplicate (ctx)) + , callback_ (callback) { } - Starter_exec_i::~Starter_exec_i (void) + reader_start_exec_i::~reader_start_exec_i (void) { } + // Operations from ::CoherentUpdateStarter + void - Starter_exec_i::set_reader_properties (CORBA::UShort nr_iterations) + reader_start_exec_i::set_reader_properties ( + ::CORBA::UShort nr_iterations) { this->callback_.iterations (nr_iterations); } void - Starter_exec_i::start_read (CORBA::UShort run) + reader_start_exec_i::start_read ( + ::CORBA::UShort run) { this->callback_.start_read (run); } //============================================================ - // Receiver_exec_i + // Component Executor Implementation Class: Receiver_exec_i //============================================================ + Receiver_exec_i::Receiver_exec_i (void) - : iterations_ (10), + : nr_runs_ (5), + iterations_ (10), run_ (0), - nr_runs_ (5), last_iter_ (0), ticker_ (0) { @@ -75,14 +83,13 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl { } - bool Receiver_exec_i::check_last () { try { ::CoherentUpdate_Test::Reader_var reader = - this->context_->get_connection_info_out_data (); + this->ciao_context_->get_connection_info_out_data (); if (::CORBA::is_nil (reader.in ())) { ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::check_last - " @@ -104,7 +111,7 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl } catch (...) { - // no need to catch. An error is given + // No need to catch. An error is given // when this example didn't run at all. ACE_DEBUG ((LM_INFO, "CRASH !\n")); } @@ -142,7 +149,7 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl if (this->run_ < this->nr_runs () + 1) { CoherentUpdateRestarter_var restarter = - this->context_->get_connection_updater_restart (); + this->ciao_context_->get_connection_updater_restart (); if (! ::CORBA::is_nil (restarter)) { restarter->restart_update (); @@ -187,7 +194,7 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl ACE_NEW_THROW_EX (this->ticker_, read_action_Generator (*this, run), ::CORBA::INTERNAL ()); - if (this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->schedule_timer ( + if (this->reactor ()->schedule_timer ( this->ticker_, 0, ACE_Time_Value(1, 0), @@ -202,7 +209,7 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl { if (this->ticker_) { - this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->cancel_timer (this->ticker_); + this->reactor ()->cancel_timer (this->ticker_); delete this->ticker_; this->ticker_ = 0; } @@ -211,7 +218,7 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl run)); this->run_ = run; ::CoherentUpdate_Test::Reader_var reader = - this->context_->get_connection_info_out_data (); + this->ciao_context_->get_connection_info_out_data (); if (! ::CORBA::is_nil (reader.in ())) { this->read_all (reader); @@ -223,57 +230,95 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl } } - ::CORBA::UShort - Receiver_exec_i::iterations (void) + // Supported operations and attributes. + + ACE_Reactor* + Receiver_exec_i::reactor (void) { - return this->iterations_; + 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::iterations (::CORBA::UShort iterations) + // Component attributes and port operations. + + ::CCM_DDS::CCM_PortStatusListener_ptr + Receiver_exec_i::get_info_out_status (void) { - this->iterations_ = iterations; + return ::CCM_DDS::CCM_PortStatusListener::_nil (); } - ::CORBA::UShort - Receiver_exec_i::nr_runs (void) + ::CCM_CoherentUpdateStarter_ptr + Receiver_exec_i::get_reader_start (void) { - return this->nr_runs_; + if ( ::CORBA::is_nil (this->ciao_reader_start_.in ())) + { + reader_start_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + reader_start_exec_i ( + this->ciao_context_.in (), + *this), + ::CCM_CoherentUpdateStarter::_nil ()); + + this->ciao_reader_start_ = tmp; + } + + return + ::CCM_CoherentUpdateStarter::_duplicate ( + this->ciao_reader_start_.in ()); } - void - Receiver_exec_i::nr_runs (::CORBA::UShort nr_runs) + ::CORBA::UShort + Receiver_exec_i::nr_runs (void) { - this->nr_runs_ = nr_runs; + return + this->nr_runs_; } - // Port operations. - ::CoherentUpdate_Test::CCM_Listener_ptr - Receiver_exec_i::get_info_out_data_listener (void) + void + Receiver_exec_i::nr_runs ( + const ::CORBA::UShort nr_runs) { - return ::CoherentUpdate_Test::CCM_Listener::_nil (); + this->nr_runs_ = + nr_runs; } - ::CCM_DDS::CCM_PortStatusListener_ptr - Receiver_exec_i::get_info_out_status (void) + ::CORBA::UShort + Receiver_exec_i::iterations (void) { - return ::CCM_DDS::CCM_PortStatusListener::_nil (); + return this->iterations_; } - ::CCM_CoherentUpdateStarter_ptr - Receiver_exec_i::get_reader_start () + void + Receiver_exec_i::iterations (::CORBA::UShort iterations) { - return new Starter_exec_i (*this); + this->iterations_ = iterations; } // Operations from Components::SessionComponent. + void Receiver_exec_i::set_session_context ( ::Components::SessionContext_ptr ctx) { - this->context_ = + this->ciao_context_ = ::CoherentUpdate_Test::CCM_Receiver_Context::_narrow (ctx); - if ( ::CORBA::is_nil (this->context_.in ())) + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) { throw ::CORBA::INTERNAL (); } @@ -299,7 +344,7 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl { if (this->ticker_) { - this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->cancel_timer (this->ticker_); + this->reactor ()->cancel_timer (this->ticker_); delete this->ticker_; this->ticker_ = 0; } @@ -320,12 +365,9 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl { ::Components::EnterpriseComponent_ptr retval = ::Components::EnterpriseComponent::_nil (); - ACE_NEW_NORETURN ( retval, Receiver_exec_i); - return retval; } } - diff --git a/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.h index 5959f8670cd..d568fa657bf 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.h +++ b/CIAO/connectors/dds4ccm/tests/CoherentUpdater/Receiver/CoherentUpdate_Test_Receiver_exec.h @@ -1,21 +1,20 @@ // -*- C++ -*- // $Id$ -#ifndef CIAO_RECEIVER_EXEC_H_ -#define CIAO_RECEIVER_EXEC_H_ +#ifndef CIAO_COHERENTUPDATE_TEST_RECEIVER_EXEC_94WCEL_H_ +#define CIAO_COHERENTUPDATE_TEST_RECEIVER_EXEC_94WCEL_H_ -#include "CoherentUpdate_Test_ReceiverEC.h" +#include /**/ "ace/pre.h" -#include /**/ "Receiver_exec_export.h" +#include "CoherentUpdate_Test_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_CoherentUpdate_Test_Receiver_Impl { class Receiver_exec_i; @@ -39,27 +38,32 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl int run_; }; - //============================================================ - // Starter_exec_i - //============================================================ - class Starter_exec_i + class RECEIVER_EXEC_Export reader_start_exec_i : public virtual ::CCM_CoherentUpdateStarter, public virtual ::CORBA::LocalObject { public: - Starter_exec_i (Receiver_exec_i & callback); - virtual ~Starter_exec_i (void); + reader_start_exec_i ( + ::CoherentUpdate_Test::CCM_Receiver_Context_ptr ctx, + Receiver_exec_i & callback); + virtual ~reader_start_exec_i (void); - virtual void set_reader_properties (CORBA::UShort nr_iterations); - virtual void start_read (CORBA::UShort run); + // Operations and attributes from ::CoherentUpdateStarter + + virtual + void set_reader_properties ( + ::CORBA::UShort nr_iterations); + + virtual + void start_read ( + ::CORBA::UShort run); private: + ::CoherentUpdate_Test::CCM_Receiver_Context_var ciao_context_; Receiver_exec_i &callback_; }; - //============================================================ - // Receiver_exec_i - //============================================================ + class RECEIVER_EXEC_Export Receiver_exec_i : public virtual Receiver_Exec, public virtual ::CORBA::LocalObject @@ -68,58 +72,72 @@ namespace CIAO_CoherentUpdate_Test_Receiver_Impl Receiver_exec_i (void); virtual ~Receiver_exec_i (void); - // Supported operations and attributes. - // Component attributes. + //@{ + /** Supported operations and attributes. */ + + //@} - // Port operations. - virtual ::CoherentUpdate_Test::CCM_Listener_ptr - get_info_out_data_listener (void); + //@{ + /** Component attributes and port operations. */ virtual ::CCM_DDS::CCM_PortStatusListener_ptr get_info_out_status (void); virtual ::CCM_CoherentUpdateStarter_ptr - get_reader_start (); + get_reader_start (void); - bool check_last (); + virtual ::CORBA::UShort + nr_runs (void); - void start_read (CORBA::UShort run); - void run (CORBA::UShort run); + virtual void + nr_runs ( + ::CORBA::UShort nr_runs); ::CORBA::UShort iterations (void); void iterations (::CORBA::UShort iterations); + //@} - ::CORBA::UShort nr_runs (void); - void nr_runs (::CORBA::UShort nr_runs); + //@{ + /** Operations from Components::SessionComponent. */ - // Operations from Components::SessionComponent. - virtual void - set_session_context ( - ::Components::SessionContext_ptr ctx); + + + 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); + //@} + + bool check_last (); + + void start_read (CORBA::UShort run); + void run (CORBA::UShort run); private: - ::CoherentUpdate_Test::CCM_Receiver_Context_var context_; + ::CoherentUpdate_Test::CCM_Receiver_Context_var ciao_context_; + ::CCM_CoherentUpdateStarter_var ciao_reader_start_; + + ::CORBA::UShort nr_runs_; - CORBA::UShort iterations_; - CORBA::UShort run_; - CORBA::UShort nr_runs_; - CORBA::Long last_iter_; + ::CORBA::UShort iterations_; + ::CORBA::UShort run_; + ::CORBA::Long last_iter_; read_action_Generator *ticker_; void read_all ( ::CoherentUpdate_Test::Reader_ptr reader); + + ACE_Reactor* reactor (void); }; extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr create_CoherentUpdate_Test_Receiver_Impl (void); } -#endif /* ifndef */ +#include /**/ "ace/post.h" +#endif /* ifndef */ |