summaryrefslogtreecommitdiff
path: root/modules/CIAO/examples/Display/RateGen
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/examples/Display/RateGen')
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen.cidl17
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen.idl34
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen.mpc93
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen_exec.cpp332
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen_exec.h185
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen_exec_export.h54
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen_stub_export.h58
-rw-r--r--modules/CIAO/examples/Display/RateGen/RateGen_svnt_export.h58
-rw-r--r--modules/CIAO/examples/Display/RateGen/controller.cpp123
9 files changed, 954 insertions, 0 deletions
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen.cidl b/modules/CIAO/examples/Display/RateGen/RateGen.cidl
new file mode 100644
index 00000000000..2af0e155a84
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen.cidl
@@ -0,0 +1,17 @@
+// $Id$ -*- IDL -*-
+
+#ifndef RATEGEN_CIDL
+#define RATEGEN_CIDL
+
+#include "RateGen.idl"
+
+composition session RateGen_Impl
+{
+ home executor RateGenHome_exec
+ {
+ implements HUDisplay::RateGenHome;
+ manages RateGen_exec;
+ };
+};
+
+#endif /* RATEGEN_CIDL */
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen.idl b/modules/CIAO/examples/Display/RateGen/RateGen.idl
new file mode 100644
index 00000000000..ef398f5df78
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen.idl
@@ -0,0 +1,34 @@
+// $Id$
+
+/**
+ * @file RateGen.idl
+ *
+ * Definition of the RateGen (a rate generator) component.
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+
+#ifndef RATEGEN_IDL
+#define RATEGEN_IDL
+
+#include "../Display_Base/Display_Base.idl"
+
+module HUDisplay
+{
+ component RateGen supports opmode
+ {
+ publishes tick Pulse;
+
+ /// The attribute can be configured via the home or the
+ /// component property file.
+ attribute long hertz;
+ };
+
+ home RateGenHome manages RateGen
+ {
+ // Explicit operations
+ factory new_RateGen (in long hertz);
+ };
+};
+
+#endif /* RATEGEN_IDL */
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen.mpc b/modules/CIAO/examples/Display/RateGen/RateGen.mpc
new file mode 100644
index 00000000000..5ec6cfec169
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen.mpc
@@ -0,0 +1,93 @@
+// $Id$
+// This file is generated with "generate_component_mpc.pl -p Display_Base RateGen"
+
+project(Display_Base_RateGen_stub): ciao_client_dnc {
+ after += Display_Base_stub
+ sharedname = RateGen_stub
+ idlflags += -St \
+ -Wb,stub_export_macro=RATEGEN_STUB_Export \
+ -Wb,stub_export_include=RateGen_stub_export.h \
+ -Wb,skel_export_macro=RATEGEN_SVNT_Export \
+ -Wb,skel_export_include=RateGen_svnt_export.h
+ dynamicflags = RATEGEN_STUB_BUILD_DLL
+ libs += Display_Base_stub
+
+ IDL_Files {
+ RateGen.idl
+ }
+
+ Source_Files {
+ RateGenC.cpp
+ }
+
+ Header_Files {
+ RateGen_stub_export.h
+ }
+}
+
+project(Display_Base_RateGen_svnt) : ciao_servant_dnc {
+ after += Display_Base_skel Display_Base_RateGen_stub
+ sharedname = RateGen_svnt
+ libs += RateGen_stub Display_Base_stub Display_Base_skel
+
+ idlflags += -SS -St \
+ -Wb,export_macro=RATEGEN_SVNT_Export \
+ -Wb,export_include=RateGen_svnt_export.h
+ dynamicflags = RATEGEN_SVNT_BUILD_DLL
+
+ CIDL_Files {
+ RateGen.cidl
+ }
+
+ IDL_Files {
+ RateGenE.idl
+ }
+
+ Source_Files {
+ RateGenEC.cpp
+ RateGenS.cpp
+ RateGen_svnt.cpp
+ }
+
+ Header_Files {
+ RateGen_svnt_export.h
+ }
+}
+
+
+project(Display_Base_RateGen_exec) : ciao_component_dnc {
+ after += Display_Base_RateGen_svnt
+ sharedname = RateGen_exec
+ libs += RateGen_stub \
+ RateGen_svnt \
+ Display_Base_stub \
+ Display_Base_skel
+
+ dynamicflags = RATEGEN_EXEC_BUILD_DLL
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ RateGen_exec.cpp
+ }
+
+ Header_Files {
+ RateGen_exec_export.h
+ }
+}
+
+
+project (RateGen_DnC_controller) : ciao_client_dnc, valuetype {
+ exename = controller
+ after += Display_Base_RateGen_stub
+ libs += RateGen_stub Display_Base_stub
+ libpaths += ../Display_Base
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ controller.cpp
+ }
+}
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen_exec.cpp b/modules/CIAO/examples/Display/RateGen/RateGen_exec.cpp
new file mode 100644
index 00000000000..a03c7bc3acc
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen_exec.cpp
@@ -0,0 +1,332 @@
+// $Id$
+
+#include "RateGen_exec.h"
+#include "CIAO_common.h"
+#include "ace/Timer_Queue.h"
+#include "ace/Reactor.h"
+
+//=================================================================
+
+MyImpl::Pulse_Handler::Pulse_Handler (MyImpl::RateGen_exec_i *cb)
+ : active_ (0),
+ done_ (0),
+ tid_ (0),
+ pulse_callback_ (cb)
+{
+ // Nothing
+ this->reactor (new ACE_Reactor);
+}
+
+MyImpl::Pulse_Handler::~Pulse_Handler ()
+{
+ delete this->reactor ();
+ this->reactor (0);
+}
+
+int
+MyImpl::Pulse_Handler::open_h ()
+{
+ return this->activate ();
+}
+
+int
+MyImpl::Pulse_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::Pulse_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::Pulse_Handler::stop (void)
+{
+ if (this->active_ == 0) // Not valid.
+ {
+ return -1;
+ }
+
+ this->reactor ()->cancel_timer (this);
+
+ this->active_ = 0;
+ return 0;
+}
+
+int
+MyImpl::Pulse_Handler::active (void)
+{
+ return this->active_;
+}
+
+int
+MyImpl::Pulse_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::Pulse_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::Pulse_Handler::svc (void)
+{
+ this->reactor ()->owner (ACE_OS::thr_self ());
+
+ while (!this->done_)
+ {
+ this->reactor ()->handle_events ();
+ }
+
+ return 0;
+}
+
+//=================================================================
+
+MyImpl::RateGen_exec_i::RateGen_exec_i ()
+ : hertz_ (0),
+ pulser_ (this)
+{
+
+}
+
+MyImpl::RateGen_exec_i::RateGen_exec_i (CORBA::Long hz)
+ : hertz_ (hz),
+ pulser_ (this)
+{
+}
+
+MyImpl::RateGen_exec_i::~RateGen_exec_i ()
+{
+}
+
+CORBA::Long
+MyImpl::RateGen_exec_i::hertz ()
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->hertz_;
+}
+
+void
+MyImpl::RateGen_exec_i::hertz (CORBA::Long hertz)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->hertz_ = hertz;
+}
+
+// Operations from supported interface(s)
+
+void
+MyImpl::RateGen_exec_i::start ()
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (this->hertz_ == 0 || this->pulser_.active())
+ {
+ throw CORBA::BAD_INV_ORDER ();
+ }
+
+ // @@ Start the rate generator
+ this->pulser_.start (this->hertz_);
+}
+
+void
+MyImpl::RateGen_exec_i::stop ()
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (! this->pulser_.active ())
+ {
+ throw CORBA::BAD_INV_ORDER ();
+ }
+
+ // @@ stop the rate generator
+ this->pulser_.stop ();
+}
+
+CORBA::Boolean
+MyImpl::RateGen_exec_i::active ()
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->pulser_.active ();
+}
+
+// Operations from Components::SessionComponent
+
+void
+MyImpl::RateGen_exec_i::set_session_context (
+ Components::SessionContext_ptr ctx
+ )
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ if (CIAO::debug_level () > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "MyImpl::RateGen_exec_i::set_session_context\n"));
+ }
+
+ this->context_ =
+ HUDisplay::CCM_RateGen_Context::_narrow (ctx);
+
+ if (CORBA::is_nil (this->context_.in ()))
+ {
+ throw CORBA::INTERNAL ();
+ }
+ // Urm, we actually discard exceptions thown from this operation.
+
+}
+
+void
+MyImpl::RateGen_exec_i::ciao_preactivate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+}
+
+void
+MyImpl::RateGen_exec_i::ccm_activate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ if (CIAO::debug_level () > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "MyImpl::RateGen_exec_i::ccm_activate\n"));
+ }
+
+ this->pulser_.open_h ();
+}
+
+void
+MyImpl::RateGen_exec_i::ciao_postactivate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+}
+
+void
+MyImpl::RateGen_exec_i::ccm_passivate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ if (CIAO::debug_level () > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "MyImpl::RateGen_exec_i::ccm_passivate\n"));
+ }
+
+ this->pulser_.close_h ();
+}
+
+void
+MyImpl::RateGen_exec_i::ccm_remove ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ if (CIAO::debug_level () > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "MyImpl::RateGen_exec_i::ccm_remove\n"));
+ }
+}
+
+void
+MyImpl::RateGen_exec_i::pulse (void)
+{
+ try
+ {
+// if (CIAO::debug_level () > 0)
+// {
+// ACE_DEBUG ((LM_DEBUG,
+// ACE_TEXT ("Pushing HUDisplay::tick event!\n")));
+// }
+
+ HUDisplay::tick_var ev = new OBV_HUDisplay::tick ();
+
+ this->context_->push_Pulse (ev.in ());
+ }
+ catch (const CORBA::Exception&)
+ {
+ // @@ do nothing?
+ }
+
+}
+
+MyImpl::RateGenHome_exec_i::RateGenHome_exec_i ()
+{
+}
+
+MyImpl::RateGenHome_exec_i::~RateGenHome_exec_i ()
+{
+}
+
+::Components::EnterpriseComponent_ptr
+MyImpl::RateGenHome_exec_i::new_RateGen (CORBA::Long /* hertz */)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ Components::EnterpriseComponent_ptr tmp = 0;
+ ACE_NEW_THROW_EX (tmp,
+ MyImpl::RateGen_exec_i,
+ CORBA::NO_MEMORY ());
+
+ return tmp;
+}
+
+::Components::EnterpriseComponent_ptr
+MyImpl::RateGenHome_exec_i::create ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException))
+{
+ return new MyImpl::RateGen_exec_i ();
+}
+
+
+extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr
+createRateGenHome_Impl (void)
+{
+ return new MyImpl::RateGenHome_exec_i ();
+}
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen_exec.h b/modules/CIAO/examples/Display/RateGen/RateGen_exec.h
new file mode 100644
index 00000000000..68c54c180c0
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen_exec.h
@@ -0,0 +1,185 @@
+// $Id$
+
+/**
+ * @file RateGen_exec.h
+ *
+ * Header file for the actualy RateGen and RateGenHome component
+ * implementation.
+ *
+ * @author Nanbor Wang <nanbor@cse.wustl.edu>
+ */
+
+#ifndef RATEGEN_EXEC_H
+#define RATEGEN_EXEC_H
+
+#include "RateGen_exec_export.h"
+#include "RateGenEC.h"
+#include "tao/LocalObject.h"
+#include "ace/Thread_Manager.h"
+#include "ace/Task.h"
+
+namespace MyImpl
+{
+ // Forward decl.
+ class RateGen_exec_i;
+
+ /**
+ * @brief Active pulse generater
+ */
+ class Pulse_Handler : public ACE_Task_Base
+ {
+ public:
+ // Default constructor
+ Pulse_Handler (RateGen_exec_i *cb);
+ ~Pulse_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_;
+
+ RateGen_exec_i *pulse_callback_;
+
+ ACE_Thread_Manager thr_mgr_;
+ };
+
+ /**
+ * @class RateGen_exec_i
+ *
+ * RateGen executor implementation class.
+ */
+ class RATEGEN_EXEC_Export RateGen_exec_i :
+ public virtual CIDL_RateGen_Impl::RateGen_exec,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ /// Default constructor.
+ RateGen_exec_i ();
+
+ /// Initialize with a default frequency.
+ RateGen_exec_i (CORBA::Long hz);
+
+ /// Default destructor.
+ ~RateGen_exec_i ();
+
+ // Attribute operations.
+
+ virtual CORBA::Long hertz ()
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void hertz (CORBA::Long hertz)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Operations from supported interface(s)
+
+ virtual void start ()
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void stop ()
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::Boolean active ()
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Operations from Components::SessionComponent
+
+ virtual void set_session_context (Components::SessionContext_ptr ctx)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ciao_preactivate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ccm_activate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ciao_postactivate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ccm_passivate ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ virtual void ccm_remove ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+
+ /// Helper function to be called back by Pulse_Handler
+ void pulse (void);
+
+ protected:
+ /// Frequency
+ CORBA::Long hertz_;
+
+ /// Copmponent specific context
+ HUDisplay::CCM_RateGen_Context_var context_;
+
+ /// An active object that actually trigger the generation of
+ /// periodic events.
+ Pulse_Handler pulser_;
+ };
+
+ /**
+ * @class RateGenHome_exec_i
+ *
+ * RateGen home executor implementation class.
+ */
+ class RATEGEN_EXEC_Export RateGenHome_exec_i :
+ public virtual HUDisplay::CCM_RateGenHome,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ /// Default ctor.
+ RateGenHome_exec_i ();
+
+ /// Default dtor.
+ ~RateGenHome_exec_i ();
+
+ // Explicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ new_RateGen (CORBA::Long hertz)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ // Implicit home operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ create ()
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Components::CCMException));
+ };
+
+}
+
+extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr
+createRateGenHome_Impl (void);
+
+#endif /* RATEGEN_EXEC_H */
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen_exec_export.h b/modules/CIAO/examples/Display/RateGen/RateGen_exec_export.h
new file mode 100644
index 00000000000..8871ff3c649
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen_exec_export.h
@@ -0,0 +1,54 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl RATEGEN_EXEC
+// ------------------------------
+#ifndef RATEGEN_EXEC_EXPORT_H
+#define RATEGEN_EXEC_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (RATEGEN_EXEC_HAS_DLL)
+# define RATEGEN_EXEC_HAS_DLL 1
+#endif /* ! RATEGEN_EXEC_HAS_DLL */
+
+#if defined (RATEGEN_EXEC_HAS_DLL) && (RATEGEN_EXEC_HAS_DLL == 1)
+# if defined (RATEGEN_EXEC_BUILD_DLL)
+# define RATEGEN_EXEC_Export ACE_Proper_Export_Flag
+# define RATEGEN_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define RATEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* RATEGEN_EXEC_BUILD_DLL */
+# define RATEGEN_EXEC_Export ACE_Proper_Import_Flag
+# define RATEGEN_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define RATEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* RATEGEN_EXEC_BUILD_DLL */
+#else /* RATEGEN_EXEC_HAS_DLL == 1 */
+# define RATEGEN_EXEC_Export
+# define RATEGEN_EXEC_SINGLETON_DECLARATION(T)
+# define RATEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* RATEGEN_EXEC_HAS_DLL == 1 */
+
+// Set RATEGEN_EXEC_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (RATEGEN_EXEC_NTRACE)
+# if (ACE_NTRACE == 1)
+# define RATEGEN_EXEC_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define RATEGEN_EXEC_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !RATEGEN_EXEC_NTRACE */
+
+#if (RATEGEN_EXEC_NTRACE == 1)
+# define RATEGEN_EXEC_TRACE(X)
+#else /* (RATEGEN_EXEC_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define RATEGEN_EXEC_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (RATEGEN_EXEC_NTRACE == 1) */
+
+#endif /* RATEGEN_EXEC_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen_stub_export.h b/modules/CIAO/examples/Display/RateGen/RateGen_stub_export.h
new file mode 100644
index 00000000000..d71c4f10a12
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen_stub_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl RATEGEN_STUB
+// ------------------------------
+#ifndef RATEGEN_STUB_EXPORT_H
+#define RATEGEN_STUB_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (RATEGEN_STUB_HAS_DLL)
+# define RATEGEN_STUB_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && RATEGEN_STUB_HAS_DLL */
+
+#if !defined (RATEGEN_STUB_HAS_DLL)
+# define RATEGEN_STUB_HAS_DLL 1
+#endif /* ! RATEGEN_STUB_HAS_DLL */
+
+#if defined (RATEGEN_STUB_HAS_DLL) && (RATEGEN_STUB_HAS_DLL == 1)
+# if defined (RATEGEN_STUB_BUILD_DLL)
+# define RATEGEN_STUB_Export ACE_Proper_Export_Flag
+# define RATEGEN_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define RATEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* RATEGEN_STUB_BUILD_DLL */
+# define RATEGEN_STUB_Export ACE_Proper_Import_Flag
+# define RATEGEN_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define RATEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* RATEGEN_STUB_BUILD_DLL */
+#else /* RATEGEN_STUB_HAS_DLL == 1 */
+# define RATEGEN_STUB_Export
+# define RATEGEN_STUB_SINGLETON_DECLARATION(T)
+# define RATEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* RATEGEN_STUB_HAS_DLL == 1 */
+
+// Set RATEGEN_STUB_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (RATEGEN_STUB_NTRACE)
+# if (ACE_NTRACE == 1)
+# define RATEGEN_STUB_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define RATEGEN_STUB_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !RATEGEN_STUB_NTRACE */
+
+#if (RATEGEN_STUB_NTRACE == 1)
+# define RATEGEN_STUB_TRACE(X)
+#else /* (RATEGEN_STUB_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define RATEGEN_STUB_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (RATEGEN_STUB_NTRACE == 1) */
+
+#endif /* RATEGEN_STUB_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/examples/Display/RateGen/RateGen_svnt_export.h b/modules/CIAO/examples/Display/RateGen/RateGen_svnt_export.h
new file mode 100644
index 00000000000..d2b10477fab
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/RateGen_svnt_export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl RATEGEN_SVNT
+// ------------------------------
+#ifndef RATEGEN_SVNT_EXPORT_H
+#define RATEGEN_SVNT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (RATEGEN_SVNT_HAS_DLL)
+# define RATEGEN_SVNT_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && RATEGEN_SVNT_HAS_DLL */
+
+#if !defined (RATEGEN_SVNT_HAS_DLL)
+# define RATEGEN_SVNT_HAS_DLL 1
+#endif /* ! RATEGEN_SVNT_HAS_DLL */
+
+#if defined (RATEGEN_SVNT_HAS_DLL) && (RATEGEN_SVNT_HAS_DLL == 1)
+# if defined (RATEGEN_SVNT_BUILD_DLL)
+# define RATEGEN_SVNT_Export ACE_Proper_Export_Flag
+# define RATEGEN_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define RATEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* RATEGEN_SVNT_BUILD_DLL */
+# define RATEGEN_SVNT_Export ACE_Proper_Import_Flag
+# define RATEGEN_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define RATEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* RATEGEN_SVNT_BUILD_DLL */
+#else /* RATEGEN_SVNT_HAS_DLL == 1 */
+# define RATEGEN_SVNT_Export
+# define RATEGEN_SVNT_SINGLETON_DECLARATION(T)
+# define RATEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* RATEGEN_SVNT_HAS_DLL == 1 */
+
+// Set RATEGEN_SVNT_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (RATEGEN_SVNT_NTRACE)
+# if (ACE_NTRACE == 1)
+# define RATEGEN_SVNT_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define RATEGEN_SVNT_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !RATEGEN_SVNT_NTRACE */
+
+#if (RATEGEN_SVNT_NTRACE == 1)
+# define RATEGEN_SVNT_TRACE(X)
+#else /* (RATEGEN_SVNT_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define RATEGEN_SVNT_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (RATEGEN_SVNT_NTRACE == 1) */
+
+#endif /* RATEGEN_SVNT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/modules/CIAO/examples/Display/RateGen/controller.cpp b/modules/CIAO/examples/Display/RateGen/controller.cpp
new file mode 100644
index 00000000000..fdb5838382d
--- /dev/null
+++ b/modules/CIAO/examples/Display/RateGen/controller.cpp
@@ -0,0 +1,123 @@
+// $Id$
+
+#include "RateGenC.h"
+#include "ace/streams.h"
+#include "ace/Get_Opt.h"
+
+/**
+ * @file controller.cpp
+ *
+ * This program interact with a RateGen component, using its supported
+ * interface "opmode" to switch it on/off, and set the rate of the
+ * RateGen.
+ */
+
+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 <RateGen 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://RateGen.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_);
+
+ HUDisplay::RateGen_var pulser =
+ HUDisplay::RateGen::_narrow (obj.in ());
+
+ if (CORBA::is_nil (pulser.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to acquire 'RateGen' objref\n"),
+ -1);
+ }
+
+ if (turn_on)
+ {
+ pulser->hertz (rate);
+
+ ACE_DEBUG ((LM_DEBUG, "Start up the Rate Generator\n"));
+
+ pulser->start ();
+ }
+ else
+ {
+ pulser->stop ();
+
+ ACE_DEBUG ((LM_DEBUG, "Rate Generator stopped\n"));
+ }
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Who is the culprit \n");
+ cerr << "Uncaught CORBA exception" << endl;
+ return 1;
+ }
+
+ return 0;
+}