summaryrefslogtreecommitdiff
path: root/modules/CIAO/examples/Swapping
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-08-16 20:41:22 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-08-16 20:41:22 +0000
commit3b37923a14c7db4d9d602cd9166be38f6104da50 (patch)
tree63477c4878be44047f054092ab3a9b8bb77ba59f /modules/CIAO/examples/Swapping
parent767b53703f187eddaf51b3a1d99c6984bf8ba75f (diff)
downloadATCD-3b37923a14c7db4d9d602cd9166be38f6104da50.tar.gz
branching/tagging
Diffstat (limited to 'modules/CIAO/examples/Swapping')
-rw-r--r--modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.idl21
-rw-r--r--modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.mpc67
-rw-r--r--modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_skel_export.h58
-rw-r--r--modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_stub_export.h58
-rw-r--r--modules/CIAO/examples/Swapping/Receiver/Receiver.idl21
-rw-r--r--modules/CIAO/examples/Swapping/Receiver/Receiver.mpc116
-rw-r--r--modules/CIAO/examples/Swapping/Receiver/Receiver_exec.cpp161
-rw-r--r--modules/CIAO/examples/Swapping/Receiver/Receiver_exec.h105
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender.idl32
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender.mpc191
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec.cpp189
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec.h170
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec_1.cpp133
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec_1.h111
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec_1_export.h58
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec_2.cpp125
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec_2.h112
-rw-r--r--modules/CIAO/examples/Swapping/Sender/Sender_exec_2_export.h58
-rw-r--r--modules/CIAO/examples/Swapping/Sender/starter.cpp96
19 files changed, 1882 insertions, 0 deletions
diff --git a/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.idl b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.idl
new file mode 100644
index 00000000000..6cb61fed2c1
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.idl
@@ -0,0 +1,21 @@
+//$Id$:
+
+#ifndef CIAO_HELLO_IDL
+#define CIAO_HELLO_IDL
+
+#include <Components.idl>
+
+module Hello
+{
+ interface ReadMessage
+ {
+ string get_message();
+ };
+
+ eventtype TimeOut
+ {
+ };
+
+};
+
+#endif /* CIAO_HELLO_IDL */
diff --git a/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.mpc b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.mpc
new file mode 100644
index 00000000000..e9df0daac15
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base.mpc
@@ -0,0 +1,67 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl -n -e -u Swapping Hello_Base"
+
+project(Swapping_Hello_Base_idl_gen) : ciaoidldefaults, anytypecode {
+ custom_only = 1
+ idlflags += \
+ -Wb,stub_export_macro=HELLO_BASE_STUB_Export \
+ -Wb,stub_export_include=Hello_Base_stub_export.h \
+ -Wb,skel_export_macro=HELLO_BASE_SKEL_Export \
+ -Wb,skel_export_include=Hello_Base_skel_export.h
+
+ IDL_Files {
+ Hello_Base.idl
+ }
+}
+
+project(Swapping_Hello_Base_stub) : ccm_stub {
+ after += Swapping_Hello_Base_idl_gen
+ libs +=
+
+ sharedname = Swapping_Hello_Base_stub
+ dynamicflags = HELLO_BASE_STUB_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Hello_BaseC.cpp
+ }
+
+ Header_Files {
+ Hello_BaseC.h
+ Hello_Base_stub_export.h
+ }
+
+ Inline_Files {
+ Hello_BaseC.inl
+ }
+}
+
+
+project(Swapping_Hello_Base_skel) : ciao_executor {
+ after += Swapping_Hello_Base_stub
+ sharedname = Swapping_Hello_Base_skel
+ libs += Swapping_Hello_Base_stub
+
+
+ dynamicflags = HELLO_BASE_SKEL_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Hello_BaseS.cpp
+ }
+
+ Header_Files {
+ Hello_BaseS.h
+ Hello_Base_skel_export.h
+ }
+
+ Inline_Files {
+ Hello_BaseS.inl
+ }
+}
+
+
diff --git a/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_skel_export.h b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_skel_export.h
new file mode 100644
index 00000000000..f1a43a7ff9e
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_skel_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl HELLO_BASE_SKEL
+// ------------------------------
+#ifndef HELLO_BASE_SKEL_EXPORT_H
+#define HELLO_BASE_SKEL_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (HELLO_BASE_SKEL_HAS_DLL)
+# define HELLO_BASE_SKEL_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && HELLO_BASE_SKEL_HAS_DLL */
+
+#if !defined (HELLO_BASE_SKEL_HAS_DLL)
+# define HELLO_BASE_SKEL_HAS_DLL 1
+#endif /* ! HELLO_BASE_SKEL_HAS_DLL */
+
+#if defined (HELLO_BASE_SKEL_HAS_DLL) && (HELLO_BASE_SKEL_HAS_DLL == 1)
+# if defined (HELLO_BASE_SKEL_BUILD_DLL)
+# define HELLO_BASE_SKEL_Export ACE_Proper_Export_Flag
+# define HELLO_BASE_SKEL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define HELLO_BASE_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* HELLO_BASE_SKEL_BUILD_DLL */
+# define HELLO_BASE_SKEL_Export ACE_Proper_Import_Flag
+# define HELLO_BASE_SKEL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define HELLO_BASE_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* HELLO_BASE_SKEL_BUILD_DLL */
+#else /* HELLO_BASE_SKEL_HAS_DLL == 1 */
+# define HELLO_BASE_SKEL_Export
+# define HELLO_BASE_SKEL_SINGLETON_DECLARATION(T)
+# define HELLO_BASE_SKEL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* HELLO_BASE_SKEL_HAS_DLL == 1 */
+
+// Set HELLO_BASE_SKEL_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (HELLO_BASE_SKEL_NTRACE)
+# if (ACE_NTRACE == 1)
+# define HELLO_BASE_SKEL_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define HELLO_BASE_SKEL_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !HELLO_BASE_SKEL_NTRACE */
+
+#if (HELLO_BASE_SKEL_NTRACE == 1)
+# define HELLO_BASE_SKEL_TRACE(X)
+#else /* (HELLO_BASE_SKEL_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define HELLO_BASE_SKEL_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (HELLO_BASE_SKEL_NTRACE == 1) */
+
+#endif /* HELLO_BASE_SKEL_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_stub_export.h b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_stub_export.h
new file mode 100644
index 00000000000..b7a3ee2c879
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Hello_Base/Hello_Base_stub_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl HELLO_BASE_STUB
+// ------------------------------
+#ifndef HELLO_BASE_STUB_EXPORT_H
+#define HELLO_BASE_STUB_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (HELLO_BASE_STUB_HAS_DLL)
+# define HELLO_BASE_STUB_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && HELLO_BASE_STUB_HAS_DLL */
+
+#if !defined (HELLO_BASE_STUB_HAS_DLL)
+# define HELLO_BASE_STUB_HAS_DLL 1
+#endif /* ! HELLO_BASE_STUB_HAS_DLL */
+
+#if defined (HELLO_BASE_STUB_HAS_DLL) && (HELLO_BASE_STUB_HAS_DLL == 1)
+# if defined (HELLO_BASE_STUB_BUILD_DLL)
+# define HELLO_BASE_STUB_Export ACE_Proper_Export_Flag
+# define HELLO_BASE_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define HELLO_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* HELLO_BASE_STUB_BUILD_DLL */
+# define HELLO_BASE_STUB_Export ACE_Proper_Import_Flag
+# define HELLO_BASE_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define HELLO_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* HELLO_BASE_STUB_BUILD_DLL */
+#else /* HELLO_BASE_STUB_HAS_DLL == 1 */
+# define HELLO_BASE_STUB_Export
+# define HELLO_BASE_STUB_SINGLETON_DECLARATION(T)
+# define HELLO_BASE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* HELLO_BASE_STUB_HAS_DLL == 1 */
+
+// Set HELLO_BASE_STUB_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (HELLO_BASE_STUB_NTRACE)
+# if (ACE_NTRACE == 1)
+# define HELLO_BASE_STUB_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define HELLO_BASE_STUB_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !HELLO_BASE_STUB_NTRACE */
+
+#if (HELLO_BASE_STUB_NTRACE == 1)
+# define HELLO_BASE_STUB_TRACE(X)
+#else /* (HELLO_BASE_STUB_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define HELLO_BASE_STUB_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (HELLO_BASE_STUB_NTRACE == 1) */
+
+#endif /* HELLO_BASE_STUB_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/examples/Swapping/Receiver/Receiver.idl b/modules/CIAO/examples/Swapping/Receiver/Receiver.idl
new file mode 100644
index 00000000000..8be435c687c
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Receiver/Receiver.idl
@@ -0,0 +1,21 @@
+//$Id$:
+
+#ifndef RECEIVER_IDL
+#define RECEIVER_IDL
+
+#include "../Hello_Base/Hello_Base.idl"
+
+module Hello
+{
+ component Receiver
+ {
+ uses ReadMessage read_message;
+ consumes TimeOut click_in;
+ };
+
+ home ReceiverHome manages Receiver
+ {
+ };
+
+};
+#endif /*RECEIVER_IDL*/
diff --git a/modules/CIAO/examples/Swapping/Receiver/Receiver.mpc b/modules/CIAO/examples/Swapping/Receiver/Receiver.mpc
new file mode 100644
index 00000000000..e7a99a6ab34
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Receiver/Receiver.mpc
@@ -0,0 +1,116 @@
+// $Id$
+// This file is generated with "generate_component_mpc_extra.pl -p Hello_Base Receiver"
+
+project(Swapping_Hello_Receiver_idl_gen) : componentidldefaults {
+ custom_only = 1
+ 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,exec_export_macro=RECEIVER_EXEC_Export \
+ -Wb,exec_export_include=Receiver_exec_export.h \
+
+ IDL_Files {
+ Receiver.idl
+ }
+}
+
+project(Swapping_Hello_Receiver_lem_gen) : ciaoidldefaults {
+ custom_only = 1
+ after += Swapping_Hello_Receiver_idl_gen
+ idlflags += -Wb,export_macro=RECEIVER_SVNT_Export \
+ -Wb,export_include=Receiver_svnt_export.h \
+ -SS
+ IDL_Files {
+ ReceiverE.idl
+ }
+}
+
+project(Swapping_Hello_Receiver_stub): ccm_stub {
+ libpaths += ../Hello_Base
+ after += Swapping_Hello_Receiver_idl_gen \
+ Swapping_Hello_Base_stub
+ sharedname = Swapping_Receiver_stub
+ dynamicflags = RECEIVER_STUB_BUILD_DLL
+ libs += Swapping_Hello_Base_stub
+ requires += dummy_label
+ libpaths += ../Hello_Base
+ IDL_Files {
+ }
+
+ Source_Files {
+ ReceiverC.cpp
+ }
+
+ Header_Files {
+ ReceiverC.h
+ Receiver_stub_export.h
+ }
+
+ Inline_Files {
+ ReceiverC.inl
+ }
+}
+
+project(Swapping_Hello_Receiver_svnt) : ciao_servant {
+ after += Swapping_Hello_Base_skel \
+ Swapping_Hello_Receiver_stub \
+ Swapping_Hello_Receiver_lem_gen
+ sharedname = Swapping_Receiver_svnt
+ libs += Swapping_Receiver_stub \
+ Swapping_Hello_Base_skel \
+ Swapping_Hello_Base_stub
+ libpaths += ../Hello_Base
+ dynamicflags = RECEIVER_SVNT_BUILD_DLL
+ requires += dummy_label
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ ReceiverEC.cpp
+ ReceiverS.cpp
+ Receiver_svnt.cpp
+ }
+
+ Header_Files {
+ ReceiverEC.h
+ SenderS.h
+ Sender_svnt.h
+ Sender_svnt_export.h
+ }
+
+ Inline_Files {
+ ReceiverEC.inl
+ ReceiverS.inl
+ }
+}
+
+
+project(Swapping_Hello_Receiver_exec) : ciao_executor {
+ after += Swapping_Hello_Receiver_svnt
+ sharedname = Swapping_Receiver_exec
+ libs += Swapping_Receiver_stub \
+ Swapping_Receiver_svnt \
+ Swapping_Hello_Base_skel \
+ Swapping_Hello_Base_stub
+ libpaths += ../Hello_Base
+
+ requires += dummy_label
+ dynamicflags = RECEIVER_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Receiver_exec.cpp
+ }
+
+ Header_Files {
+ Receiver_exec.h
+ Receiver_exec_export.h
+ }
+
+ Inline_Files {
+ }
+}
diff --git a/modules/CIAO/examples/Swapping/Receiver/Receiver_exec.cpp b/modules/CIAO/examples/Swapping/Receiver/Receiver_exec.cpp
new file mode 100644
index 00000000000..6a8e0405bfa
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Receiver/Receiver_exec.cpp
@@ -0,0 +1,161 @@
+//$Id$
+/*
+ * @file Receiver_exec.cpp
+ *
+ * @author Tao Lu <lu@dre.vanderbilt.edu>
+ */
+
+#include "Receiver_exec.h"
+#include "CIAO_common.h"
+
+namespace CIDL_Receiver_Impl
+{
+ ReceiverSwap_exec_i::ReceiverSwap_exec_i ()
+ {
+ }
+
+ ReceiverSwap_exec_i::~ReceiverSwap_exec_i ()
+ {
+ }
+
+ ::Components::EnterpriseComponent_ptr
+ ReceiverSwap_exec_i::incarnate ()
+ {
+ return new Receiver_exec_i;
+ }
+
+ ::Components::EnterpriseComponent_ptr
+ ReceiverSwap_exec_i::etherealize ()
+ {
+ return new Receiver_exec_i;
+ }
+
+ Receiver_exec_i::Receiver_exec_i ()
+ {
+ }
+
+ Receiver_exec_i::~Receiver_exec_i ()
+ {
+ }
+
+ void
+ Receiver_exec_i::push_click_in (Hello::TimeOut *)
+ {
+ //Get the message from the Sender first.
+ ACE_DEBUG ((LM_DEBUG,
+ "Receiver - Informed by the Sender\n"));
+
+ Hello::ReadMessage_var rev
+ = this->context_->get_connection_read_message
+ ();
+
+ if (CORBA::is_nil (rev.in ()))
+ {
+ throw CORBA::BAD_INV_ORDER ();
+ }
+
+ CORBA::String_var str =
+ rev->get_message ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Receiver - Got message from the server [%s]\n",
+ str.in () ));
+ }
+
+ // Operations from Components::SessionComponen
+ void
+ Receiver_exec_i::set_session_context (Components::SessionContext_ptr ctx)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::set_session_context\n"));
+
+ this->context_ =
+ Receiver_Exec_Context::_narrow (ctx);
+
+ if (CORBA::is_nil (this->context_.in ()))
+ {
+ throw CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Receiver_exec_i::configuration_complete ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Receiver_exec_i::configuration_complete\n"));
+ }
+
+ void
+ Receiver_exec_i::ccm_activate ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_activate\n"));
+ }
+
+ void
+ Receiver_exec_i::ccm_passivate ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_passivate\n"));
+ /*
+ CORBA::Object_var comp_object =
+ this->context_->get_CCM_object ();
+
+ Hello::Receiver_var receiver = Hello::Receiver::_narrow (comp_object.in ());
+
+ ::Components::ConsumerDescriptions_var cons_desc =
+ receiver->get_all_consumers ();
+
+ ::Components::FacetDescriptions_var facet_desc =
+ receiver->get_all_facets ();
+
+ CORBA::ULong cons_len = cons_desc->length ();
+ CORBA::ULong facet_len = facet_desc->length ();
+ for (CORBA::ULong i = 0; i < cons_len; ++i)
+ {
+ // ACE_DEBUG ((LM_DEBUG, "consumer name is %s\n", cons_desc[i]->name ()));
+ }
+ for (CORBA::ULong i = 0; i < facet_len; ++i)
+ {
+ // ACE_DEBUG ((LM_DEBUG, "facet name is %s\n", facet_desc[i]->name ()));
+ }
+ */
+ }
+
+ void
+ Receiver_exec_i::ccm_remove ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_remove\n"));
+ }
+
+
+ ReceiverHome_exec_i::ReceiverHome_exec_i ()
+ {
+ }
+
+ ReceiverHome_exec_i::~ReceiverHome_exec_i ()
+ {
+ }
+
+ ::Components::EnterpriseComponent_ptr
+ ReceiverHome_exec_i::create ()
+ {
+ Components::EnterpriseComponent_ptr tmp;
+
+ ACE_NEW_THROW_EX (tmp,
+ ReceiverSwap_exec_i,
+ CORBA::NO_MEMORY ());
+
+ /*
+ ACE_NEW_THROW_EX (tmp,
+ Receiver_exec_i,
+ CORBA::NO_MEMORY ());
+ */
+
+ return tmp;
+ }
+
+ extern "C" RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr
+ createReceiverHome_Impl (void)
+ {
+ return new ReceiverHome_exec_i ();
+ }
+}
+
diff --git a/modules/CIAO/examples/Swapping/Receiver/Receiver_exec.h b/modules/CIAO/examples/Swapping/Receiver/Receiver_exec.h
new file mode 100644
index 00000000000..42399771078
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Receiver/Receiver_exec.h
@@ -0,0 +1,105 @@
+//$Id$:
+//============================================================
+/**
+ * @file Receiver_exec.h
+ *
+ * Header file for the Executor implementation.
+ */
+//============================================================
+
+#ifndef RECEIVER_EXEC_H
+#define RECEIVER_EXEC_H
+
+#include "ciao/Servants/Swapping/CIAO_SwapExecC.h"
+#include "ReceiverEC.h"
+#include "Receiver_exec_export.h"
+#include "tao/LocalObject.h"
+
+namespace CIDL_Receiver_Impl
+{
+
+ /**
+ * @class Receiver_exec_i
+ *
+ * Receiver executor implementation class.
+ */
+
+ class RECEIVER_EXEC_Export ReceiverSwap_exec_i :
+ public virtual CIAO::Swap_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ ReceiverSwap_exec_i ();
+
+ ~ReceiverSwap_exec_i ();
+
+ virtual ::Components::EnterpriseComponent_ptr
+ incarnate ();
+
+ virtual ::Components::EnterpriseComponent_ptr
+ etherealize ();
+ };
+
+ class RECEIVER_EXEC_Export Receiver_exec_i :
+ public virtual Receiver_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+
+ public:
+ /// Default constructor.
+ Receiver_exec_i ();
+
+ /// Default destructor.
+ ~Receiver_exec_i ();
+
+ // Operation which will be called upon receiving the timeout event.
+ virtual void
+ push_click_in (Hello::TimeOut *ev);
+
+ // Operations from Components::SessionComponent
+ virtual void set_session_context (Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete ();
+
+ virtual void ccm_activate ();
+
+ virtual void ccm_passivate ();
+
+ virtual void ccm_remove ();
+
+ protected:
+ /// Copmponent specific context
+ Receiver_Exec_Context_var context_;
+ private:
+ CORBA::String_var message_;
+ };
+
+ /**
+ * @class ReceiverHome_exec_i
+ *
+ * Receiver home executor implementation class.
+ */
+ class RECEIVER_EXEC_Export ReceiverHome_exec_i :
+ public virtual ReceiverHome_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ /// Default ctor.
+ ReceiverHome_exec_i ();
+
+ /// Default dtor.
+ ~ReceiverHome_exec_i ();
+
+ // Implicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ create ();
+ };
+
+ extern "C" RECEIVER_EXEC_Export ::Components::HomeExecutorBase_ptr
+ createReceiverHome_Impl (void);
+}
+
+#endif /* RECEIVER_EXEC_H */
+
+
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender.idl b/modules/CIAO/examples/Swapping/Sender/Sender.idl
new file mode 100644
index 00000000000..e2c8ca64b0e
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender.idl
@@ -0,0 +1,32 @@
+//$Id$
+
+#ifndef CIAO_SENDER_IDL
+#define CIAO_SENDER_IDL
+
+
+#include "../Hello_Base/Hello_Base.idl"
+
+module Hello
+{
+ /* This is a Sender specific interface which will be used to get the
+ * process start.
+ */
+
+ interface trigger
+ {
+ void start ();
+ };
+
+ component Sender supports trigger
+ {
+ provides ReadMessage push_message;
+ publishes TimeOut click_out;
+ attribute string local_message;
+ };
+
+ home SenderHome manages Sender
+ {
+ };
+
+};
+#endif /*CIAO_SENDER_IDL*/
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender.mpc b/modules/CIAO/examples/Swapping/Sender/Sender.mpc
new file mode 100644
index 00000000000..fb17f87da74
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender.mpc
@@ -0,0 +1,191 @@
+// $Id$
+// This file is generated with "generate_component_mpc_extra.pl -p Hello_Base Sender"
+
+project(Swapping_Hello_Sender_idl_gen) : componentidldefaults {
+ custom_only = 1
+ idlflags += -Wb,stub_export_macro=SENDER_STUB_Export \
+ -Wb,stub_export_include=Sender_stub_export.h \
+ -Wb,skel_export_macro=SENDER_SVNT_Export \
+ -Wb,skel_export_include=Sender_svnt_export.h \
+ -Wb,exec_export_macro=SENDER_EXEC_Export \
+ -Wb,exec_export_include=Sender_exec_export.h
+
+ IDL_Files {
+ Sender.idl
+ }
+}
+
+project(Swapping_Hello_Sender_lem_gen) : ciaoidldefaults {
+ custom_only = 1
+ after += Swapping_Hello_Sender_idl_gen
+ idlflags += -Wb,export_macro=SENDER_SVNT_Export \
+ -Wb,export_include=Sender_svnt_export.h \
+ -SS
+
+ IDL_Files {
+ SenderE.idl
+ }
+}
+
+project(Swapping_Hello_Sender_stub): ccm_stub {
+ requires += dummy_label
+ libpaths += ../Hello_Base
+ after += Swapping_Hello_Base_stub \
+ Swapping_Hello_Sender_idl_gen
+ sharedname = Swapping_Sender_stub
+ dynamicflags = SENDER_STUB_BUILD_DLL
+ libs += Swapping_Hello_Base_stub
+ requires += dummy_label
+ IDL_Files {
+ }
+
+ Source_Files {
+ SenderC.cpp
+ }
+
+ Header_Files {
+ SenderC.h
+ Sender_stub_export.h
+ }
+
+ Inline_Files {
+ SenderC.inl
+ }
+}
+
+project(Swapping_Hello_Sender_svnt) : ciao_servant {
+ requires += dummy_label
+ libpaths += ../Hello_Base
+ after += Swapping_Hello_Base_skel \
+ Swapping_Hello_Sender_stub \
+ Swapping_Hello_Sender_lem_gen
+ sharedname = Swapping_Sender_svnt
+ libs += Swapping_Sender_stub \
+ Swapping_Hello_Base_skel \
+ Swapping_Hello_Base_stub
+
+ dynamicflags = SENDER_SVNT_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ SenderEC.cpp
+ SenderS.cpp
+ Sender_svnt.cpp
+ }
+
+ Header_Files {
+ SenderEC.h
+ SenderS.h
+ Sender_svnt.h
+ Sender_svnt_export.h
+ }
+
+ Inline_Files {
+ SenderEC.inl
+ SenderS.inl
+ }
+}
+
+project(Swapping_Hello_Sender_exec) : ciao_executor {
+ requires += dummy_label
+ after += Swapping_Hello_Sender_svnt
+ sharedname = Swapping_Sender_exec
+ libs += Swapping_Sender_svnt \
+ Swapping_Sender_stub \
+ Swapping_Hello_Base_skel \
+ Swapping_Hello_Base_stub
+ libpaths += ../Hello_Base
+
+ dynamicflags = SENDER_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Sender_exec.cpp
+ }
+
+ Header_Files {
+ Sender_exec.h
+ Sender_exec_export.h
+ }
+}
+
+project(Swapping_Hello_Sender_exec_1) : ciao_executor {
+ requires += dummy_label
+ after += Swapping_Hello_Sender_exec
+ sharedname = Swapping_Sender_exec_1
+ libs += Swapping_Sender_exec \
+ Swapping_Sender_svnt \
+ Swapping_Sender_stub \
+ Swapping_Hello_Base_skel \
+ Swapping_Hello_Base_stub
+ libpaths += ../Hello_Base
+
+ dynamicflags = SENDER_EXEC_1_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Sender_exec_1.cpp
+ }
+
+ Header_Files {
+ Sender_exec_1.h
+ Sender_exec_1_export.h
+ }
+}
+
+project(Swapping_Hello_Sender_exec_2) : ciao_executor {
+ requires += dummy_label
+ after += Swapping_Hello_Sender_exec
+ sharedname = Swapping_Sender_exec_2
+ libs += Swapping_Sender_exec \
+ Swapping_Sender_svnt \
+ Swapping_Sender_stub \
+ Swapping_Hello_Base_skel \
+ Swapping_Hello_Base_stub
+ libpaths += ../Hello_Base
+
+ dynamicflags = SENDER_EXEC_2_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ Sender_exec_2.cpp
+ }
+
+ Header_Files {
+ Sender_exec_2.h
+ Sender_exec_2_export.h
+ }
+
+ Inline_Files {
+ }
+}
+
+project (Swapping_Hello_Starter) : ccm_stub, valuetype {
+ requires += dummy_label
+ exename = Upgradeable_starter
+ after += Swapping_Hello_Sender_stub
+ libs += Swapping_Sender_stub \
+ Swapping_Hello_Base_stub
+ libpaths += ../Hello_Base
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ starter.cpp
+ }
+
+ Header_Files {
+ }
+
+ Inline_Files {
+ }
+}
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec.cpp b/modules/CIAO/examples/Swapping/Sender/Sender_exec.cpp
new file mode 100644
index 00000000000..33869f3d770
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec.cpp
@@ -0,0 +1,189 @@
+//$Id$
+
+#include "Sender_exec.h"
+
+const char* first_exe_dll_name = "Sender_DnC_exec_1";
+const char* first_exe_entrypt = "createSenderExec_Impl";
+const char* second_exe_dll_name = "Sender_DnC_exec_2";
+const char* second_exe_entrypt = "createSenderExec_Impl";
+
+namespace CIDL_Sender_Impl
+{
+ char*
+ Message_Impl::get_message ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender sending out message.\n"));
+ return CORBA::string_dup (component_.message_.in ());
+ }
+
+ Sender_exec_i::~Sender_exec_i ()
+ {
+ }
+
+ void
+ Sender_exec_i::local_message (const char * local_message)
+ {
+ message_ = CORBA::string_dup (local_message);
+ }
+
+ char *
+ Sender_exec_i::local_message ()
+ {
+ return CORBA::string_dup(message_. in());
+ }
+
+ Hello::CCM_ReadMessage_ptr
+ Sender_exec_i::get_push_message ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec.i::get_push_message called\n"));
+ return ( new Message_Impl (*this) );
+ }
+
+ void
+ Sender_exec_i::start ()
+ {
+ Hello::TimeOut_var event = new OBV_Hello::TimeOut;
+ ACE_DEBUG ((LM_DEBUG, "Sender initiates the process.\n"));
+ this->context_->push_click_out (event);
+ }
+
+ void
+ Sender_exec_i::set_session_context (Components::SessionContext_ptr ctx)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::set_session_context\n"));
+
+ this->context_ =
+ Sender_Exec_Context::_narrow (ctx);
+
+ if (CORBA::is_nil (this->context_.in ()))
+ {
+ throw CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Sender_exec_i::configuration_complete ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_i::configuration_complete\n"));
+ }
+
+ void
+ Sender_exec_i::ccm_activate ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_i::ccm_activate\n"));
+ }
+
+ void
+ Sender_exec_i::ccm_passivate ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::ccm_passivate\n"));
+ }
+
+ void
+ Sender_exec_i::ccm_remove ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::ccm_remove\n"));
+ }
+
+
+ SenderHome_exec_i::SenderHome_exec_i ()
+ {
+ }
+
+ SenderHome_exec_i::~SenderHome_exec_i ()
+ {
+ }
+
+ SenderSwap_exec_i::SenderSwap_exec_i ()
+ : count_ (0)
+ {
+ }
+
+ SenderSwap_exec_i::~SenderSwap_exec_i ()
+ {
+ }
+
+ ::Components::EnterpriseComponent_ptr
+ SenderSwap_exec_i::incarnate ()
+ {
+ ExecFactory first_exec_creator = 0;
+ ExecFactory second_exec_creator = 0;
+ ACE_DLL first_dll, second_dll;
+
+ if (first_dll.open (first_exe_dll_name,
+ ACE_DEFAULT_SHLIB_MODE, 0) != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Could not open the DLL %s\n", first_exe_dll_name));
+ return 0;
+ }
+
+ if (second_dll.open (second_exe_dll_name,
+ ACE_DEFAULT_SHLIB_MODE, 0) != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Could not open the DLL %s\n",
+ second_exe_dll_name));
+ return 0;
+ }
+
+ if (first_exe_entrypt == 0 || second_exe_entrypt == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "NIL entry points\n"));
+ return 0;
+ }
+
+ void *void_ptr = 0;
+ ptrdiff_t tmp = 0;
+
+ if (0 == this->count_)
+ {
+ // Cast the void* to non-pointer type first - it's not legal to
+ // cast a pointer-to-object directly to a pointer-to-function.
+ void_ptr = first_dll.symbol (first_exe_entrypt);
+ tmp = reinterpret_cast<ptrdiff_t> (void_ptr);
+ first_exec_creator = reinterpret_cast<ExecFactory> (tmp);
+
+ Components::EnterpriseComponent_var first_executor =
+ first_exec_creator (this);
+ count_++;
+ return first_executor._retn ();
+ }
+ else if (-1 == count_)
+ {
+ // Cast the void* to non-pointer type first - it's not legal to
+ // cast a pointer-to-object directly to a pointer-to-function.
+ void_ptr = second_dll.symbol (second_exe_entrypt);
+ tmp = reinterpret_cast<ptrdiff_t> (void_ptr);
+ second_exec_creator = reinterpret_cast<ExecFactory> (tmp);
+
+ Components::EnterpriseComponent_var second_executor =
+ second_exec_creator (this);
+ --count_;
+ return second_executor._retn ();
+ }
+
+ return 0;
+ }
+
+ ::Components::EnterpriseComponent_ptr
+ SenderSwap_exec_i::etherealize ()
+ {
+ return 0;
+ }
+
+ ::Components::EnterpriseComponent_ptr
+ SenderHome_exec_i::create ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "%P|%t) creating SenderHome\n"));
+ return new SenderSwap_exec_i;
+ }
+
+ extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr
+ createSenderHome_Impl (void)
+ {
+ return new SenderHome_exec_i ();
+ }
+}
+
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec.h b/modules/CIAO/examples/Swapping/Sender/Sender_exec.h
new file mode 100644
index 00000000000..773777640ec
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec.h
@@ -0,0 +1,170 @@
+//$Id$
+//============================================================
+/**
+ * @file Sender_exec.h
+ *
+ * Header file for the Executor implementation.
+ */
+//============================================================
+
+#ifndef SENDER_EXEC_H
+#define SENDER_EXEC_H
+
+#include "ciao/Servants/Swapping/CIAO_SwapExecC.h"
+#include "SenderEC.h"
+#include "Sender_exec_export.h"
+#include "tao/LocalObject.h"
+#include "ace/DLL.h"
+#include "ciao/CCM_EventsC.h"
+
+namespace CIDL_Sender_Impl
+{
+ class SENDER_EXEC_Export Sender_exec_i :
+ public virtual Sender_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+
+ public:
+ /// Default constructor.
+ Sender_exec_i ()
+ : message_(CORBA::string_dup ("Default Message"))
+ {
+ }
+
+ /// Secondary construction.
+ Sender_exec_i (const char* local_message)
+ : message_ (CORBA::string_dup (local_message))
+ {
+ }
+
+ /// Default destructor.
+ virtual ~Sender_exec_i ();
+
+ /// Operation to set the value of the attribute
+ virtual void local_message (const char * local_message);
+
+ /// Operation to get the value of the attribute
+ virtual char * local_message ();
+
+ /* Operations for obtaining the interface reference. */
+ /* This method will be used in the assembly face so the
+ * ObjRef of this read_message facet will be sent to the
+ * client side(receptacle).
+ */
+ // Note: You can specify the return type as ::Hello::CCM_message *
+ virtual Hello::CCM_ReadMessage_ptr
+ get_push_message ();
+
+
+ // Operation inside of the trigger interface.
+ virtual void start ();
+
+ // Operations from Components::SessionComponent
+ virtual void set_session_context (Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete ();
+
+ virtual void ccm_activate ();
+
+ virtual void ccm_passivate ();
+
+ virtual void ccm_remove ();
+
+ protected:
+ /// Copmponent specific context
+ Sender_Exec_Context_var context_;
+
+ private:
+ CORBA::String_var message_;
+
+ friend class Message_Impl;
+ };
+
+
+ //
+ //
+ //
+ class Message_Impl : public virtual Hello::CCM_ReadMessage,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Message_Impl (Sender_exec_i& component)
+ : component_ (component)
+ {
+ }
+
+ virtual char *
+ get_message ();
+
+ private:
+ Sender_exec_i& component_;
+ };
+
+ class SenderSwap_exec_i;
+
+
+ typedef ::Components::EnterpriseComponent_ptr (*ExecFactory) (SenderSwap_exec_i *);
+
+ /**
+ * @class Sender_exec_i
+ *
+ * Sender executor implementation class.
+ */
+
+ class SENDER_EXEC_Export SenderSwap_exec_i :
+ public virtual CIAO::Swap_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ SenderSwap_exec_i ();
+
+ ~SenderSwap_exec_i ();
+
+ virtual ::Components::EnterpriseComponent_ptr
+ incarnate ();
+
+ virtual ::Components::EnterpriseComponent_ptr
+ etherealize ();
+
+ void consumers (::Components::ConsumerDescriptions *p)
+ {
+ this->consumers_ = p;
+ }
+
+ ::Components::ConsumerDescriptions *consumers (void)
+ {
+ return this->consumers_._retn ();
+ }
+
+ protected:
+ int count_;
+
+ ::Components::ConsumerDescriptions_var consumers_;
+ };
+
+ class SENDER_EXEC_Export SenderHome_exec_i :
+ public virtual SenderHome_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ /// Default ctor.
+ SenderHome_exec_i ();
+
+ /// Default dtor.
+ virtual ~SenderHome_exec_i ();
+
+ // Implicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ create ();
+
+
+ };
+
+ extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr
+ createSenderHome_Impl (void);
+}
+
+#endif /* SENDER_EXEC_H */
+
+
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec_1.cpp b/modules/CIAO/examples/Swapping/Sender/Sender_exec_1.cpp
new file mode 100644
index 00000000000..44983d856f7
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec_1.cpp
@@ -0,0 +1,133 @@
+//$Id$
+
+#include "Sender_exec_1.h"
+#include "Sender_exec.h"
+#include "ciao/Servant_Activator.h"
+
+namespace CIDL_Sender_Impl
+{
+ char*
+ Message_Impl_1::get_message ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender 1 sending out message.\n"));
+ return CORBA::string_dup (component_.message_.in ());
+ }
+
+ Sender_exec_1_i::~Sender_exec_1_i ()
+ {
+ }
+
+ void
+ Sender_exec_1_i::local_message (const char * local_message)
+ {
+ message_ = CORBA::string_dup (local_message);
+ }
+
+ char *
+ Sender_exec_1_i::local_message ()
+ {
+ return CORBA::string_dup(message_.in ());
+ }
+
+ Hello::CCM_ReadMessage_ptr
+ Sender_exec_1_i::get_push_message ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_1_i::get_push_message called\n"));
+ return ( new Message_Impl_1 (*this) );
+ }
+
+ void
+ Sender_exec_1_i::start ()
+ {
+ Hello::TimeOut_var event = new OBV_Hello::TimeOut;
+ ACE_DEBUG ((LM_DEBUG, "Sender 1 initiates the process.\n"));
+ this->context_->push_click_out (event);
+ }
+
+ void
+ Sender_exec_1_i::set_session_context (Components::SessionContext_ptr ctx)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_1_i::set_session_context\n"));
+
+ this->context_ =
+ Sender_Exec_Context::_narrow (ctx);
+
+ if (CORBA::is_nil (this->context_.in ()))
+ {
+ throw CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Sender_exec_1_i::configuration_complete ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_1_i::configuration_complete\n"));
+ }
+
+ void
+ Sender_exec_1_i::ccm_activate ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_1_i::ccm_activate\n"));
+
+ CORBA::Object_var o =
+ this->context_->get_CCM_object ();
+ }
+
+ void
+ Sender_exec_1_i::ccm_passivate ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_1_i::ccm_passivate\n"));
+
+ Components::ConsumerDescriptions_var retval =
+ this->context_->get_registered_consumers ("click_out");
+
+ this->base_exec_->consumers (retval._retn ());
+
+ CORBA::Object_var o =
+ this->context_->get_CCM_object ();
+
+ Hello::Sender_var sender =
+ Hello::Sender::_narrow (o.in ());
+
+ Components::FacetDescriptions_var facets =
+ sender->get_all_facets ();
+
+ const CORBA::ULong facet_len = facets->length ();
+ CORBA::ULong i = 0;
+
+ for (i = 0; i < facet_len; ++i)
+ {
+ this->context_->remove_facet (facets[i]->facet_ref ());
+ /*
+ this->context_->update_port_activator (oid);
+
+ this->context_->deactivate_facet (oid);
+ */
+ }
+
+ /*
+ this->context_->deactivate_facet ("Hello_Sender_push_message");
+ this->context_->update_port_activator ("Hello_Sender_push_message");
+ */
+ }
+
+ void
+ Sender_exec_1_i::ccm_remove ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_1_i::ccm_remove\n"));
+ }
+
+ extern "C" SENDER_EXEC_1_Export ::Components::EnterpriseComponent_ptr
+ createSenderExec_Impl (SenderSwap_exec_i *p)
+ {
+ Sender_exec_1_i *tmp = new Sender_exec_1_i ();
+
+ tmp->swap_exec (p);
+
+ return tmp;
+ }
+}
+
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec_1.h b/modules/CIAO/examples/Swapping/Sender/Sender_exec_1.h
new file mode 100644
index 00000000000..186862097ae
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec_1.h
@@ -0,0 +1,111 @@
+//$Id$
+//============================================================
+/**
+ * @file Sender_exec_1.h
+ *
+ * Header file for the Executor implementation.
+ */
+//============================================================
+
+#ifndef SENDER_EXEC_1_H
+#define SENDER_EXEC_1_H
+
+#include "ciao/Servants/Swapping/CIAO_SwapExecC.h"
+#include "SenderEC.h"
+#include "Sender_exec_1_export.h"
+#include "tao/LocalObject.h"
+
+namespace CIDL_Sender_Impl
+{
+ class SenderSwap_exec_i;
+
+
+ class SENDER_EXEC_1_Export Sender_exec_1_i :
+ public virtual Sender_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+
+ public:
+ /// Default constructor.
+ Sender_exec_1_i () {};
+
+ /// Secondary construction.
+ Sender_exec_1_i (const char* local_message,
+ SenderSwap_exec_i *e)
+ : message_ (CORBA::string_dup (local_message))
+ , base_exec_ (e)
+ {
+ }
+
+ /// Default destructor.
+ virtual ~Sender_exec_1_i ();
+
+ /// Operation to set the value of the attribute
+ virtual void local_message (const char * local_message);
+
+ /// Operation to get the value of the attribute
+ virtual char * local_message ();
+
+ /* Operations for obtaining the interface reference. */
+ /* This method will be used in the assembly face so the
+ * ObjRef of this read_message facet will be sent to the
+ * client side(receptacle).
+ */
+ // Note: You can specify the return type as ::Hello::CCM_message *
+ virtual Hello::CCM_ReadMessage_ptr
+ get_push_message ();
+
+
+ // Operation inside of the trigger interface.
+ virtual void start ();
+
+ // Operations from Components::SessionComponent
+ virtual void set_session_context (Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete ();
+
+ virtual void ccm_activate ();
+
+ virtual void ccm_passivate ();
+
+ virtual void ccm_remove ();
+
+ void swap_exec (SenderSwap_exec_i *p)
+ {
+ this->base_exec_ = p;
+ }
+
+ protected:
+ /// Copmponent specific context
+ Sender_Exec_Context_var context_;
+
+ private:
+ CORBA::String_var message_;
+
+ // my incarnator
+ SenderSwap_exec_i *base_exec_;
+
+ friend class Message_Impl_1;
+ };
+
+ class Message_Impl_1 : public virtual Hello::CCM_ReadMessage,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Message_Impl_1 (Sender_exec_1_i& component)
+ : component_ (component)
+ {
+ }
+
+ virtual char *
+ get_message ();
+
+ private:
+ Sender_exec_1_i& component_;
+ };
+
+ extern "C" SENDER_EXEC_1_Export ::Components::EnterpriseComponent_ptr
+ createSenderExec_Impl (SenderSwap_exec_i *p);
+}
+
+#endif /* SENDER_EXEC_H */
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec_1_export.h b/modules/CIAO/examples/Swapping/Sender/Sender_exec_1_export.h
new file mode 100644
index 00000000000..f67ed268717
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec_1_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl SENDER_EXEC_1
+// ------------------------------
+#ifndef SENDER_EXEC_1_EXPORT_H
+#define SENDER_EXEC_1_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (SENDER_EXEC_1_HAS_DLL)
+# define SENDER_EXEC_1_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && SENDER_EXEC_1_HAS_DLL */
+
+#if !defined (SENDER_EXEC_1_HAS_DLL)
+# define SENDER_EXEC_1_HAS_DLL 1
+#endif /* ! SENDER_EXEC_1_HAS_DLL */
+
+#if defined (SENDER_EXEC_1_HAS_DLL) && (SENDER_EXEC_1_HAS_DLL == 1)
+# if defined (SENDER_EXEC_1_BUILD_DLL)
+# define SENDER_EXEC_1_Export ACE_Proper_Export_Flag
+# define SENDER_EXEC_1_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define SENDER_EXEC_1_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* SENDER_EXEC_1_BUILD_DLL */
+# define SENDER_EXEC_1_Export ACE_Proper_Import_Flag
+# define SENDER_EXEC_1_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define SENDER_EXEC_1_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* SENDER_EXEC_1_BUILD_DLL */
+#else /* SENDER_EXEC_1_HAS_DLL == 1 */
+# define SENDER_EXEC_1_Export
+# define SENDER_EXEC_1_SINGLETON_DECLARATION(T)
+# define SENDER_EXEC_1_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* SENDER_EXEC_1_HAS_DLL == 1 */
+
+// Set SENDER_EXEC_1_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (SENDER_EXEC_1_NTRACE)
+# if (ACE_NTRACE == 1)
+# define SENDER_EXEC_1_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define SENDER_EXEC_1_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !SENDER_EXEC_1_NTRACE */
+
+#if (SENDER_EXEC_1_NTRACE == 1)
+# define SENDER_EXEC_1_TRACE(X)
+#else /* (SENDER_EXEC_1_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define SENDER_EXEC_1_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (SENDER_EXEC_1_NTRACE == 1) */
+
+#endif /* SENDER_EXEC_1_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec_2.cpp b/modules/CIAO/examples/Swapping/Sender/Sender_exec_2.cpp
new file mode 100644
index 00000000000..89332c825b2
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec_2.cpp
@@ -0,0 +1,125 @@
+//$Id$
+
+#include "Sender_exec_2.h"
+#include "Sender_exec.h"
+
+namespace CIDL_Sender_Impl
+{
+ char*
+ Message_Impl_2::get_message ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender 2 sending out message.\n"));
+ return CORBA::string_dup (component_.message_.in ());
+ }
+
+ Sender_exec_2_i::~Sender_exec_2_i ()
+ {
+ }
+
+ void
+ Sender_exec_2_i::local_message (const char * local_message)
+ {
+ message_ = CORBA::string_dup (local_message);
+ }
+
+ char *
+ Sender_exec_2_i::local_message ()
+ {
+ return CORBA::string_dup(message_.in ());
+ }
+
+ Hello::CCM_ReadMessage_ptr
+ Sender_exec_2_i::get_push_message ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_2_i::get_push_message called\n"));
+ return ( new Message_Impl_2 (*this) );
+ }
+
+ void
+ Sender_exec_2_i::start ()
+ {
+ Hello::TimeOut_var event = new OBV_Hello::TimeOut;
+ ACE_DEBUG ((LM_DEBUG, "Sender 2 initiates the process.\n"));
+ this->context_->push_click_out (event);
+ }
+
+ void
+ Sender_exec_2_i::set_session_context (Components::SessionContext_ptr ctx)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_2_i::set_session_context\n"));
+
+ this->context_ =
+ Sender_Exec_Context::_narrow (ctx);
+
+ if (CORBA::is_nil (this->context_.in ()))
+ {
+ throw CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ Sender_exec_2_i::configuration_complete ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_2_i::configuration_complete\n"));
+ }
+
+ void
+ Sender_exec_2_i::ccm_activate ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_2_i::ccm_activate\n"));
+
+ ::Components::ConsumerDescriptions_var c =
+ this->base_exec_->consumers ();
+
+ if (CORBA::is_nil (this->context_.in ()))
+ {
+ throw CORBA::INTERNAL ();
+ }
+
+ CORBA::Object_var o =
+ this->context_->get_CCM_object ();
+
+ Hello::Sender_var sender =
+ Hello::Sender::_narrow (o.in ());
+
+ for (CORBA::ULong cnt = 0; cnt != c->length (); ++cnt)
+ {
+ sender->subscribe ("click_out",
+ (*c)[cnt]->consumer ());
+ }
+ }
+
+ void
+ Sender_exec_2_i::ciao_postactivate ()
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sender_exec_2_i::ciao_postactivate\n"));
+ }
+
+ void
+ Sender_exec_2_i::ccm_passivate ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_2_i::ccm_passivate\n"));
+ }
+
+ void
+ Sender_exec_2_i::ccm_remove ()
+ {
+ ACE_DEBUG ((LM_DEBUG, "Sender_exec_2_i::ccm_remove\n"));
+ }
+
+ extern "C" SENDER_EXEC_2_Export ::Components::EnterpriseComponent_ptr
+ createSenderExec_Impl (SenderSwap_exec_i *p)
+ {
+ Sender_exec_2_i *tmp =
+ new Sender_exec_2_i ();
+
+ tmp->swap_exec (p);
+
+ return tmp;
+ }
+}
+
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec_2.h b/modules/CIAO/examples/Swapping/Sender/Sender_exec_2.h
new file mode 100644
index 00000000000..8f590001cad
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec_2.h
@@ -0,0 +1,112 @@
+//$Id$
+//============================================================
+/**
+ * @file Sender_exec_2.h
+ *
+ * Header file for the Executor implementation.
+ */
+//============================================================
+
+#ifndef SENDER_EXEC_2_H
+#define SENDER_EXEC_2_H
+
+#include "ciao/Servants/Swapping/CIAO_SwapExecC.h"
+#include "SenderEC.h"
+#include "Sender_exec_2_export.h"
+#include "tao/LocalObject.h"
+
+namespace CIDL_Sender_Impl
+{
+ class SenderSwap_exec_i;
+
+ class SENDER_EXEC_2_Export Sender_exec_2_i :
+ public virtual Sender_Exec,
+ public virtual ::CORBA::LocalObject
+ {
+
+ public:
+ /// Default constructor.
+ Sender_exec_2_i ()
+ : message_(CORBA::string_dup ("Default Message"))
+ {
+ }
+
+ /// Secondary construction.
+ Sender_exec_2_i (const char* local_message,
+ SenderSwap_exec_i *e)
+ : message_ (CORBA::string_dup (local_message))
+ , base_exec_ (e)
+ {
+ }
+
+ /// Default destructor.
+ virtual ~Sender_exec_2_i ();
+
+ /// Operation to set the value of the attribute
+ virtual void local_message (const char * local_message);
+
+ /// Operation to get the value of the attribute
+ virtual char * local_message ();
+
+ /* Operations for obtaining the interface reference. */
+ /* This method will be used in the assembly face so the
+ * ObjRef of this read_message facet will be sent to the
+ * client side(receptacle).
+ */
+ // Note: You can specify the return type as ::Hello::CCM_message *
+ virtual Hello::CCM_ReadMessage_ptr
+ get_push_message ();
+
+
+ // Operation inside of the trigger interface.
+ virtual void start ();
+
+ // Operations from Components::SessionComponent
+ virtual void set_session_context (Components::SessionContext_ptr ctx);
+
+ virtual void configuration_complete ();
+
+ virtual void ccm_activate ();
+
+ virtual void ccm_passivate ();
+
+ virtual void ccm_remove ();
+
+ void swap_exec (SenderSwap_exec_i *p)
+ {
+ this->base_exec_ = p;
+ }
+
+ protected:
+ /// Copmponent specific context
+ Sender_Exec_Context_var context_;
+
+ private:
+ CORBA::String_var message_;
+
+ SenderSwap_exec_i *base_exec_;
+
+ friend class Message_Impl_2;
+ };
+
+ class Message_Impl_2 : public virtual Hello::CCM_ReadMessage,
+ public virtual ::CORBA::LocalObject
+ {
+ public:
+ Message_Impl_2 (Sender_exec_2_i& component)
+ : component_ (component)
+ {
+ }
+
+ virtual char *
+ get_message ();
+
+ private:
+ Sender_exec_2_i& component_;
+ };
+
+ extern "C" SENDER_EXEC_2_Export ::Components::EnterpriseComponent_ptr
+ createSenderExec_Impl (SenderSwap_exec_i *p);
+}
+
+#endif /* SENDER_EXEC_H */
diff --git a/modules/CIAO/examples/Swapping/Sender/Sender_exec_2_export.h b/modules/CIAO/examples/Swapping/Sender/Sender_exec_2_export.h
new file mode 100644
index 00000000000..5d76356bb04
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/Sender_exec_2_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl SENDER_EXEC_2
+// ------------------------------
+#ifndef SENDER_EXEC_2_EXPORT_H
+#define SENDER_EXEC_2_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (SENDER_EXEC_2_HAS_DLL)
+# define SENDER_EXEC_2_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && SENDER_EXEC_2_HAS_DLL */
+
+#if !defined (SENDER_EXEC_2_HAS_DLL)
+# define SENDER_EXEC_2_HAS_DLL 1
+#endif /* ! SENDER_EXEC_2_HAS_DLL */
+
+#if defined (SENDER_EXEC_2_HAS_DLL) && (SENDER_EXEC_2_HAS_DLL == 1)
+# if defined (SENDER_EXEC_2_BUILD_DLL)
+# define SENDER_EXEC_2_Export ACE_Proper_Export_Flag
+# define SENDER_EXEC_2_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define SENDER_EXEC_2_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* SENDER_EXEC_2_BUILD_DLL */
+# define SENDER_EXEC_2_Export ACE_Proper_Import_Flag
+# define SENDER_EXEC_2_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define SENDER_EXEC_2_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* SENDER_EXEC_2_BUILD_DLL */
+#else /* SENDER_EXEC_2_HAS_DLL == 1 */
+# define SENDER_EXEC_2_Export
+# define SENDER_EXEC_2_SINGLETON_DECLARATION(T)
+# define SENDER_EXEC_2_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* SENDER_EXEC_2_HAS_DLL == 1 */
+
+// Set SENDER_EXEC_2_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (SENDER_EXEC_2_NTRACE)
+# if (ACE_NTRACE == 1)
+# define SENDER_EXEC_2_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define SENDER_EXEC_2_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !SENDER_EXEC_2_NTRACE */
+
+#if (SENDER_EXEC_2_NTRACE == 1)
+# define SENDER_EXEC_2_TRACE(X)
+#else /* (SENDER_EXEC_2_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define SENDER_EXEC_2_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (SENDER_EXEC_2_NTRACE == 1) */
+
+#endif /* SENDER_EXEC_2_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/examples/Swapping/Sender/starter.cpp b/modules/CIAO/examples/Swapping/Sender/starter.cpp
new file mode 100644
index 00000000000..097fd46ec4e
--- /dev/null
+++ b/modules/CIAO/examples/Swapping/Sender/starter.cpp
@@ -0,0 +1,96 @@
+//$Id$:
+
+#include "SenderC.h"
+#include "ace/Get_Opt.h"
+
+//IOR file of the Sender
+const char * ior = 0;
+const char * message = "starters message";
+
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:m"));
+ int c = 0;
+
+ while ((c = get_opts ()) != -1)
+ {
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case 'm':
+ message = get_opts.opt_arg ();
+ break;
+
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s\n"
+ "-k <Sender IOR> (default is file://sender.ior)\n",
+ "-m <Message> (default is starters message)\n"
+ "\n",
+ argv [0]),
+ -1);
+ break;
+ }
+ }
+
+ if (ior == 0)
+ {
+ ior = "file://sender.ior";
+ }
+
+ return 0;
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ // Initialize orb
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) != 0)
+ {
+ return -1;
+ }
+
+ CORBA::Object_var obj =
+ orb->string_to_object (ior);
+
+ Hello::Sender_var sender = Hello::Sender::_narrow (obj.in ());
+
+ if (CORBA::is_nil (sender.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to acquire Sender's objref\n"),
+ -1);
+ }
+
+ char *return_message;
+ sender->local_message (message);
+ return_message = sender->local_message ();
+ ACE_DEBUG ((LM_DEBUG, "the message is %s\n", return_message));
+
+ sender->start ();
+ sender->remove ();
+
+ ACE_DEBUG ((LM_DEBUG, "creating one more servant here\n"));
+ sender->start ();
+ //sender->remove ();
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Unknown exception\n");
+ return -1;
+ }
+
+ return 0;
+}