diff options
author | mhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-11-26 13:12:23 +0000 |
---|---|---|
committer | mhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-11-26 13:12:23 +0000 |
commit | 4e65682253a03cff699645b6c831c829978795b0 (patch) | |
tree | 9bca54d675a44d8c6e483c62d3ce902b2a6c978f | |
parent | 3d646a9afe1f411cdb782d2e92be3255507e31de (diff) | |
download | ATCD-4e65682253a03cff699645b6c831c829978795b0.tar.gz |
Fri Nov 26 13:11:39 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.h:
* connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender.mpc:
* connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.cpp:
* connectors/ami4ccm/tests/ThreeComp/descriptors/Plan.cdp:
* connectors/ami4ccm/tests/ThreeComp/descriptors/run_test.pl:
* connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.cpp:
* connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.h:
* connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master.mpc:
* connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.cpp:
* connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.h:
* connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.h:
* connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.cpp:
Generated executors with -Gex. Solve Valgrind warning.
13 files changed, 944 insertions, 353 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 228d8dd9273..0fe44f17472 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,21 @@ +Fri Nov 26 13:11:39 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> + + * connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.h: + * connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender.mpc: + * connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.cpp: + * connectors/ami4ccm/tests/ThreeComp/descriptors/Plan.cdp: + * connectors/ami4ccm/tests/ThreeComp/descriptors/run_test.pl: + * connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.cpp: + * connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.h: + * connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master.mpc: + * connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.cpp: + * connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.h: + * connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.h: + * connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.cpp: + Generated executors with -Gex. Solve Valgrind warning. + + + Fri Nov 26 10:39:30 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> * MPC/config/dds4ccm_ts_default.mpb: diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.cpp b/CIAO/connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.cpp new file mode 100644 index 00000000000..f2aaf084240 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.cpp @@ -0,0 +1,102 @@ +// -*- C++ -*- +// $Id$ + +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1661 + +#include "ThreeCompA_conn_i.h" + +namespace CIAO_ThreeComp_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Impl +{ + AMI4CCM_MyFooReplyHandler_i::AMI4CCM_MyFooReplyHandler_i ( + Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent) + : nr_of_rec_(nr_of_rec), + nr_of_sent_(nr_of_sent) + { + } + + AMI4CCM_MyFooReplyHandler_i::~AMI4CCM_MyFooReplyHandler_i (void) + { + } + + void + AMI4CCM_MyFooReplyHandler_i::foo (::CORBA::Long ami_ret_val, + const char * answer) + { + ++this->nr_of_rec_; + if (ami_ret_val == 1 ) + { + --this->nr_of_sent_; + ACE_DEBUG ((LM_DEBUG, + "OK: Sender get ASYNCHRONOUS callback from Receiver: <%C>.\n", + answer)); + } + } + + void + AMI4CCM_MyFooReplyHandler_i::foo_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + } +} + +namespace CIAO_ThreeComp_AMI4CCM_State_Connector_AMI4CCM_Connector_Impl +{ + AMI4CCM_StateReplyHandler_i::AMI4CCM_StateReplyHandler_i ( + Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent) + : nr_of_rec_(nr_of_rec), + nr_of_sent_(nr_of_sent) + { + } + + AMI4CCM_StateReplyHandler_i::~AMI4CCM_StateReplyHandler_i (void) + { + } + + void + AMI4CCM_StateReplyHandler_i::bar (::CORBA::Long ami_return_val, + const char * answer) + { + if (ami_return_val == 1) + { + ++this->nr_of_rec_; + --this->nr_of_sent_; + ACE_DEBUG ((LM_DEBUG, "OK: Master get ASYNCHRONOUS callback " + "from Sender: <%C>.\n", + answer)); + } } + + void + AMI4CCM_StateReplyHandler_i::bar_excep ( + ::CCM_AMI::ExceptionHolder_ptr excep_holder) + { + excep_holder->raise_exception (); + } +} diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.h b/CIAO/connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.h new file mode 100644 index 00000000000..db4b811dd89 --- /dev/null +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Base/ThreeCompA_conn_i.h @@ -0,0 +1,97 @@ +// -*- C++ -*- +// $Id$ + +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1584 + +#ifndef CIAO_THREECOMPA_CONN_I_SU9VRG_H_ +#define CIAO_THREECOMPA_CONN_I_SU9VRG_H_ + +#include /**/ "ace/pre.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ThreeCompAC.h" + +namespace CIAO_ThreeComp_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Impl +{ + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::UShort > Atomic_UShort; + + class AMI4CCM_MyFooReplyHandler_i + : public ::ThreeComp::AMI4CCM_MyFooReplyHandler + { + public: + AMI4CCM_MyFooReplyHandler_i (Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent); + virtual ~AMI4CCM_MyFooReplyHandler_i (void); + + virtual + void foo (::CORBA::Long ami_return_val, + const char * answer); + + virtual + void foo_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + private: + Atomic_UShort &nr_of_rec_; + Atomic_UShort &nr_of_sent_; + }; +} + +namespace CIAO_ThreeComp_AMI4CCM_State_Connector_AMI4CCM_Connector_Impl +{ + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::UShort > Atomic_UShort; + + class AMI4CCM_StateReplyHandler_i + : public ::ThreeComp::AMI4CCM_StateReplyHandler + { + public: + AMI4CCM_StateReplyHandler_i ( Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent); + virtual ~AMI4CCM_StateReplyHandler_i (void); + + virtual + void bar (::CORBA::Long ami_return_val, + const char * answer); + + virtual + void bar_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + private: + Atomic_UShort &nr_of_rec_; + Atomic_UShort &nr_of_sent_; + }; +} + +// TAO_IDL - Generated from +// be/be_codegen.cpp:2151 + + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master.mpc b/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master.mpc index e8796d69742..b020d78add1 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master.mpc +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master.mpc @@ -86,17 +86,19 @@ project(AMI_ThreeComp_Base_Master_exec) : ciao_executor, ami, ami4ccm_stub { libpaths += ../lib libout = ../lib dynamicflags += THREECOMP_MASTER_EXEC_BUILD_DLL - includes += .. + includes += .. IDL_Files { } Source_Files { ThreeComp_Master_exec.cpp + ../Base/ThreeCompA_conn_i.cpp } Header_Files { ThreeComp_Master_exec.h ThreeComp_Master_exec_export.h + ../Base/ThreeCompA_conn_i.h } Inline_Files { diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.cpp b/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.cpp index e593a2e9c0d..22e98e5da34 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.cpp +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.cpp @@ -1,57 +1,48 @@ // -*- C++ -*- // $Id$ +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ // test 3 components: Master <-> Sender <-> Receiver #include "ThreeComp_Master_exec.h" +#include "../Base/ThreeCompA_conn_i.h" #include "ace/OS_NS_unistd.h" + namespace CIAO_ThreeComp_Master_Impl { - // Keeps the messages on the go. - Atomic_UShort nr_of_sent = 0; - // Keeps the messages received back from the Sender. - Atomic_UShort nr_of_rec = 0; CORBA::Boolean asynch = false; //============================================================ - // Facet Executor Implementation Class: State_callback_exec_i - //============================================================ - State_callback_exec_i::State_callback_exec_i (void) - { - } - - State_callback_exec_i::~State_callback_exec_i (void) - { - } - //============================================================ - // Operations from ::CCM_AMI::State_callback - //============================================================ - void - State_callback_exec_i::bar (::CORBA::Long ami_return_val, - const char * answer) - { - if (ami_return_val == 1) - { - ++nr_of_rec; - --nr_of_sent; - ACE_DEBUG ((LM_DEBUG, "OK: Master get ASYNCHRONOUS callback " - "from Sender: <%C>.\n", - answer)); - } - } - - void - State_callback_exec_i::bar_excep ( - ::CCM_AMI::ExceptionHolder * excep_holder) - { - excep_holder->raise_exception (); - } - - //============================================================ // Worker thread for asynchronous invocations for State //============================================================ asynch_state_generator::asynch_state_generator ( - ::ThreeComp::CCM_Master_Context_ptr context) - : context_(::ThreeComp::CCM_Master_Context::_duplicate (context)) + ::ThreeComp::CCM_Master_Context_ptr context, + Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent) + : context_(::ThreeComp::CCM_Master_Context::_duplicate (context)), + nr_of_rec_(nr_of_rec), + nr_of_sent_(nr_of_sent) { } @@ -61,8 +52,11 @@ namespace CIAO_ThreeComp_Master_Impl context_->get_connection_sendc_run_my_state(); ACE_OS::sleep(2); - ::ThreeComp::CCM_AMI4CCM_StateReplyHandler_var cb = - new State_callback_exec_i (); + ::ThreeComp::AMI4CCM_StateReplyHandler_var cb = + new CIAO_ThreeComp_AMI4CCM_State_Connector_AMI4CCM_Connector_Impl::AMI4CCM_StateReplyHandler_i ( + this->nr_of_rec_, + this->nr_of_sent_); + if (CORBA::is_nil (my_state_ami_)) { ACE_ERROR ((LM_ERROR, "ERROR Master (ASYNCH) :" @@ -73,13 +67,13 @@ namespace CIAO_ThreeComp_Master_Impl for (int i = 0; i < 3; i ++) { - ++nr_of_sent; + ++this->nr_of_sent_; my_state_ami_->sendc_bar ( cb.in(), 1); ACE_DEBUG ((LM_DEBUG, "OK: Master sends ASYNCHRONOUS call to Sender.\n")); } //there is more than 1 message sent, without receiving callbacks, //so it is asynchronous - if (nr_of_sent.value() > 1) + if (this->nr_of_sent_.value() > 1) { asynch = true; } @@ -131,10 +125,13 @@ namespace CIAO_ThreeComp_Master_Impl } return 0; } - //============================================================ - // Component Executor Implementation Class: Master_exec_i - //============================================================ + /** + * Component Executor Implementation Class: Master_exec_i + */ + Master_exec_i::Master_exec_i (void) + : nr_of_rec_ (0), + nr_of_sent_(0) { } @@ -143,15 +140,19 @@ namespace CIAO_ThreeComp_Master_Impl } // Supported operations and attributes. - // Component attributes. + + // Component attributes and port operations. + // Operations from Components::SessionComponent. + void Master_exec_i::set_session_context ( ::Components::SessionContext_ptr ctx) { - this->context_ = + this->ciao_context_ = ::ThreeComp::CCM_Master_Context::_narrow (ctx); - if ( ::CORBA::is_nil (this->context_.in ())) + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) { throw ::CORBA::INTERNAL (); } @@ -160,51 +161,64 @@ namespace CIAO_ThreeComp_Master_Impl void Master_exec_i::configuration_complete (void) { + /* Your code here. */ } void Master_exec_i::ccm_activate (void) { - asynch_state_generator* asynch_state_gen = - new asynch_state_generator (this->context_.in ()); - asynch_state_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); + this->asynch_state_gen = + new asynch_state_generator (this->ciao_context_.in (), + this->nr_of_rec_, + this->nr_of_sent_); + this->asynch_state_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); - synch_state_generator* synch_state_gen = - new synch_state_generator (this->context_.in()); - synch_state_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); + this->synch_state_gen = + new synch_state_generator (this->ciao_context_.in()); + this->synch_state_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); } void Master_exec_i::ccm_passivate (void) { + /* Your code here. */ } void Master_exec_i::ccm_remove (void) { - if ((asynch == false) || (nr_of_rec.value() != 3)) + if ((asynch == false) || (this->nr_of_rec_.value() != 3)) { ACE_ERROR ((LM_ERROR, "ERROR: Test not asynchronous or not received back" " all requests ( %u/3)!\n", - nr_of_rec.value() )); + this->nr_of_rec_.value() )); } else { ACE_DEBUG ((LM_DEBUG, "OK: Test Master.\n")); } + if (this->asynch_state_gen) + { + delete this->asynch_state_gen; + this->asynch_state_gen = 0; + } + if (this->synch_state_gen) + { + delete this->synch_state_gen; + this->synch_state_gen = 0; + } } - extern "C" ::Components::EnterpriseComponent_ptr - create_ThreeComp_AMI_Master_Impl (void) + extern "C" THREECOMP_MASTER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_ThreeComp_Master_Impl (void) { ::Components::EnterpriseComponent_ptr retval = ::Components::EnterpriseComponent::_nil (); - ACE_NEW_RETURN ( + ACE_NEW_NORETURN ( retval, - Master_exec_i, - ::Components::EnterpriseComponent::_nil ()); + Master_exec_i); return retval; } diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.h b/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.h index 9d3d57e49d1..f39231eb9c0 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.h +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Master/ThreeComp_Master_exec.h @@ -1,17 +1,41 @@ // -*- C++ -*- -// // $Id$ -#ifndef CIAO_THREECOMP_MASTER_EXEC_H_ -#define CIAO_THREECOMP_MASTER_EXEC_H_ +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_THREECOMP_MASTER_EXEC_X6NIIT_H_ +#define CIAO_THREECOMP_MASTER_EXEC_X6NIIT_H_ + +#include /**/ "ace/pre.h" #include "ThreeComp_MasterEC.h" -#include "ThreeComp_Master_exec_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include /**/ "ThreeComp_Master_exec_export.h" #include "tao/LocalObject.h" #include "ace/Task.h" @@ -20,39 +44,35 @@ namespace CIAO_ThreeComp_Master_Impl typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::UShort > Atomic_UShort; /// Worker thread for asynchronous invocations - class asynch_state_generator : public virtual ACE_Task_Base - { - public: - asynch_state_generator (::ThreeComp::CCM_Master_Context_ptr context); - - virtual int svc (void); - - private: - ::ThreeComp::CCM_Master_Context_var context_; - }; - - /// Worker thread for synchronous invocations - class synch_state_generator : public virtual ACE_Task_Base - { - public: - synch_state_generator (::ThreeComp::CCM_Master_Context_ptr context); - virtual int svc (void); - - private: - ::ThreeComp::CCM_Master_Context_var context_; - }; - - class State_callback_exec_i - : public virtual ::ThreeComp::CCM_AMI4CCM_StateReplyHandler, - public virtual ::CORBA::LocalObject - { - public: - State_callback_exec_i (void); - virtual ~State_callback_exec_i (void); - - virtual void bar (::CORBA::Long ret, const char * answer); - virtual void bar_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); - }; + class asynch_state_generator : public virtual ACE_Task_Base + { + public: + asynch_state_generator (::ThreeComp::CCM_Master_Context_ptr context, + Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent); + + virtual int svc (void); + + private: + ::ThreeComp::CCM_Master_Context_var context_; + Atomic_UShort &nr_of_rec_; + Atomic_UShort &nr_of_sent_; + + }; + + /// Worker thread for synchronous invocations + class synch_state_generator : public virtual ACE_Task_Base + { + public: + synch_state_generator (::ThreeComp::CCM_Master_Context_ptr context); + virtual int svc (void); + + private: + ::ThreeComp::CCM_Master_Context_var context_; + }; + /* + * Component Executor Implementation Class: Master_exec_i + */ class Master_exec_i : public virtual Master_Exec, @@ -62,22 +82,51 @@ namespace CIAO_ThreeComp_Master_Impl Master_exec_i (void); virtual ~Master_exec_i (void); - virtual void - set_session_context ( - ::Components::SessionContext_ptr ctx); + //@{ + /** Supported operations and attributes. */ + //@} - virtual void configuration_complete (void); + //@{ + /** Component attributes and port operations. */ + //@} + //@{ + /** 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); + //@} + + //@{ + /** User defined public operations. */ + //@} private: - ::ThreeComp::CCM_Master_Context_var context_; + ::ThreeComp::CCM_Master_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + //@} + + //@{ + /** User defined members. */ + asynch_state_generator* asynch_state_gen; + synch_state_generator* synch_state_gen; + Atomic_UShort nr_of_rec_; + Atomic_UShort nr_of_sent_; + //@} + + //@{ + /** User defined private operations. */ + //@} }; extern "C" THREECOMP_MASTER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_ThreeComp_AMI_Master_Impl (void); + create_ThreeComp_Master_Impl (void); } +#include /**/ "ace/post.h" + #endif /* ifndef */ diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.cpp b/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.cpp index 34a708ed9a7..5ff2abd487e 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.cpp +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.cpp @@ -1,40 +1,79 @@ // -*- C++ -*- // $Id$ +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ + #include "ThreeComp_Receiver_exec.h" #include "ace/OS_NS_unistd.h" namespace CIAO_ThreeComp_Receiver_Impl { - MyFoo_exec_i::MyFoo_exec_i (Atomic_UShort &nr_of_received) - : nr_of_received_(nr_of_received) + + /** + * Facet Executor Implementation Class: do_my_foo_exec_i + */ + + do_my_foo_exec_i::do_my_foo_exec_i ( + ::ThreeComp::CCM_Receiver_Context_ptr ctx, + Atomic_UShort &nr_of_received) + : ciao_context_ ( + ::ThreeComp::CCM_Receiver_Context::_duplicate (ctx)), + nr_of_received_(nr_of_received) { } - MyFoo_exec_i::~MyFoo_exec_i (void) + do_my_foo_exec_i::~do_my_foo_exec_i (void) { } - CORBA::Long - MyFoo_exec_i::foo (::CORBA::Long cmd, - ::CORBA::String_out answer) + // Operations from ::ThreeComp::MyFoo + + ::CORBA::Long + do_my_foo_exec_i::foo (::CORBA::Long cmd, + ::CORBA::String_out answer) { ACE_OS::sleep(2); - CORBA::Long ret = 0; - ++nr_of_received_; - if (cmd == 10) - { - ret = 1; - } - if (cmd == 20) - { - ret = 2; - } - answer = CORBA::string_dup ("Hi from receiver."); - return ret; - } + CORBA::Long ret = 0; + ++nr_of_received_; + if (cmd == 10) + { + ret = 1; + } + if (cmd == 20) + { + ret = 2; + } + answer = CORBA::string_dup ("Hi from receiver."); + return ret; } + + /** + * Component Executor Implementation Class: Receiver_exec_i + */ Receiver_exec_i::Receiver_exec_i (void) + :nr_of_received_(0) { } @@ -42,19 +81,41 @@ namespace CIAO_ThreeComp_Receiver_Impl { } + // Supported operations and attributes. + + // Component attributes and port operations. + ::ThreeComp::CCM_MyFoo_ptr Receiver_exec_i::get_do_my_foo (void) { - return new MyFoo_exec_i (nr_of_received_); + if ( ::CORBA::is_nil (this->ciao_do_my_foo_.in ())) + { + do_my_foo_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + do_my_foo_exec_i ( + this->ciao_context_.in (), + this->nr_of_received_), + ::ThreeComp::CCM_MyFoo::_nil ()); + + this->ciao_do_my_foo_ = tmp; + } + + return + ::ThreeComp::CCM_MyFoo::_duplicate ( + this->ciao_do_my_foo_.in ()); } + // Operations from Components::SessionComponent. + void Receiver_exec_i::set_session_context ( ::Components::SessionContext_ptr ctx) { - this->context_ = ::ThreeComp::CCM_Receiver_Context::_narrow (ctx); + this->ciao_context_ = + ::ThreeComp::CCM_Receiver_Context::_narrow (ctx); - if ( ::CORBA::is_nil (this->context_.in ())) + if ( ::CORBA::is_nil (this->ciao_context_.in ())) { throw ::CORBA::INTERNAL (); } @@ -63,46 +124,47 @@ namespace CIAO_ThreeComp_Receiver_Impl void Receiver_exec_i::configuration_complete (void) { + /* Your code here. */ } void Receiver_exec_i::ccm_activate (void) { - nr_of_received_ = 0; + /* Your code here. */ } void Receiver_exec_i::ccm_passivate (void) { + /* Your code here. */ } void Receiver_exec_i::ccm_remove (void) { - // each Receiver has to receive 2 requests. - if (nr_of_received_.value() != 2) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Receiver received wrong number of messages" - " ( %u/2)!\n", - nr_of_received_.value() )); - } - else - { - ACE_DEBUG ((LM_DEBUG, "OK: This Receiver works as expected.\n")); - } + // each Receiver has to receive 2 requests. + if (nr_of_received_.value() != 2) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Receiver received wrong number of messages" + " ( %u/2)!\n", + nr_of_received_.value() )); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK: This Receiver works as expected.\n")); + } } - extern "C" ::Components::EnterpriseComponent_ptr - create_ThreeComp_AMI_Receiver_Impl (void) + extern "C" THREECOMP_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_ThreeComp_Receiver_Impl (void) { ::Components::EnterpriseComponent_ptr retval = ::Components::EnterpriseComponent::_nil (); - ACE_NEW_RETURN ( + ACE_NEW_NORETURN ( retval, - Receiver_exec_i, - ::Components::EnterpriseComponent::_nil ()); + Receiver_exec_i); return retval; } diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.h b/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.h index 623fee47cf9..855e2b257f4 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.h +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Receiver/ThreeComp_Receiver_exec.h @@ -1,8 +1,33 @@ // -*- C++ -*- // $Id$ -#ifndef CIAO_THREECOMP_RECEIVER_EXEC_H_ -#define CIAO_THREECOMP_RECEIVER_EXEC_H_ +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_THREECOMP_RECEIVER_EXEC_I1LVQG_H_ +#define CIAO_THREECOMP_RECEIVER_EXEC_I1LVQG_H_ + +#include /**/ "ace/pre.h" #include "ThreeComp_ReceiverEC.h" @@ -10,27 +35,45 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include /**/ "ThreeComp_Receiver_exec_export.h" #include "tao/LocalObject.h" -#include "ThreeComp_Receiver_exec_export.h" namespace CIAO_ThreeComp_Receiver_Impl { typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::UShort > Atomic_UShort; - class MyFoo_exec_i + /** + * Provider Executor Implementation Class: do_my_foo_exec_i + */ + + class do_my_foo_exec_i : public virtual ::ThreeComp::CCM_MyFoo, public virtual ::CORBA::LocalObject { public: - MyFoo_exec_i (Atomic_UShort &nr_of_received); - virtual ~MyFoo_exec_i (void); + do_my_foo_exec_i ( + ::ThreeComp::CCM_Receiver_Context_ptr ctx, + Atomic_UShort &nr_of_received); + virtual ~do_my_foo_exec_i (void); + + //@{ + /** Operations and attributes from ::ThreeComp::MyFoo. */ + + virtual + ::CORBA::Long foo (::CORBA::Long cmd, + ::CORBA::String_out answer); + //@} - virtual CORBA::Long foo (::CORBA::Long cmd, ::CORBA::String_out answer); private: + ::ThreeComp::CCM_Receiver_Context_var ciao_context_; Atomic_UShort &nr_of_received_; - }; + }; - class Receiver_exec_i + /** + * Component Executor Implementation Class: Receiver_exec_i + */ + + class Receiver_exec_i : public virtual Receiver_Exec, public virtual ::CORBA::LocalObject { @@ -38,23 +81,55 @@ namespace CIAO_ThreeComp_Receiver_Impl Receiver_exec_i (void); virtual ~Receiver_exec_i (void); - virtual ::ThreeComp::CCM_MyFoo_ptr get_do_my_foo (void); + //@{ + /** Supported operations and attributes. */ - virtual void set_session_context (::Components::SessionContext_ptr ctx); + //@} - virtual void configuration_complete (void); + //@{ + /** Component attributes and port operations. */ + + virtual ::ThreeComp::CCM_MyFoo_ptr + get_do_my_foo (void); + //@} + //@{ + /** 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); + //@} + + //@{ + /** User defined public operations. */ + + //@} private: - ::ThreeComp::CCM_Receiver_Context_var context_; + ::ThreeComp::CCM_Receiver_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + ::ThreeComp::CCM_MyFoo_var ciao_do_my_foo_; + //@} + + //@{ + /** User defined members. */ Atomic_UShort nr_of_received_; + //@} + + //@{ + /** User defined private operations. */ + + //@} }; extern "C" THREECOMP_RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_ThreeComp_AMI_Receiver_Impl (void); + create_ThreeComp_Receiver_Impl (void); } +#include /**/ "ace/post.h" + #endif /* ifndef */ diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender.mpc b/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender.mpc index 6323dbd93b2..c97756925d0 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender.mpc +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender.mpc @@ -92,11 +92,15 @@ project(AMI_ThreeComp_Base_Sender_exec) : ciao_executor, ami, ami4ccm_stub { Source_Files { ThreeComp_Sender_exec.cpp + ../Base/ThreeCompA_conn_i.cpp + } Header_Files { ThreeComp_Sender_exec.h ThreeComp_Sender_exec_export.h + ../Base/ThreeCompA_conn_i.h + } Inline_Files { diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.cpp b/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.cpp index 1eb470a0a91..05286cfc4c2 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.cpp +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.cpp @@ -1,159 +1,187 @@ // -*- C++ -*- // $Id$ +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ // test 3 components: Master <-> Sender <-> Receiver // Sender uses and provides ports. #include "ThreeComp_Sender_exec.h" +#include "../Base/ThreeCompA_conn_i.h" #include "ace/OS_NS_unistd.h" namespace CIAO_ThreeComp_Sender_Impl { - // Keeps the messages on the go. - Atomic_UShort nr_of_sent = 0; - // Keeps the messages received back from Receiver. - Atomic_UShort nr_of_rec = 0; CORBA::Boolean asynch = false; //============================================================ - // Facet Executor Implementation Class: MyFoo_callback_exec_i - //============================================================ - MyFoo_callback_exec_i::MyFoo_callback_exec_i (void) - { - } + // Worker thread for asynchronous invocations for MyFoo + //============================================================ + asynch_foo_generator::asynch_foo_generator ( + ::ThreeComp::CCM_Sender_Context_ptr context, + Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent) + : context_(::ThreeComp::CCM_Sender_Context::_duplicate (context)), + nr_of_rec_(nr_of_rec), + nr_of_sent_(nr_of_sent) - MyFoo_callback_exec_i::~MyFoo_callback_exec_i (void) - { - } - //============================================================ - // Operations from ::CCM_AMI::MyFoo_callback - //============================================================ - // for Receiver-Sender callback's - void - MyFoo_callback_exec_i::foo ( - CORBA::Long ami_ret_val, - const char * answer) - { - ++nr_of_rec; - if (ami_ret_val == 1 ) - { - --nr_of_sent; - ACE_DEBUG ((LM_DEBUG, "OK: Sender get ASYNCHRONOUS callback from Receiver: <%C>.\n", - answer)); - } - } + { + } - void - MyFoo_callback_exec_i::foo_excep ( - ::CCM_AMI::ExceptionHolder * excep_holder) + int asynch_foo_generator::svc () + { + ::ThreeComp::Sender::sendc_run_my_fooConnections_var my_foo_ami_ = + context_->get_connections_sendc_run_my_foo(); + ::ThreeComp::AMI4CCM_MyFooReplyHandler_var cb = + new CIAO_ThreeComp_AMI4CCM_MyFoo_Connector_AMI4CCM_Connector_Impl::AMI4CCM_MyFooReplyHandler_i ( + this->nr_of_rec_, + this->nr_of_sent_); + + // Invoke Asynchronous calls to test + for (CORBA::ULong i = 0; i < my_foo_ami_->length (); ++i) + { + ++this->nr_of_sent_; + my_foo_ami_[i].objref->sendc_foo (cb.in(), + 10 ); + ACE_DEBUG ((LM_DEBUG, "OK Sender send ASYNCHRONOUS call to Receiver.\n")); + // There is more than 1 message sent, without receiving callbacks, + // so it is asynchronous + if (this->nr_of_sent_.value() > 1) + { + asynch = true; + } + } + return 0; + } + //============================================================ + // Worker thread for synchronous invocations for MyFoo + //============================================================ + synch_foo_generator::synch_foo_generator ( + ::ThreeComp::CCM_Sender_Context_ptr context, + Atomic_UShort &nr_of_rec) + : context_(::ThreeComp::CCM_Sender_Context::_duplicate (context)), + nr_of_rec_(nr_of_rec) + { + } + + int synch_foo_generator::svc () + { + + ::ThreeComp::Sender::run_my_fooConnections_var my_foo_ami_ = + context_->get_connections_run_my_foo (); + + CORBA::Boolean wait = false; + + for(CORBA::ULong i = 0; i < my_foo_ami_->length(); ++i) + { + CORBA::String_var answer; + try + { + if ( wait==true) + { + ACE_ERROR ((LM_ERROR, + "ERROR: Sender didn't receive SYNCHRONOUS answer" + " from Receiver.\n")); + } + wait = true; + ACE_DEBUG ((LM_DEBUG, "OK Sender send SYNCHRONOUS CALL to Receiver.\n")); + + CORBA::ULong result = my_foo_ami_[i].objref->foo( 20, + answer.out ()); + if (result == 2) + { + ACE_DEBUG ((LM_DEBUG, "OK Sender received SYNCHRONOUS answer " + "from Receiver <%C>\n", + answer.in ())); + ++this->nr_of_rec_; + wait = false; + } + } + catch (const ThreeComp::InternalError&) + { + ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: " + "Unexpected exception.\n")); + } + } + return 0; + } + /** + * Facet Executor Implementation Class: do_my_state_exec_i + */ + + do_my_state_exec_i::do_my_state_exec_i ( + ::ThreeComp::CCM_Sender_Context_ptr ctx) + : ciao_context_ ( + ::ThreeComp::CCM_Sender_Context::_duplicate (ctx)) { - excep_holder->raise_exception (); } - //============================================================ - // Worker thread for asynchronous invocations for MyFoo - //============================================================ - asynch_foo_generator::asynch_foo_generator ( - ::ThreeComp::CCM_Sender_Context_ptr context) - : context_(::ThreeComp::CCM_Sender_Context::_duplicate (context)) + do_my_state_exec_i::~do_my_state_exec_i (void) { } - int asynch_foo_generator::svc () - { - ::ThreeComp::Sender::sendc_run_my_fooConnections_var my_foo_ami_ = - context_->get_connections_sendc_run_my_foo(); - ::ThreeComp::CCM_AMI4CCM_MyFooReplyHandler_var cb = - new MyFoo_callback_exec_i (); - - // Invoke Asynchronous calls to test - for (CORBA::ULong i = 0; i < my_foo_ami_->length (); ++i) - { - ++nr_of_sent; - my_foo_ami_[i].objref->sendc_foo (cb.in(), - 10 ); - ACE_DEBUG ((LM_DEBUG, "OK Sender send ASYNCHRONOUS call to Receiver.\n")); - // There is more than 1 message sent, without receiving callbacks, - // so it is asynchronous - if (nr_of_sent.value() > 1) - { - asynch = true; - } - } - return 0; - } - //============================================================ - // Worker thread for synchronous invocations for MyFoo - //============================================================ - synch_foo_generator::synch_foo_generator ( - ::ThreeComp::CCM_Sender_Context_ptr context) - : context_(::ThreeComp::CCM_Sender_Context::_duplicate (context)) + // Operations from ::ThreeComp::State + + ::CORBA::Long + do_my_state_exec_i::bar (::CORBA::Long cmd, + ::CORBA::String_out answer) { + ACE_OS::sleep(2); + answer = CORBA::string_dup ("Hi from sender."); + return cmd; } - int synch_foo_generator::svc () - { - - ::ThreeComp::Sender::run_my_fooConnections_var my_foo_ami_ = - context_->get_connections_run_my_foo (); - - CORBA::Boolean wait = false; - - for(CORBA::ULong i = 0; i < my_foo_ami_->length(); ++i) - { - CORBA::String_var answer; - try - { - if ( wait==true) - { - ACE_ERROR ((LM_ERROR, - "ERROR: Sender didn't receive SYNCHRONOUS answer" - " from Receiver.\n")); - } - wait = true; - ACE_DEBUG ((LM_DEBUG, "OK Sender send SYNCHRONOUS CALL to Receiver.\n")); - - CORBA::ULong result = my_foo_ami_[i].objref->foo( 20, - answer.out ()); - if (result == 2) - { - ACE_DEBUG ((LM_DEBUG, "OK Sender received SYNCHRONOUS answer " - "from Receiver <%C>\n", - answer.in ())); - ++nr_of_rec; - wait = false; - } - } - catch (const ThreeComp::InternalError&) - { - ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: " - "Unexpected exception.\n")); - } - } - return 0; - } - //============================================================ - // Receptacle Executor Implementation Class: State_exec_i - //============================================================ - // for Master-Sender interactions - State_exec_i::State_exec_i (void) + /** + * Facet Executor Implementation Class: do_my_bar_exec_i + */ + + do_my_bar_exec_i::do_my_bar_exec_i ( + ::ThreeComp::CCM_Sender_Context_ptr ctx) + : ciao_context_ ( + ::ThreeComp::CCM_Sender_Context::_duplicate (ctx)) { } - State_exec_i::~State_exec_i (void) + do_my_bar_exec_i::~do_my_bar_exec_i (void) { } + // Operations from ::ThreeComp::MyBar + ::CORBA::Long - State_exec_i::bar (::CORBA::Long cmd, - ::CORBA::String_out answer) + do_my_bar_exec_i::testbar (::CORBA::Long /* cmd */, + ::CORBA::String_out /* answer */) { - ACE_OS::sleep(2); - answer = CORBA::string_dup ("Hi from sender."); - return cmd; + /* Your code here. */ + return 0; } - //============================================================ - // Component Executor Implementation Class: Sender_exec_i - //============================================================ + + /** + * Component Executor Implementation Class: Sender_exec_i + */ + Sender_exec_i::Sender_exec_i (void) + : nr_of_rec_(0), + nr_of_sent_(0) { } @@ -161,27 +189,60 @@ namespace CIAO_ThreeComp_Sender_Impl { } - //for connection with Master component + // Supported operations and attributes. + + // Component attributes and port operations. + ::ThreeComp::CCM_State_ptr Sender_exec_i::get_do_my_state (void) { - return new State_exec_i (); + if ( ::CORBA::is_nil (this->ciao_do_my_state_.in ())) + { + do_my_state_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + do_my_state_exec_i ( + this->ciao_context_.in ()), + ::ThreeComp::CCM_State::_nil ()); + + this->ciao_do_my_state_ = tmp; + } + + return + ::ThreeComp::CCM_State::_duplicate ( + this->ciao_do_my_state_.in ()); } - //for test connection with no ami interface ::ThreeComp::CCM_MyBar_ptr Sender_exec_i::get_do_my_bar (void) { - return 0; + if ( ::CORBA::is_nil (this->ciao_do_my_bar_.in ())) + { + do_my_bar_exec_i *tmp = 0; + ACE_NEW_RETURN ( + tmp, + do_my_bar_exec_i ( + this->ciao_context_.in ()), + ::ThreeComp::CCM_MyBar::_nil ()); + + this->ciao_do_my_bar_ = tmp; + } + + return + ::ThreeComp::CCM_MyBar::_duplicate ( + this->ciao_do_my_bar_.in ()); } + // Operations from Components::SessionComponent. + void Sender_exec_i::set_session_context ( ::Components::SessionContext_ptr ctx) { - this->context_ = + this->ciao_context_ = ::ThreeComp::CCM_Sender_Context::_narrow (ctx); - if ( ::CORBA::is_nil (this->context_.in ())) + + if ( ::CORBA::is_nil (this->ciao_context_.in ())) { throw ::CORBA::INTERNAL (); } @@ -190,54 +251,66 @@ namespace CIAO_ThreeComp_Sender_Impl void Sender_exec_i::configuration_complete (void) { + /* Your code here. */ } void Sender_exec_i::ccm_activate (void) { //for connection with Receiver component - asynch_foo_generator* asynch_foo_gen = - new asynch_foo_generator (this->context_.in ()); - asynch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); + this->asynch_foo_gen = + new asynch_foo_generator (this->ciao_context_.in (), + this->nr_of_rec_, + this->nr_of_sent_); + this->asynch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); - synch_foo_generator* synch_foo_gen = - new synch_foo_generator (this->context_.in()); - synch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); - } + this->synch_foo_gen = + new synch_foo_generator (this->ciao_context_.in(), + this->nr_of_rec_); + this->synch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1); } void Sender_exec_i::ccm_passivate (void) { + /* Your code here. */ } void Sender_exec_i::ccm_remove (void) { // each Receiver (total 3, see deployment plan) send back 2 requests. - if ((asynch == false) || (nr_of_rec.value() != 6) || - (nr_of_sent.value() != 0)) + if ((asynch == false) || (this->nr_of_rec_.value() != 6) || + (this->nr_of_sent_.value() != 0)) { ACE_ERROR ((LM_ERROR, "ERROR: Test not asynchronous or not received back" " all requests ( %u/6)!\n", - nr_of_rec.value() )); + this->nr_of_rec_.value() )); } else { ACE_DEBUG ((LM_DEBUG, "OK: Sender works as expected.\n")); - } + } if (this->asynch_foo_gen) + { + delete this->asynch_foo_gen; + this->asynch_foo_gen = 0; + } + if (this->synch_foo_gen) + { + delete this->synch_foo_gen; + this->synch_foo_gen = 0; + } } - extern "C" ::Components::EnterpriseComponent_ptr - create_ThreeComp_AMI_Sender_Impl (void) + extern "C" THREECOMP_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr + create_ThreeComp_Sender_Impl (void) { ::Components::EnterpriseComponent_ptr retval = ::Components::EnterpriseComponent::_nil (); - ACE_NEW_RETURN ( + ACE_NEW_NORETURN ( retval, - Sender_exec_i, - ::Components::EnterpriseComponent::_nil ()); + Sender_exec_i); return retval; } diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.h b/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.h index 9b2d2fcc086..5ac3632c5a4 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.h +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender_exec.h @@ -1,17 +1,41 @@ // -*- C++ -*- -// // $Id$ -#ifndef CIAO_THREECOMP_SENDER_EXEC_H_ -#define CIAO_THREECOMP_SENDER_EXEC_H_ +/** + * 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.cs.wustl.edu/~schmidt/TAO.html + **/ +#ifndef CIAO_THREECOMP_SENDER_EXEC_GBRV83_H_ +#define CIAO_THREECOMP_SENDER_EXEC_GBRV83_H_ + +#include /**/ "ace/pre.h" #include "ThreeComp_SenderEC.h" -#include "ThreeComp_Sender_exec_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include /**/ "ThreeComp_Sender_exec_export.h" #include "tao/LocalObject.h" #include "ace/Task.h" @@ -20,50 +44,86 @@ namespace CIAO_ThreeComp_Sender_Impl typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::UShort > Atomic_UShort; /// Worker thread for asynchronous invocations - class asynch_foo_generator : public virtual ACE_Task_Base + class asynch_foo_generator : public virtual ACE_Task_Base + { + public: + asynch_foo_generator (::ThreeComp::CCM_Sender_Context_ptr context, + Atomic_UShort &nr_of_rec, + Atomic_UShort &nr_of_sent); + + virtual int svc (void); + + private: + ::ThreeComp::CCM_Sender_Context_var context_; + Atomic_UShort &nr_of_rec_; + Atomic_UShort &nr_of_sent_; + }; + + /// Worker thread for synchronous invocations + class synch_foo_generator : public virtual ACE_Task_Base + { + public: + synch_foo_generator (::ThreeComp::CCM_Sender_Context_ptr context, + Atomic_UShort &nr_of_rec); + virtual int svc (void); + + private: + ::ThreeComp::CCM_Sender_Context_var context_; + Atomic_UShort &nr_of_rec_; + }; + /** + * Provider Executor Implementation Class: do_my_state_exec_i + */ + + class do_my_state_exec_i + : public virtual ::ThreeComp::CCM_State, + public virtual ::CORBA::LocalObject { public: - asynch_foo_generator (::ThreeComp::CCM_Sender_Context_ptr context); + do_my_state_exec_i ( + ::ThreeComp::CCM_Sender_Context_ptr ctx); + virtual ~do_my_state_exec_i (void); - virtual int svc (void); - - private: - ::ThreeComp::CCM_Sender_Context_var context_; - }; + //@{ + /** Operations and attributes from ::ThreeComp::State. */ - /// Worker thread for synchronous invocations - class synch_foo_generator : public virtual ACE_Task_Base - { - public: - synch_foo_generator (::ThreeComp::CCM_Sender_Context_ptr context); - virtual int svc (void); + virtual + ::CORBA::Long bar (::CORBA::Long cmd, + ::CORBA::String_out answer); + //@} private: - ::ThreeComp::CCM_Sender_Context_var context_; + ::ThreeComp::CCM_Sender_Context_var ciao_context_; }; - class MyFoo_callback_exec_i - : public virtual ::ThreeComp::CCM_AMI4CCM_MyFooReplyHandler, + /** + * Provider Executor Implementation Class: do_my_bar_exec_i + */ + + class do_my_bar_exec_i + : public virtual ::ThreeComp::CCM_MyBar, public virtual ::CORBA::LocalObject { public: - MyFoo_callback_exec_i (void); - virtual ~MyFoo_callback_exec_i (void); + do_my_bar_exec_i ( + ::ThreeComp::CCM_Sender_Context_ptr ctx); + virtual ~do_my_bar_exec_i (void); + + //@{ + /** Operations and attributes from ::ThreeComp::MyBar. */ - virtual void foo (::CORBA::Long ami_return_val, const char * answer); - virtual void foo_excep (::CCM_AMI::ExceptionHolder_ptr excep_holder); + virtual + ::CORBA::Long testbar (::CORBA::Long cmd, + ::CORBA::String_out answer); + //@} + private: + ::ThreeComp::CCM_Sender_Context_var ciao_context_; }; - class State_exec_i - : public virtual ::ThreeComp::CCM_State, - public virtual ::CORBA::LocalObject - { - public: - State_exec_i (void); - virtual ~State_exec_i (void); - - virtual CORBA::Long bar (::CORBA::Long cmd, ::CORBA::String_out); - }; + + /** + * Component Executor Implementation Class: Sender_exec_i + */ class Sender_exec_i : public virtual Sender_Exec, @@ -72,26 +132,61 @@ namespace CIAO_ThreeComp_Sender_Impl public: Sender_exec_i (void); virtual ~Sender_exec_i (void); - virtual ::ThreeComp::CCM_State_ptr get_do_my_state (void); - virtual ::ThreeComp::CCM_MyBar_ptr get_do_my_bar (void); + //@{ + /** Supported operations and attributes. */ - virtual void - set_session_context ( - ::Components::SessionContext_ptr ctx); + //@} - virtual void configuration_complete (void); + //@{ + /** Component attributes and port operations. */ + + virtual ::ThreeComp::CCM_State_ptr + get_do_my_state (void); + virtual ::ThreeComp::CCM_MyBar_ptr + get_do_my_bar (void); + //@} + + //@{ + /** 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); + //@} + + //@{ + /** User defined public operations. */ + //@} private: - ::ThreeComp::CCM_Sender_Context_var context_; + ::ThreeComp::CCM_Sender_Context_var ciao_context_; + + //@{ + /** Component attributes. */ + ::ThreeComp::CCM_State_var ciao_do_my_state_; + ::ThreeComp::CCM_MyBar_var ciao_do_my_bar_; + //@} + + //@{ + /** User defined members. */ + asynch_foo_generator* asynch_foo_gen; + synch_foo_generator* synch_foo_gen; + Atomic_UShort nr_of_rec_; + Atomic_UShort nr_of_sent_; + //@} + + //@{ + /** User defined private operations. */ + //@} }; extern "C" THREECOMP_SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr - create_ThreeComp_AMI_Sender_Impl (void); + create_ThreeComp_Sender_Impl (void); } +#include /**/ "ace/post.h" + #endif /* ifndef */ diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/Plan.cdp b/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/Plan.cdp index 74458ce0871..6e772c02181 100644 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/Plan.cdp +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/Plan.cdp @@ -16,7 +16,7 @@ <kind>tk_string</kind> </type> <value> - <string>create_ThreeComp_AMI_Receiver_Impl</string> + <string>create_ThreeComp_Receiver_Impl</string> </value> </value> </execParameter> @@ -67,7 +67,7 @@ <kind>tk_string</kind> </type> <value> - <string>create_ThreeComp_AMI_Sender_Impl</string> + <string>create_ThreeComp_Sender_Impl</string> </value> </value> </execParameter> @@ -118,7 +118,7 @@ <kind>tk_string</kind> </type> <value> - <string>create_ThreeComp_AMI_Master_Impl</string> + <string>create_ThreeComp_Master_Impl</string> </value> </value> </execParameter> diff --git a/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/run_test.pl b/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/run_test.pl index 8a29b500c30..47968fc734b 100755 --- a/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/run_test.pl +++ b/CIAO/connectors/ami4ccm/tests/ThreeComp/descriptors/run_test.pl @@ -201,7 +201,7 @@ print "Start dance_plan_launcher.exe with -x $cdp_file -k file://$ior_emfile\n"; $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", "-x $cdp_file -k file://$ior_emfile"); -$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); +$pl_status = $E->SpawnWaitKill (2* $tg_executor->ProcessStartWaitInterval ()); if ($pl_status != 0) { print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; @@ -227,7 +227,7 @@ print "by running dance_plan_launcher.exe with -k file://$ior_emfile -x $cdp_fil $E = $tg_executor->CreateProcess ("$DANCE_ROOT/bin/dance_plan_launcher", "-k file://$ior_emfile -x $cdp_file -s"); -$pl_status = $E->SpawnWaitKill ($tg_executor->ProcessStartWaitInterval ()); +$pl_status = $E->SpawnWaitKill (2 * $tg_executor->ProcessStartWaitInterval ()); if ($pl_status != 0) { print STDERR "ERROR: dance_plan_launcher returned $pl_status\n"; |