summaryrefslogtreecommitdiff
path: root/CIAO/examples/BasicSP/EC
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/examples/BasicSP/EC')
-rw-r--r--CIAO/examples/BasicSP/EC/EC.cidl21
-rw-r--r--CIAO/examples/BasicSP/EC/EC.idl41
-rw-r--r--CIAO/examples/BasicSP/EC/EC.mpc113
-rw-r--r--CIAO/examples/BasicSP/EC/ECEI.idl32
-rw-r--r--CIAO/examples/BasicSP/EC/EC_exec.cpp273
-rw-r--r--CIAO/examples/BasicSP/EC/EC_exec.h167
-rw-r--r--CIAO/examples/BasicSP/EC/EC_exec_export.h58
-rw-r--r--CIAO/examples/BasicSP/EC/EC_stub_export.h58
-rw-r--r--CIAO/examples/BasicSP/EC/EC_svnt_export.h58
-rw-r--r--CIAO/examples/BasicSP/EC/README9
-rw-r--r--CIAO/examples/BasicSP/EC/client.cpp62
-rw-r--r--CIAO/examples/BasicSP/EC/controller.cpp128
12 files changed, 1020 insertions, 0 deletions
diff --git a/CIAO/examples/BasicSP/EC/EC.cidl b/CIAO/examples/BasicSP/EC/EC.cidl
new file mode 100644
index 00000000000..8e9ff0d5575
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC.cidl
@@ -0,0 +1,21 @@
+//$Id$
+
+#ifndef EC_CIDL
+#define EC_CIDL
+
+#include "EC.idl"
+
+composition session EC_Impl
+{
+ home executor ECHome_Exec
+ {
+ implements BasicSP::ECHome;
+ manages EC_Exec;
+ };
+};
+
+#endif /* EC_CIDL */
+
+
+
+
diff --git a/CIAO/examples/BasicSP/EC/EC.idl b/CIAO/examples/BasicSP/EC/EC.idl
new file mode 100644
index 00000000000..50ad25afd7f
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC.idl
@@ -0,0 +1,41 @@
+// $Id$
+//=============================================================================
+/**
+ * @file EC.idl
+ *
+ * Definition of events, and common interfaces used in the BasicSP module.
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef CIAO_EC_IDL
+#define CIAO_EC_IDL
+
+#include "../BasicSP.idl"
+
+module BasicSP
+{
+ interface trigger
+ {
+ void start ();
+ void stop ();
+ };
+ component EC supports trigger
+ {
+ publishes TimeOut timeout;
+
+ /// The attribute can be configured via the home or the
+ /// component property file.
+ attribute long hertz;
+
+ };
+
+ home ECHome manages EC
+ {
+ // Explicit operations
+ factory new_EC (in long hertz);
+ };
+};
+
+#endif /* CIAO_EC_IDL*/
diff --git a/CIAO/examples/BasicSP/EC/EC.mpc b/CIAO/examples/BasicSP/EC/EC.mpc
new file mode 100644
index 00000000000..d1068ec6e28
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC.mpc
@@ -0,0 +1,113 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl -l .. -p BasicSP -i -c EC"
+
+project(EC_DnC_stub): ciao_client_dnc {
+ avoids += ace_for_tao
+ after += BasicSP_DnC_stub
+
+ sharedname = EC_stub
+
+ idlflags += -Wb,stub_export_macro=EC_STUB_Export
+ idlflags += -Wb,stub_export_include=EC_stub_export.h
+ idlflags += -Wb,skel_export_macro=EC_SVNT_Export
+ idlflags += -Wb,skel_export_include=EC_svnt_export.h
+
+ dynamicflags = EC_STUB_BUILD_DLL
+
+ libs += BasicSP_stub
+
+ IDL_Files {
+ EC.idl
+ }
+
+ Source_Files {
+ ECC.cpp
+ }
+}
+
+project(EC_DnC_svnt) : ciao_servant_dnc {
+ avoids += ace_for_tao
+ after += BasicSP_DnC_svnt EC_DnC_stub
+ sharedname = EC_svnt
+
+ libpaths += ..
+
+ idlflags += -Wb,export_macro=EC_SVNT_Export
+ idlflags += -Wb,export_include=EC_svnt_export.h
+
+ dynamicflags = EC_SVNT_BUILD_DLL
+
+ libs += EC_stub BasicSP_stub BasicSP_svnt
+
+ CIDL_Files {
+ EC.cidl
+ }
+
+ IDL_Files {
+ ECE.idl
+ }
+
+ Source_Files {
+ ECEC.cpp
+ ECS.cpp
+ EC_svnt.cpp
+ }
+}
+
+
+project(EC_DnC_exec) : ciao_component_dnc {
+ avoids += ace_for_tao
+ after += EC_DnC_svnt
+ sharedname = EC_exec
+
+ libs += EC_stub BasicSP_stub BasicSP_svnt EC_svnt
+
+ libpaths += ..
+
+ idlflags += -Wb,export_macro=EC_EXEC_Export
+ idlflags += -Wb,export_include=EC_exec_export.h
+
+ dynamicflags = EC_EXEC_BUILD_DLL
+
+ IDL_Files {
+ ECEI.idl
+ }
+
+ Source_Files {
+ ECEIC.cpp
+ EC_exec.cpp
+ }
+}
+
+
+
+project (EC_DnC_client) : ciao_client_dnc, valuetype {
+ avoids += ace_for_tao
+ exename = client
+ after += EC_DnC_stub
+ libs += EC_stub BasicSP_stub
+ libpaths += ..
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ client.cpp
+ }
+}
+
+
+project (EC_DnC_controller) : ciao_events_dnc, valuetype {
+ avoids += ace_for_tao
+ exename = controller
+ after += EC_DnC_stub
+ libs += EC_stub BasicSP_stub
+ libpaths += ..
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ controller.cpp
+ }
+}
diff --git a/CIAO/examples/BasicSP/EC/ECEI.idl b/CIAO/examples/BasicSP/EC/ECEI.idl
new file mode 100644
index 00000000000..9b48d5c74dd
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/ECEI.idl
@@ -0,0 +1,32 @@
+// $Id$
+
+//=============================================================================
+/**
+ * @file ECEI.idl
+ *
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef CIAO_ECEI_IDL
+#define CIAO_ECEI_IDL
+
+#include "ECE.idl"
+
+module BasicSP
+{
+ /**
+ * @interface EC_Exec
+ *
+ * The actually EC executor need to support
+ * Components::SessionComponent interface. Therefore, we need to
+ * define the component executor interface explicitly here.
+ */
+ local interface EC_Exec : CCM_EC,
+ Components::SessionComponent
+ {
+ };
+
+};
+
+#endif /* RATEGENEI_IDL */
diff --git a/CIAO/examples/BasicSP/EC/EC_exec.cpp b/CIAO/examples/BasicSP/EC/EC_exec.cpp
new file mode 100644
index 00000000000..12a100aad99
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC_exec.cpp
@@ -0,0 +1,273 @@
+// $Id$
+
+#include "EC_exec.h"
+#include "CIAO_common.h"
+#include "ace/Timer_Queue.h"
+#include "ace/Reactor.h"
+
+//=================================================================
+
+MyImpl::timeout_Handler::timeout_Handler (MyImpl::EC_exec_i *cb)
+ : active_ (0),
+ done_ (0),
+ tid_ (0),
+ pulse_callback_ (cb)
+{
+ // Nothing
+ this->reactor (new ACE_Reactor);
+}
+
+MyImpl::timeout_Handler::~timeout_Handler ()
+{
+ delete this->reactor ();
+ this->reactor (0);
+}
+
+int
+MyImpl::timeout_Handler::open_h ()
+{
+ return this->activate ();
+}
+
+int
+MyImpl::timeout_Handler::close_h ()
+{
+ this->done_ = 1;
+ this->reactor ()->notify ();
+
+ if (CIAO::debug_level () > 0)
+ ACE_DEBUG ((LM_DEBUG, "Waiting\n"));
+ return this->wait ();
+}
+
+int
+MyImpl::timeout_Handler::start (CORBA::Long hertz)
+{
+ if (hertz == 0 || this->active_ != 0) // Not valid
+ return -1;
+
+ long usec = 1000000 / hertz;
+
+ this->tid_ = this->reactor ()->schedule_timer (this,
+ 0,
+ ACE_Time_Value (0, usec),
+ ACE_Time_Value (0, usec));
+
+ this->active_ = 1;
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::stop (void)
+{
+ if (this->active_ == 0) // Not valid.
+ return -1;
+
+ this->reactor ()->cancel_timer (this);
+
+ this->active_ = 0;
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::active (void)
+{
+ return this->active_;
+}
+
+int
+MyImpl::timeout_Handler::handle_close (ACE_HANDLE handle,
+ ACE_Reactor_Mask close_mask)
+{
+ if (CIAO::debug_level () > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"),
+ this,
+ handle,
+ close_mask));
+
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::handle_timeout (const ACE_Time_Value &,
+ const void *)
+{
+ this->pulse_callback_->pulse ();
+
+// ACE_DEBUG ((LM_DEBUG,
+// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"),
+// this,
+// tv.sec (),
+// tv.usec ()));
+
+ return 0;
+}
+
+int
+MyImpl::timeout_Handler::svc (void)
+{
+ this->reactor ()->owner (ACE_OS::thr_self ());
+
+ while (!this->done_)
+ this->reactor ()->handle_events ();
+
+ return 0;
+}
+
+//=================================================================
+
+MyImpl::EC_exec_i::EC_exec_i ()
+ : hertz_ (0),
+ pulser_ (this)
+{
+
+}
+
+MyImpl::EC_exec_i::EC_exec_i (CORBA::Long hz)
+ : hertz_ (hz),
+ pulser_ (this)
+{
+}
+
+MyImpl::EC_exec_i::~EC_exec_i ()
+{
+}
+
+CORBA::Long
+MyImpl::EC_exec_i::hertz ()
+{
+ return this->hertz_;
+}
+
+void
+MyImpl::EC_exec_i::hertz (CORBA::Long hertz)
+{
+ this->hertz_ = hertz;
+}
+
+// Operations from supported interface(s)
+
+void
+MyImpl::EC_exec_i::start ()
+{
+ if (this->hertz_ == 0 || this->pulser_.active())
+ throw CORBA::BAD_INV_ORDER ();
+
+ // @@ Start the rate generator
+ this->pulser_.start (this->hertz_);
+}
+
+void
+MyImpl::EC_exec_i::stop ()
+{
+ if (! this->pulser_.active ())
+ throw CORBA::BAD_INV_ORDER ();
+
+ // @@ stop the rate generator
+ this->pulser_.stop ();
+}
+
+CORBA::Boolean
+MyImpl::EC_exec_i::active ()
+{
+ return this->pulser_.active ();
+}
+
+// Operations from Components::SessionComponent
+
+void
+MyImpl::EC_exec_i::set_session_context (Components::SessionContext_ptr ctx)
+{
+ if (CIAO::debug_level () > 0)
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::set_session_context\n"));
+
+ this->context_ =
+ BasicSP::CCM_EC_Context::_narrow (ctx);
+
+ if (CORBA::is_nil (this->context_.in ()))
+ throw CORBA::INTERNAL ();
+ // Urm, we actually discard exceptions thown from this operation.
+
+}
+
+void
+MyImpl::EC_exec_i::ciao_preactivate ()
+{
+}
+
+void
+MyImpl::EC_exec_i::ccm_activate ()
+{
+ if (CIAO::debug_level () > 0)
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_activate\n"));
+
+ this->pulser_.open_h ();
+}
+
+void
+MyImpl::EC_exec_i::ciao_postactivate ()
+{
+}
+
+void
+MyImpl::EC_exec_i::ccm_passivate ()
+{
+ if (CIAO::debug_level () > 0)
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_passivate\n"));
+ this->pulser_.close_h ();
+}
+
+void
+MyImpl::EC_exec_i::ccm_remove ()
+{
+ if (CIAO::debug_level () > 0)
+ ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_remove\n"));
+}
+
+void
+MyImpl::EC_exec_i::pulse (void)
+{
+ try
+ {
+ if (CIAO::debug_level () > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Pushing BasicSP::TimeOut event!\n")));
+
+ BasicSP::TimeOut_var ev = new OBV_BasicSP::TimeOut ();
+
+ this->context_->push_timeout (ev.in ());
+ }
+ catch (const CORBA::Exception&)
+ {
+ // @@ do nothing?
+ }
+
+}
+
+MyImpl::ECHome_exec_i::ECHome_exec_i ()
+{
+}
+
+MyImpl::ECHome_exec_i::~ECHome_exec_i ()
+{
+}
+
+::Components::EnterpriseComponent_ptr
+MyImpl::ECHome_exec_i::new_EC (CORBA::Long hertz)
+{
+ return new MyImpl::EC_exec_i (hertz);
+}
+
+::Components::EnterpriseComponent_ptr
+MyImpl::ECHome_exec_i::create ()
+{
+ return new MyImpl::EC_exec_i ();
+}
+
+
+extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr
+createECHome_Impl (void)
+{
+ return new MyImpl::ECHome_exec_i ();
+}
diff --git a/CIAO/examples/BasicSP/EC/EC_exec.h b/CIAO/examples/BasicSP/EC/EC_exec.h
new file mode 100644
index 00000000000..69d54ac7d42
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC_exec.h
@@ -0,0 +1,167 @@
+// $Id$
+
+//============================================================
+/**
+ * @file EC_exec.h
+ *
+ * Header file for the actualy EC and ECHome component
+ * implementation.
+ *
+ * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
+ */
+//============================================================
+
+#ifndef EC_EXEC_H
+#define EC_EXEC_H
+
+#include "ECEIC.h"
+#include "tao/LocalObject.h"
+#include "ace/Thread_Manager.h"
+#include "ace/Task.h"
+
+namespace MyImpl
+{
+ // Forward decl.
+ class EC_exec_i;
+
+ /**
+ * @brief Active pulse generater
+ */
+ class timeout_Handler : public ACE_Task_Base
+ {
+ public:
+ // Default constructor
+ timeout_Handler (EC_exec_i *cb);
+ ~timeout_Handler ();
+
+ int open_h (void);
+
+ int close_h (void);
+
+ int start (CORBA::Long hertz);
+
+ int stop (void);
+
+ int active (void);
+
+ // Handle the timeout.
+ virtual int handle_timeout (const ACE_Time_Value &tv,
+ const void *arg);
+
+ // Called when <Time_Handler> is removed.
+ virtual int handle_close (ACE_HANDLE handle,
+ ACE_Reactor_Mask close_mask);
+
+ virtual int svc (void);
+
+ private:
+ /// Tracking whether we are actively generating pulse or not.
+ long active_;
+
+ /// Flag to indicate completion of this active object.
+ int done_;
+
+ /// The timer id we are waiting.
+ long tid_;
+
+ EC_exec_i *pulse_callback_;
+
+ ACE_Thread_Manager thr_mgr_;
+ };
+
+ /**
+ * @class EC_exec_i
+ *
+ * EC executor implementation class.
+ */
+ class EC_EXEC_Export EC_exec_i :
+ public virtual BasicSP::EC_Exec,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ /// Default constructor.
+ EC_exec_i ();
+
+ /// Initialize with a default frequency.
+ EC_exec_i (CORBA::Long hz);
+
+ /// Default destructor.
+ ~EC_exec_i ();
+
+ // Attribute operations.
+
+ virtual CORBA::Long hertz ();
+
+ virtual void hertz (CORBA::Long hertz);
+
+ // Operations from supported interface(s)
+
+ virtual void start ();
+
+ virtual void stop ();
+
+ virtual CORBA::Boolean active ();
+
+ // Operations from Components::SessionComponent
+
+ virtual void set_session_context (Components::SessionContext_ptr ctx);
+
+ virtual void ciao_preactivate ();
+
+ virtual void ccm_activate ();
+
+ virtual void ciao_postactivate ();
+
+
+ virtual void ccm_passivate ();
+
+ virtual void ccm_remove ();
+
+ /// Helper function to be called back by timeout_Handler
+ void pulse (void);
+
+ protected:
+ /// Frequency
+ CORBA::Long hertz_;
+
+ /// Copmponent specific context
+ BasicSP::CCM_EC_Context_var context_;
+
+ /// An active object that actually trigger the generation of
+ /// periodic events.
+ timeout_Handler pulser_;
+ };
+
+ /**
+ * @class ECHome_exec_i
+ *
+ * EC home executor implementation class.
+ */
+ class EC_EXEC_Export ECHome_exec_i :
+ public virtual BasicSP::CCM_ECHome,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ /// Default ctor.
+ ECHome_exec_i ();
+
+ /// Default dtor.
+ ~ECHome_exec_i ();
+
+ // Explicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ new_EC (CORBA::Long hertz);
+
+ // Implicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ create ();
+ };
+
+}
+
+extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr
+createECHome_Impl (void);
+
+#endif /* CIAO_ECGEN_EXEC_H */
diff --git a/CIAO/examples/BasicSP/EC/EC_exec_export.h b/CIAO/examples/BasicSP/EC/EC_exec_export.h
new file mode 100644
index 00000000000..6a2d911d430
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC_exec_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s EC_EXEC
+// ------------------------------
+#ifndef EC_EXEC_EXPORT_H
+#define EC_EXEC_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (EC_EXEC_HAS_DLL)
+# define EC_EXEC_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && EC_EXEC_HAS_DLL */
+
+#if !defined (EC_EXEC_HAS_DLL)
+# define EC_EXEC_HAS_DLL 1
+#endif /* ! EC_EXEC_HAS_DLL */
+
+#if defined (EC_EXEC_HAS_DLL) && (EC_EXEC_HAS_DLL == 1)
+# if defined (EC_EXEC_BUILD_DLL)
+# define EC_EXEC_Export ACE_Proper_Export_Flag
+# define EC_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* EC_EXEC_BUILD_DLL */
+# define EC_EXEC_Export ACE_Proper_Import_Flag
+# define EC_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* EC_EXEC_BUILD_DLL */
+#else /* EC_EXEC_HAS_DLL == 1 */
+# define EC_EXEC_Export
+# define EC_EXEC_SINGLETON_DECLARATION(T)
+# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* EC_EXEC_HAS_DLL == 1 */
+
+// Set EC_EXEC_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (EC_EXEC_NTRACE)
+# if (ACE_NTRACE == 1)
+# define EC_EXEC_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define EC_EXEC_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !EC_EXEC_NTRACE */
+
+#if (EC_EXEC_NTRACE == 1)
+# define EC_EXEC_TRACE(X)
+#else /* (EC_EXEC_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define EC_EXEC_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (EC_EXEC_NTRACE == 1) */
+
+#endif /* EC_EXEC_EXPORT_H */
+
+// End of auto generated file.
diff --git a/CIAO/examples/BasicSP/EC/EC_stub_export.h b/CIAO/examples/BasicSP/EC/EC_stub_export.h
new file mode 100644
index 00000000000..cce0970deae
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC_stub_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s EC_STUB
+// ------------------------------
+#ifndef EC_STUB_EXPORT_H
+#define EC_STUB_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (EC_STUB_HAS_DLL)
+# define EC_STUB_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && EC_STUB_HAS_DLL */
+
+#if !defined (EC_STUB_HAS_DLL)
+# define EC_STUB_HAS_DLL 1
+#endif /* ! EC_STUB_HAS_DLL */
+
+#if defined (EC_STUB_HAS_DLL) && (EC_STUB_HAS_DLL == 1)
+# if defined (EC_STUB_BUILD_DLL)
+# define EC_STUB_Export ACE_Proper_Export_Flag
+# define EC_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* EC_STUB_BUILD_DLL */
+# define EC_STUB_Export ACE_Proper_Import_Flag
+# define EC_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* EC_STUB_BUILD_DLL */
+#else /* EC_STUB_HAS_DLL == 1 */
+# define EC_STUB_Export
+# define EC_STUB_SINGLETON_DECLARATION(T)
+# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* EC_STUB_HAS_DLL == 1 */
+
+// Set EC_STUB_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (EC_STUB_NTRACE)
+# if (ACE_NTRACE == 1)
+# define EC_STUB_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define EC_STUB_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !EC_STUB_NTRACE */
+
+#if (EC_STUB_NTRACE == 1)
+# define EC_STUB_TRACE(X)
+#else /* (EC_STUB_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define EC_STUB_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (EC_STUB_NTRACE == 1) */
+
+#endif /* EC_STUB_EXPORT_H */
+
+// End of auto generated file.
diff --git a/CIAO/examples/BasicSP/EC/EC_svnt_export.h b/CIAO/examples/BasicSP/EC/EC_svnt_export.h
new file mode 100644
index 00000000000..90bc3cf9f4a
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/EC_svnt_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s EC_SVNT
+// ------------------------------
+#ifndef EC_SVNT_EXPORT_H
+#define EC_SVNT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (EC_SVNT_HAS_DLL)
+# define EC_SVNT_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && EC_SVNT_HAS_DLL */
+
+#if !defined (EC_SVNT_HAS_DLL)
+# define EC_SVNT_HAS_DLL 1
+#endif /* ! EC_SVNT_HAS_DLL */
+
+#if defined (EC_SVNT_HAS_DLL) && (EC_SVNT_HAS_DLL == 1)
+# if defined (EC_SVNT_BUILD_DLL)
+# define EC_SVNT_Export ACE_Proper_Export_Flag
+# define EC_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* EC_SVNT_BUILD_DLL */
+# define EC_SVNT_Export ACE_Proper_Import_Flag
+# define EC_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* EC_SVNT_BUILD_DLL */
+#else /* EC_SVNT_HAS_DLL == 1 */
+# define EC_SVNT_Export
+# define EC_SVNT_SINGLETON_DECLARATION(T)
+# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* EC_SVNT_HAS_DLL == 1 */
+
+// Set EC_SVNT_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (EC_SVNT_NTRACE)
+# if (ACE_NTRACE == 1)
+# define EC_SVNT_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define EC_SVNT_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !EC_SVNT_NTRACE */
+
+#if (EC_SVNT_NTRACE == 1)
+# define EC_SVNT_TRACE(X)
+#else /* (EC_SVNT_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define EC_SVNT_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (EC_SVNT_NTRACE == 1) */
+
+#endif /* EC_SVNT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/CIAO/examples/BasicSP/EC/README b/CIAO/examples/BasicSP/EC/README
new file mode 100644
index 00000000000..7e032780ab1
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/README
@@ -0,0 +1,9 @@
+/**
+
+@page EC README File
+
+ The EC component. This shouldnt be needed if we had a way to
+integrate EC sugly into CIAO. We dont at the time of writing this
+example on May 12, 2003. Hence this holy hack!
+
+*/
diff --git a/CIAO/examples/BasicSP/EC/client.cpp b/CIAO/examples/BasicSP/EC/client.cpp
new file mode 100644
index 00000000000..54f11be8fd2
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/client.cpp
@@ -0,0 +1,62 @@
+// $Id$
+
+//==============================================================
+/**
+ * @file client.cpp
+ *
+ * This is a simple client test program that interact with the EC
+ * component implementation. This test uses the explicit factory
+ * operation in the home interface to create a EC component
+ * instance, run it for a while, and destroy the component instance.
+ */
+//==============================================================
+
+#include "ECC.h"
+#include "ace/streams.h"
+#include "ace/OS_NS_unistd.h"
+
+int
+main (int argc, char *argv[])
+{
+ try
+ {
+ // Initialize orb
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ // Resolve HomeFinder interface
+
+ CORBA::Object_var obj
+ = orb->string_to_object ("file://ec.ior");
+
+ BasicSP::ECHome_var home
+ = BasicSP::ECHome::_narrow (obj.in ());
+
+ if (CORBA::is_nil (home.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire ECHome objref\n"), -1);
+
+ BasicSP::EC_var pulser
+ = home->create ();
+
+ // Place to plug in the rate
+ pulser->hertz (5);
+
+ pulser->start ();
+
+ ACE_OS::sleep (45);
+
+ pulser->stop ();
+
+ home->remove_component (pulser.in ());
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Who is the culprit \n");
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Uncaught CORBA exception\n"),
+ 1);
+ }
+
+ return 0;
+}
diff --git a/CIAO/examples/BasicSP/EC/controller.cpp b/CIAO/examples/BasicSP/EC/controller.cpp
new file mode 100644
index 00000000000..13a5fd6d81e
--- /dev/null
+++ b/CIAO/examples/BasicSP/EC/controller.cpp
@@ -0,0 +1,128 @@
+// $Id$
+
+/**
+ * @file controller.cpp
+ *
+ * This program interact with a EC component, and set the rate of the
+ * EC.
+ */
+
+#include "ECC.h"
+#include "ace/Get_Opt.h"
+#include "ace/streams.h"
+
+const char *rategen_ior_ = 0;
+int rate = 2;
+int turn_on = 1;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "k:r:of");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ {
+ switch (c)
+ {
+ case 'o':
+ turn_on = 1;
+ break;
+
+ case 'f':
+ turn_on = 0;
+ break;
+
+ case 'k':
+ rategen_ior_ = get_opts.opt_arg ();
+ break;
+
+ case 'r':
+ rate = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s\n"
+ "-o (Turn on the rate generator)\n"
+ "-f (Turn off the rate generator)\n"
+ "-k <EC IOR> (default is file://rategen.ior)\n"
+ "-r <rate in hertz> (default is 3)\n"
+ "\n",
+ argv [0]),
+ -1);
+ break;
+ }
+ }
+
+ if (rategen_ior_ == 0)
+ {
+ rategen_ior_ = "file://ec.ior";
+ }
+
+ if (rate == 0)
+ {
+ rate = 3;
+ }
+
+ return 0;
+}
+
+int
+main (int argc, char *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 (rategen_ior_);
+
+ BasicSP::EC_var pulser
+ = BasicSP::EC::_narrow (obj.in ());
+
+ if (CORBA::is_nil (pulser.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to acquire 'EC' objref\n"),
+ -1);
+ }
+
+ pulser->hertz (rate);
+
+ if (turn_on)
+ {
+ pulser->hertz (rate);
+
+ ACE_DEBUG ((LM_DEBUG, "Start up the Event services\n"));
+
+ pulser->start ();
+ }
+ else
+ {
+ pulser->stop ();
+
+ ACE_DEBUG ((LM_DEBUG, "Stop the ES\n"));
+ }
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Who is the culprit \n");
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Uncaught CORBA exception\n"),
+ 1);
+ }
+
+ return 0;
+}