summaryrefslogtreecommitdiff
path: root/CIAO/connectors/ami4ccm/tutorials
diff options
context:
space:
mode:
authormhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-11-17 09:28:56 +0000
committermhengstmengel <mhengstmengel@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-11-17 09:28:56 +0000
commit34645c167eaba892d85ce9797ec55a802420ede8 (patch)
treea61cce8c644de8bf1f6f37fca467bb211ccf1a89 /CIAO/connectors/ami4ccm/tutorials
parent0a64813b7bd2c4fd10f1064ab9458afb13b29d84 (diff)
downloadATCD-34645c167eaba892d85ce9797ec55a802420ede8.tar.gz
Wed Nov 17 09:26:42 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl>
* connectors/ami4ccm/tests/ThreeComp/Sender/ThreeComp_Sender.idl: * connectors/ami4ccm/tests/ThreeComp/Base/ThreeComp.idl: Add no ami4ccm interface.
Diffstat (limited to 'CIAO/connectors/ami4ccm/tutorials')
-rw-r--r--CIAO/connectors/ami4ccm/tutorials/Hello/Hello_asm/Sender_comp/src/Hello_Sender_comp_exec.cpp310
1 files changed, 41 insertions, 269 deletions
diff --git a/CIAO/connectors/ami4ccm/tutorials/Hello/Hello_asm/Sender_comp/src/Hello_Sender_comp_exec.cpp b/CIAO/connectors/ami4ccm/tutorials/Hello/Hello_asm/Sender_comp/src/Hello_Sender_comp_exec.cpp
index b8b9fb7f846..02ef213fe23 100644
--- a/CIAO/connectors/ami4ccm/tutorials/Hello/Hello_asm/Sender_comp/src/Hello_Sender_comp_exec.cpp
+++ b/CIAO/connectors/ami4ccm/tutorials/Hello/Hello_asm/Sender_comp/src/Hello_Sender_comp_exec.cpp
@@ -1,262 +1,40 @@
// -*- 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 "Hello_Sender_comp_exec.h"
-#include "ace/OS_NS_unistd.h"
namespace CIAO_Hello_Sender_comp_Impl
{
- //============================================================
- // Facet Executor Implementation Class: MyFoo_callback_exec_i
- //============================================================
- MyFoo_obj_callback_exec_i::MyFoo_obj_callback_exec_i (void)
- {
- }
-
- MyFoo_obj_callback_exec_i::~MyFoo_obj_callback_exec_i (void)
- {
- }
- //============================================================
- // Operations from ::CCM_AMI::MyFoo_obj_callback
- //============================================================
- // Foo methods
- void
- MyFoo_obj_callback_exec_i::foo (
- ::CORBA::Long ami_return_val,
- const char * answer)
- {
- /* Your code here. */
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender:\tMyFoo AMI Callback from foo:")
- ACE_TEXT("result <%u> answer <%C>\n"),
- ami_return_val, answer));
- }
-
- void
- MyFoo_obj_callback_exec_i::foo_excep (
- ::CCM_AMI::ExceptionHolder * excep_holder)
- {
- /* Your code here. */
- try
- {
- excep_holder->raise_exception ();
- }
- catch (const Hello::InternalError& ex)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender:\tMyFoo Expected excception AMI Callback ")
- ACE_TEXT("from foo: id <%u> error_string <%C>\n"),
- ex.id, ex.error_string.in ()));
- }
- }
+ /**
+ * Component Executor Implementation Class: Sender_comp_exec_i
+ */
- // Hello methods
- void
- MyFoo_obj_callback_exec_i::hello (
- ::CORBA::Long answer)
- {
- /* Your code here. */
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender:\tMyFoo AMI Callback from hello:")
- ACE_TEXT(" answer <%u>\n"), answer));
- }
-
- void
- MyFoo_obj_callback_exec_i::hello_excep (
- ::CCM_AMI::ExceptionHolder * excep_holder)
- {
- /* Your code here. */
- try
- {
- excep_holder->raise_exception ();
- }
- catch (const Hello::InternalError& ex)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender:\tMyFoo Exception AMI Callback from hello:\n")
- ACE_TEXT(" id <%u> error_string <%C>\n"),
- ex.id, ex.error_string.in ()));
- }
- }
-
- // GET rw_attrib meyhods
- void
- MyFoo_obj_callback_exec_i::get_rw_attrib (
- ::CORBA::Short ami_return_val)
- {
- /* Your code here. */
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender:\tMyFoo AMI Callback from get_rw_attrib:")
- ACE_TEXT(" result <%u>\n"), ami_return_val));
- }
-
- void
- MyFoo_obj_callback_exec_i::get_rw_attrib_excep (
- ::CCM_AMI::ExceptionHolder * excep_holder)
- {
- /* Your code here. */
- excep_holder->raise_exception ();
- }
-
- //SET rw_attrib methods
- void
- MyFoo_obj_callback_exec_i::set_rw_attrib ()
- {
- /* Your code here. */
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender:\tMyFoo AMI Callback from ")
- ACE_TEXT("set_rw_attrib.\n")));
- }
-
- void
- MyFoo_obj_callback_exec_i::set_rw_attrib_excep (
- ::CCM_AMI::ExceptionHolder * excep_holder)
- {
- /* Your code here. */
- excep_holder->raise_exception ();
- }
-
- //ro_attrib Reply Handler
- void
- MyFoo_obj_callback_exec_i::get_ro_attrib (
- ::CORBA::Short ami_return_val)
- {
- /* Your code here. */
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender:\tMyFoo AMI Callback from ")
- ACE_TEXT("get_ro_attrib: result <%u>\n"), ami_return_val));
- }
-
- void
- MyFoo_obj_callback_exec_i::get_ro_attrib_excep (
- ::CCM_AMI::ExceptionHolder * excep_holder)
- {
- /* Your code here. */
- excep_holder->raise_exception ();
- }
-
- //============================================================
- // Worker thread for asynchronous invocations for MyFoo
- //============================================================
- asynch_foo_generator::asynch_foo_generator (
- ::Hello::AMI4CCM_MyFoo_obj_ptr my_foo_ami)
- : my_foo_ami_ (::Hello::AMI4CCM_MyFoo_obj::_duplicate (my_foo_ami))
- {
- }
-
- int asynch_foo_generator::svc ()
- {
- ACE_OS::sleep (2);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (ASYNCH) :")
- ACE_TEXT("\tInvoke Asynchronous calls\n")));
-
- for (int i = 0; i < 5; ++i)
- {
- if (CORBA::is_nil (my_foo_ami_))
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT("ERROR Sender (ASYNCH) :")
- ACE_TEXT("\tfoo_ami is NIL !!!\n")));
- return 1;
- }
- else
- {
- my_foo_ami_->sendc_foo (new MyFoo_obj_callback_exec_i (),
- "Do something asynchronous");
- my_foo_ami_->sendc_hello (new MyFoo_obj_callback_exec_i ());
- my_foo_ami_->sendc_get_rw_attrib(new MyFoo_obj_callback_exec_i ());
- my_foo_ami_->sendc_set_rw_attrib(new MyFoo_obj_callback_exec_i (), 15);
- my_foo_ami_->sendc_get_ro_attrib(new MyFoo_obj_callback_exec_i ());
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (ASYNCH) :\tInvoked 5 Asynchronous calls\n")));
- }
- }
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (ASYNCH) :\tInvoke Asynchronous calls ")
- ACE_TEXT("to test except handling\n")));
- my_foo_ami_->sendc_foo (new MyFoo_obj_callback_exec_i (), "");
- my_foo_ami_->sendc_set_rw_attrib(new MyFoo_obj_callback_exec_i (), 0);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (ASYNCH) :\tInvoked 2 Asynchronous call.\n")));
- return 0;
- }
-
- //============================================================
- // Worker thread for synchronous invocations for MyFoo
- //============================================================
- synch_foo_generator::synch_foo_generator (::Hello::MyFoo_obj_ptr my_foo_ami)
- : my_foo_ami_ (::Hello::MyFoo_obj::_duplicate (my_foo_ami))
- {
- }
-
- int synch_foo_generator::svc ()
- {
- ACE_OS::sleep (2);
- // run synch calls
- CORBA::String_var out_str;
- for (int i = 0; i < 2; ++i)
- {
- try
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH) :\tInvoke synchronous call (foo)\n")));
- CORBA::Long result = my_foo_ami_->foo ("Do something synchronous",
- out_str.out());
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call (foo)\n")
- ACE_TEXT(" result <%u> answer <%C>\n"),
- result, out_str.in()));
-
- CORBA::Long answer;
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH) :\tInvoke synchronous call")
- ACE_TEXT(" (hello)\n")));
- my_foo_ami_->hello (answer);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH):\tInvoked synchronous ")
- ACE_TEXT("call (hello) result <%u>\n"), answer));
-
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH) :\tInvoke synchronous call ")
- ACE_TEXT("(rw_attrib())\n")));
- CORBA::Short rw_attrib = my_foo_ami_->rw_attrib ();
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call ")
- ACE_TEXT("(rw_attrib()) return <%u>\n"), rw_attrib));
-
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH) :\tInvoke synchronous call")
- ACE_TEXT(" (rw_attrib(15))\n")));
- my_foo_ami_->rw_attrib (15);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call ")
- ACE_TEXT("(rw_attrib(15))\n")));
-
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH) :\tInvoke synchronous call")
- ACE_TEXT(" (ro_attrib())\n")));
- CORBA::Short ro_attrib = my_foo_ami_->ro_attrib ();
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH):\tInvoked synchronous call ")
- ACE_TEXT("(ro_attrib) return <%u>\n"), ro_attrib));
- }
- catch (const Hello::InternalError& ex)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("Sender (SYNCH) :\tUnexpected Exception caught :")
- ACE_TEXT(" <%u> <%C>\n"), ex.id, ex.error_string.in ()));
- }
- }
- return 0;
- }
-
- //============================================================
- // Component Executor Implementation Class: Sender_comp_exec_i
- //============================================================
- Sender_comp_exec_i::Sender_comp_exec_i (void)
- {
+ Sender_comp_exec_i::Sender_comp_exec_i (void){
}
Sender_comp_exec_i::~Sender_comp_exec_i (void)
@@ -264,17 +42,19 @@ namespace CIAO_Hello_Sender_comp_Impl
}
// Supported operations and attributes.
- // Component attributes.
- // Port operations.
+
+ // Component attributes and port operations.
+
// Operations from Components::SessionComponent.
void
Sender_comp_exec_i::set_session_context (
::Components::SessionContext_ptr ctx)
{
- this->context_ =
+ this->ciao_context_ =
::Hello::CCM_Sender_comp_Context::_narrow (ctx);
- if ( ::CORBA::is_nil (this->context_.in ()))
+
+ if ( ::CORBA::is_nil (this->ciao_context_.in ()))
{
throw ::CORBA::INTERNAL ();
}
@@ -283,44 +63,36 @@ namespace CIAO_Hello_Sender_comp_Impl
void
Sender_comp_exec_i::configuration_complete (void)
{
+ /* Your code here. */
}
void
Sender_comp_exec_i::ccm_activate (void)
{
- ::Hello::AMI4CCM_MyFoo_obj_var asynch_foo =
- this->context_->get_connection_sendc_run_my_foo();
- asynch_foo_generator* asynch_foo_gen =
- new asynch_foo_generator (asynch_foo);
- asynch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1);
-
- ::Hello::MyFoo_obj_var synch_foo =
- this->context_->get_connection_run_my_foo ();
- synch_foo_generator* synch_foo_gen =
- new synch_foo_generator (synch_foo);
- synch_foo_gen->activate (THR_NEW_LWP | THR_JOINABLE, 1);
+ /* Your code here. */
}
void
Sender_comp_exec_i::ccm_passivate (void)
{
+ /* Your code here. */
}
void
Sender_comp_exec_i::ccm_remove (void)
{
+ /* Your code here. */
}
extern "C" ::Components::EnterpriseComponent_ptr
- create_Hello_AMI_Sender_comp_Impl (void)
+ create_Hello_Sender_comp_Impl (void)
{
::Components::EnterpriseComponent_ptr retval =
::Components::EnterpriseComponent::_nil ();
- ACE_NEW_RETURN (
+ ACE_NEW_NORETURN (
retval,
- Sender_comp_exec_i,
- ::Components::EnterpriseComponent::_nil ());
+ Sender_comp_exec_i);
return retval;
}