diff options
Diffstat (limited to 'modules/CIAO/examples/Hello/Sender')
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender.cidl | 17 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender.idl | 43 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender.mpc | 114 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender_exec.cpp | 190 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender_exec.h | 176 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender_exec_export.h | 54 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender_stub_export.h | 54 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/Sender_svnt_export.h | 54 | ||||
-rw-r--r-- | modules/CIAO/examples/Hello/Sender/starter.cpp | 90 |
9 files changed, 792 insertions, 0 deletions
diff --git a/modules/CIAO/examples/Hello/Sender/Sender.cidl b/modules/CIAO/examples/Hello/Sender/Sender.cidl new file mode 100644 index 00000000000..8ce22a223b0 --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender.cidl @@ -0,0 +1,17 @@ +//$Id$ + +#ifndef SENDER_CIDL +#define SENDER_CIDL + +#include "Sender.idl" + +composition session Sender_Impl +{ + home executor SenderHome_Exec + { + implements Hello::SenderHome; + manages Sender_Exec; + }; +}; + +#endif /* SENDER_CIDL */ diff --git a/modules/CIAO/examples/Hello/Sender/Sender.idl b/modules/CIAO/examples/Hello/Sender/Sender.idl new file mode 100644 index 00000000000..d182b68008c --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender.idl @@ -0,0 +1,43 @@ +//$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 (); + }; + + enum COLOR_SELECTION + { + empty, + white, + red, + yellow + }; + + component Sender supports trigger + { + provides ReadMessage push_message; + publishes TimeOut click_out; + attribute string local_message; + readonly attribute long hertz; + + // A test attribute to test setting attributes through XML + attribute COLOR_SELECTION color; + }; + + home SenderHome manages Sender + { + }; +}; +#endif /*CIAO_SENDER_IDL*/ diff --git a/modules/CIAO/examples/Hello/Sender/Sender.mpc b/modules/CIAO/examples/Hello/Sender/Sender.mpc new file mode 100644 index 00000000000..defe03b11a6 --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender.mpc @@ -0,0 +1,114 @@ +// $Id$ +// This file is generated with "generate_component_mpc_extra.pl -p Hello_Base Sender" + +project(Hello_Base_Sender_DnC_stub): ciao_client_dnc { + avoids += ace_for_tao + after += Hello_Base_DnC_stub + sharedname = Sender_DnC_stub + 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 + dynamicflags = SENDER_STUB_BUILD_DLL + libs += Hello_Base_DnC_stub + + IDL_Files { + Sender.idl + } + + Source_Files { + SenderC.cpp + } + + Header_Files { + SenderC.h + } + + Inline_Files { + SenderC.inl + } +} + +project(Hello_Base_Sender_DnC_svnt) : ciao_servant_dnc { + avoids += ace_for_tao + after += Hello_Base_DnC_svnt \ + Hello_Base_Sender_DnC_stub + sharedname = Sender_DnC_svnt + libs += Sender_DnC_stub \ + Hello_Base_DnC_stub \ + Hello_Base_DnC_svnt + + idlflags += -Wb,export_macro=SENDER_SVNT_Export \ + -Wb,export_include=Sender_svnt_export.h + dynamicflags = SENDER_SVNT_BUILD_DLL + + CIDL_Files { + Sender.cidl + } + + IDL_Files { + SenderE.idl + } + + Source_Files { + SenderEC.cpp + SenderS.cpp + Sender_svnt.cpp + } + + Header_Files { + SenderEC.h + SenderS.h + Sender_svnt.h + } + + Inline_Files { + SenderEC.inl + SenderS.inl + } +} + +project(Hello_Base_Sender_DnC_exec) : ciao_component_dnc { + avoids += ace_for_tao + after += Hello_Base_Sender_DnC_svnt + sharedname = Sender_DnC_exec + libs += Sender_DnC_stub \ + Sender_DnC_svnt \ + Hello_Base_DnC_stub \ + Hello_Base_DnC_svnt + + idlflags += -Wb,export_macro=SENDER_EXEC_Export \ + -Wb,export_include=Sender_exec_export.h + dynamicflags = SENDER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Sender_exec.cpp + } + + Header_Files { + Sender_exec.h + } +} + +project (Hello_DnC_Starter) : ciao_client_dnc, valuetype { + avoids += ace_for_tao + exename = starter + after += Hello_Base_Sender_DnC_stub + libs += Sender_DnC_stub Hello_Base_DnC_stub + + IDL_Files { + } + + Source_Files { + starter.cpp + } + + Header_Files { + } + + Inline_Files { + } +} diff --git a/modules/CIAO/examples/Hello/Sender/Sender_exec.cpp b/modules/CIAO/examples/Hello/Sender/Sender_exec.cpp new file mode 100644 index 00000000000..ad4a4143b8d --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender_exec.cpp @@ -0,0 +1,190 @@ +//$Id$ + +#include "Sender_exec.h" + +namespace CIDL_Sender_Impl +{ + char* + Message_Impl::get_message () + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, "Sender sending out message: [%s]\n", component_.message_.in ())); + return CORBA::string_dup (component_.message_.in ()); + } + + Sender_exec_i::~Sender_exec_i () + { + } + + void + Sender_exec_i::local_message (const char * local_message) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + message_ = CORBA::string_dup (local_message); + } + + char * + Sender_exec_i::local_message () + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (message_.in ()); + } + + void + Sender_exec_i::hertz (CORBA::Long hertz) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->hertz_ = hertz; + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::Hertz:%d\n", this->hertz_)); + } + + CORBA::Long + Sender_exec_i::hertz () + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->hertz_; + } + + ::Hello::COLOR_SELECTION + Sender_exec_i::color () + ACE_THROW_SPEC ((CORBA::SystemException)) + { + // Your code here. + return this->color_; + } + + void + Sender_exec_i::color ( + ::Hello::COLOR_SELECTION color) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->color_ = color; + } + + Hello::CCM_ReadMessage_ptr + Sender_exec_i::get_push_message () + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, + "Sender_exec.i::get_push_message called\n ")); + return ( new Message_Impl (*this) ); + } + + void + Sender_exec_i::start () + ACE_THROW_SPEC ((CORBA::SystemException)) + { + Hello::TimeOut_var event = new OBV_Hello::TimeOut; + event->data ("ACE/TAO/CIAO"); + ACE_DEBUG ((LM_DEBUG, "Sender initiates the process.\n")); + this->context_->push_click_out (event.in ()); + + ACE_DEBUG ((LM_DEBUG, "My current color is:")); + + switch (this->color_) + { + case ::Hello::empty: + ACE_DEBUG ((LM_DEBUG, "ERROR: Enum attribute initialization failed.\n")); + break; + + case ::Hello::white: + ACE_DEBUG ((LM_DEBUG, "white\n")); + break; + + case ::Hello::red: + ACE_DEBUG ((LM_DEBUG, "red\n")); + break; + + case ::Hello::yellow: + ACE_DEBUG ((LM_DEBUG, "yellow\n")); + break; + + default: + ACE_DEBUG ((LM_DEBUG, "Unknown color!\n")); + + } + } + + void + Sender_exec_i::set_session_context (Components::SessionContext_ptr ctx) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) + { + 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::ciao_preactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) + { + ACE_DEBUG ((LM_DEBUG, + "Sender_exec_i::ciao_preactivate\n")); + } + + void + Sender_exec_i::ccm_activate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) + { + ACE_DEBUG ((LM_DEBUG, + "Sender_exec_i::ccm_activate\n")); + } + + void + Sender_exec_i::ciao_postactivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) + { + ACE_DEBUG ((LM_DEBUG, + "Sender_exec_i::ciao_postactivate\n")); + } + + void + Sender_exec_i::ccm_passivate () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::ccm_passivate\n")); + } + + void + Sender_exec_i::ccm_remove () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) + { + ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::ccm_remove\n")); + } + + SenderHome_exec_i::SenderHome_exec_i () + { + } + + SenderHome_exec_i::~SenderHome_exec_i () + { + } + + ::Components::EnterpriseComponent_ptr + SenderHome_exec_i::create () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) + { + ACE_DEBUG ((LM_DEBUG, "(%P|%t) creating SenderHome \n")); + return new Sender_exec_i; + } + + extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr + createSenderHome_Impl (void) + { + return new SenderHome_exec_i (); + } +} + diff --git a/modules/CIAO/examples/Hello/Sender/Sender_exec.h b/modules/CIAO/examples/Hello/Sender/Sender_exec.h new file mode 100644 index 00000000000..23949e7c80d --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender_exec.h @@ -0,0 +1,176 @@ +//$Id$ +//============================================================ +/** + * @file Sender_exec.h + * + * Header file for the Executor implementation. + */ +//============================================================ + +#ifndef SENDER_EXEC_H +#define SENDER_EXEC_H + +#include "SenderEC.h" +#include "Sender_exec_export.h" +#include "tao/LocalObject.h" + +namespace CIDL_Sender_Impl +{ + /** + * @class Sender_exec_i + * + * Sender executor implementation class. + */ + + class SENDER_EXEC_Export Sender_exec_i : + public virtual Sender_Exec, + public virtual TAO_Local_RefCounted_Object + { + + public: + /// Default constructor. + Sender_exec_i () + : message_(CORBA::string_dup ("Default Message")), + color_ (::Hello::empty) + { + } + + /// Secondary construction. + Sender_exec_i (const char* local_message) + : message_ (CORBA::string_dup (local_message)), + color_ (::Hello::empty) + { + } + + /// Default destructor. + virtual ~Sender_exec_i (); + + /// Operation to set the value of the attribute "local_message" + virtual void local_message (const char * local_message) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Operation to get the value of the attribute "local_message" + virtual char * local_message () + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Operation to set the value of the attribute "hertz" + virtual void hertz (CORBA::Long hertz) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Operation to get the value of the attribute "hertz" + virtual CORBA::Long hertz () + ACE_THROW_SPEC ((CORBA::SystemException)); + + /* 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 () + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Hello::COLOR_SELECTION + color () + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + color (::Hello::COLOR_SELECTION) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operation inside of the trigger interface. + virtual void start () + 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)); + + protected: + /// Copmponent specific context + Sender_Exec_Context_var context_; + + private: + CORBA::String_var message_; + + CORBA::Long hertz_; + + ::Hello::COLOR_SELECTION color_; + + friend class Message_Impl; + }; + + + // + // + // + class Message_Impl : public virtual Hello::CCM_ReadMessage, + public virtual TAO_Local_RefCounted_Object + { + public: + Message_Impl (Sender_exec_i& component) + : component_ (component) + { + } + + virtual char * + get_message () + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + Sender_exec_i& component_; + }; + + /** + * @class SenderHome_exec_i + * + * Sender home executor implementation class. + */ + class SENDER_EXEC_Export SenderHome_exec_i : + public virtual SenderHome_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + SenderHome_exec_i (); + + /// Default dtor. + virtual ~SenderHome_exec_i (); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create () + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + + extern "C" SENDER_EXEC_Export ::Components::HomeExecutorBase_ptr + createSenderHome_Impl (void); +} + +#endif /* SENDER_EXEC_H */ + + diff --git a/modules/CIAO/examples/Hello/Sender/Sender_exec_export.h b/modules/CIAO/examples/Hello/Sender/Sender_exec_export.h new file mode 100644 index 00000000000..dbaa7ea15bc --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SENDER_EXEC +// ------------------------------ +#ifndef SENDER_EXEC_EXPORT_H +#define SENDER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (SENDER_EXEC_HAS_DLL) +# define SENDER_EXEC_HAS_DLL 1 +#endif /* ! SENDER_EXEC_HAS_DLL */ + +#if defined (SENDER_EXEC_HAS_DLL) && (SENDER_EXEC_HAS_DLL == 1) +# if defined (SENDER_EXEC_BUILD_DLL) +# define SENDER_EXEC_Export ACE_Proper_Export_Flag +# define SENDER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SENDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SENDER_EXEC_BUILD_DLL */ +# define SENDER_EXEC_Export ACE_Proper_Import_Flag +# define SENDER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SENDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SENDER_EXEC_BUILD_DLL */ +#else /* SENDER_EXEC_HAS_DLL == 1 */ +# define SENDER_EXEC_Export +# define SENDER_EXEC_SINGLETON_DECLARATION(T) +# define SENDER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SENDER_EXEC_HAS_DLL == 1 */ + +// Set SENDER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SENDER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define SENDER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SENDER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SENDER_EXEC_NTRACE */ + +#if (SENDER_EXEC_NTRACE == 1) +# define SENDER_EXEC_TRACE(X) +#else /* (SENDER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SENDER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SENDER_EXEC_NTRACE == 1) */ + +#endif /* SENDER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/examples/Hello/Sender/Sender_stub_export.h b/modules/CIAO/examples/Hello/Sender/Sender_stub_export.h new file mode 100644 index 00000000000..28c5d3131d0 --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SENDER_STUB +// ------------------------------ +#ifndef SENDER_STUB_EXPORT_H +#define SENDER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (SENDER_STUB_HAS_DLL) +# define SENDER_STUB_HAS_DLL 1 +#endif /* ! SENDER_STUB_HAS_DLL */ + +#if defined (SENDER_STUB_HAS_DLL) && (SENDER_STUB_HAS_DLL == 1) +# if defined (SENDER_STUB_BUILD_DLL) +# define SENDER_STUB_Export ACE_Proper_Export_Flag +# define SENDER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SENDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SENDER_STUB_BUILD_DLL */ +# define SENDER_STUB_Export ACE_Proper_Import_Flag +# define SENDER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SENDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SENDER_STUB_BUILD_DLL */ +#else /* SENDER_STUB_HAS_DLL == 1 */ +# define SENDER_STUB_Export +# define SENDER_STUB_SINGLETON_DECLARATION(T) +# define SENDER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SENDER_STUB_HAS_DLL == 1 */ + +// Set SENDER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SENDER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define SENDER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SENDER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SENDER_STUB_NTRACE */ + +#if (SENDER_STUB_NTRACE == 1) +# define SENDER_STUB_TRACE(X) +#else /* (SENDER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SENDER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SENDER_STUB_NTRACE == 1) */ + +#endif /* SENDER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/examples/Hello/Sender/Sender_svnt_export.h b/modules/CIAO/examples/Hello/Sender/Sender_svnt_export.h new file mode 100644 index 00000000000..53236a883f2 --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/Sender_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl SENDER_SVNT +// ------------------------------ +#ifndef SENDER_SVNT_EXPORT_H +#define SENDER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (SENDER_SVNT_HAS_DLL) +# define SENDER_SVNT_HAS_DLL 1 +#endif /* ! SENDER_SVNT_HAS_DLL */ + +#if defined (SENDER_SVNT_HAS_DLL) && (SENDER_SVNT_HAS_DLL == 1) +# if defined (SENDER_SVNT_BUILD_DLL) +# define SENDER_SVNT_Export ACE_Proper_Export_Flag +# define SENDER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define SENDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* SENDER_SVNT_BUILD_DLL */ +# define SENDER_SVNT_Export ACE_Proper_Import_Flag +# define SENDER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define SENDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* SENDER_SVNT_BUILD_DLL */ +#else /* SENDER_SVNT_HAS_DLL == 1 */ +# define SENDER_SVNT_Export +# define SENDER_SVNT_SINGLETON_DECLARATION(T) +# define SENDER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* SENDER_SVNT_HAS_DLL == 1 */ + +// Set SENDER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (SENDER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define SENDER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define SENDER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !SENDER_SVNT_NTRACE */ + +#if (SENDER_SVNT_NTRACE == 1) +# define SENDER_SVNT_TRACE(X) +#else /* (SENDER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define SENDER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (SENDER_SVNT_NTRACE == 1) */ + +#endif /* SENDER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/modules/CIAO/examples/Hello/Sender/starter.cpp b/modules/CIAO/examples/Hello/Sender/starter.cpp new file mode 100644 index 00000000000..6fa219abfba --- /dev/null +++ b/modules/CIAO/examples/Hello/Sender/starter.cpp @@ -0,0 +1,90 @@ +//$Id$: + +#include "SenderC.h" +#include "ace/Get_Opt.h" + +// IOR file of the Sender +const char * ior = 0; +const char * message = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "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>\n", + argv [0]), + -1); + break; + } + } + + if (ior == 0) + { + ior = "file://Sender.ior"; + } + + 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 (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); + } + + if (message) + { + sender->local_message (message); + } + + sender->start (); + + orb->destroy (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Unknown exception \n"); + return -1; + } + + return 0; +} |