diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-18 22:40:09 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-03-18 22:40:09 +0000 |
commit | 848a2b66ed290374704819dadcfbbb1cd5b5fd7a (patch) | |
tree | dc76c0041838388291bfc5d1eac77613a7713df1 | |
parent | 7ba53db93beb1c9a77eb105421dc88811608282c (diff) | |
download | ATCD-848a2b66ed290374704819dadcfbbb1cd5b5fd7a.tar.gz |
*** empty log message ***
11 files changed, 353 insertions, 9 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index c601a85ae76..325e8fec87e 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,27 @@ +Tue Mar 18 16:36:07 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * bin/generate_component_mpc.pl: + * examples/handcrafted/Display/HUDisplay.mpc: + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/RateGen/RateGen.mpc: Updated the + script and regenerated mpc file to record the original options + used to generate the MPC files. + + * examples/handcrafted/Display/NOTE: Added more info on how to + generate Makefiles/Projects for this example. + + * examples/handcrafted/Display/RateGen/RateGen.idl: Fixed a typo. + + * examples/handcrafted/Display/RateGen/RateGen_Impl.idl: + * examples/handcrafted/Display/RateGen/RateGen_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.h: Added the + actual component and home implementations. This particular + component implementation shows how to suppoort SessionComponent + interface in a component implementation (you will need to do + that for any non-trivial component implementations that require + to access component-specific context.) + Tue Mar 18 12:03:29 2003 Nanbor Wang <nanbor@cs.wustl.edu> * examples/handcrafted/Hello/hello_servants.cpp: diff --git a/TAO/CIAO/bin/generate_component_mpc.pl b/TAO/CIAO/bin/generate_component_mpc.pl index 98f6a153790..d586eea49a1 100755 --- a/TAO/CIAO/bin/generate_component_mpc.pl +++ b/TAO/CIAO/bin/generate_component_mpc.pl @@ -81,6 +81,7 @@ project('."$com_name".'_exec) : ciao_server { sharedname = '."$com_name".'_exec libs += '."$com_name".'_stub '."$lib_depend $com_name".'_svnt'." $lib_paths".' + idlflags += -Wb,export_macro='."$UCOM_NAME".'_EXEC_Export -Wb,export_include='."$com_name".'_exec_export.h dllflags = '."$UCOM_NAME".'_EXEC_BUILD_DLL IDL_Files { @@ -93,7 +94,9 @@ project('."$com_name".'_exec) : ciao_server { '; } -$mpc_template = ' +$mpc_template = '// $Id$ +// This file is generated with "'."generate_component_mpc.pl $flags".'" + project('."$com_name".'_stub): ciao_client {'." $stub_depend".' sharedname = '."$com_name".'_stub diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc index 38d9b3353ea..45ec6323f66 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc @@ -1,3 +1,5 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay GPS" project(GPS_stub): ciao_client { depends += HUDisplay_stub @@ -39,6 +41,7 @@ project(GPS_exec) : ciao_server { sharedname = GPS_exec libs += GPS_stub HUDisplay_stub GPS_svnt libpaths += .. + idlflags += -Wb,export_macro=GPS_EXEC_Export -Wb,export_include=GPS_exec_export.h dllflags = GPS_EXEC_BUILD_DLL IDL_Files { diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc index da5fa8a1c89..8cfca3c4c42 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.mpc @@ -1,6 +1,7 @@ - +// $Id$ +// This file is generated with "generate_component_mpc.pl -n HUDisplay" project(HUDisplay_stub): ciao_client { - + sharedname = HUDisplay_stub idlflags += -Wb,stub_export_macro=HUDISPLAY_STUB_Export -Wb,stub_export_include=HUDisplay_stub_export.h -Wb,skel_export_macro=HUDISPLAY_SVNT_Export -Wb,skel_export_include=HUDisplay_svnt_export.h dllflags = HUDISPLAY_STUB_BUILD_DLL @@ -17,7 +18,8 @@ project(HUDisplay_stub): ciao_client { project(HUDisplay_svnt) : ciao_server { depends += HUDisplay_stub sharedname = HUDisplay_svnt - libs += HUDisplay_stub + libs += HUDisplay_stub + idlflags += -Wb,export_macro=HUDISPLAY_SVNT_Export -Wb,export_include=HUDisplay_svnt_export.h dllflags = HUDISPLAY_SVNT_BUILD_DLL @@ -31,3 +33,7 @@ project(HUDisplay_svnt) : ciao_server { HUDisplayEC.cpp } } + + + + diff --git a/TAO/CIAO/examples/handcrafted/Display/NOTE b/TAO/CIAO/examples/handcrafted/Display/NOTE index a8390e4fbfc..cdd8c162b22 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NOTE +++ b/TAO/CIAO/examples/handcrafted/Display/NOTE @@ -23,4 +23,9 @@ To generate mpc files: All others - generate_component_mpc.pl -l .. -p HUDisplay {RateGen|GPS|NavDisplay}
\ No newline at end of file + generate_component_mpc.pl -l .. -p HUDisplay {RateGen|GPS|NavDisplay} + +To generate Makefiles/Projects of your choice, try the following under +the current directory $(CIAO_ROOT)/examples/handcrafted/Display/: + + mwc -type <makefile type> -dynamic_only diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc index 5ad5fb82393..ec15621685f 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc @@ -1,3 +1,5 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay NavDisplay" project(NavDisplay_stub): ciao_client { depends += HUDisplay_stub @@ -39,6 +41,7 @@ project(NavDisplay_exec) : ciao_server { sharedname = NavDisplay_exec libs += NavDisplay_stub HUDisplay_stub NavDisplay_svnt libpaths += .. + idlflags += -Wb,export_macro=NAVDISPLAY_EXEC_Export -Wb,export_include=NavDisplay_exec_export.h dllflags = NAVDISPLAY_EXEC_BUILD_DLL IDL_Files { diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl index 4eaeb6a3c12..e5ec2552762 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl @@ -31,4 +31,4 @@ module HUDisplay }; }; -#endif /* RATEGEN_GEN */ +#endif /* RATEGEN_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc index 34323603450..f9a965b03b6 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc @@ -1,3 +1,5 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay RateGen" project(RateGen_stub): ciao_client { depends += HUDisplay_stub @@ -39,15 +41,15 @@ project(RateGen_exec) : ciao_server { sharedname = RateGen_exec libs += RateGen_stub HUDisplay_stub RateGen_svnt libpaths += .. + idlflags += -Wb,export_macro=RATEGEN_EXEC_Export -Wb,export_include=RateGen_exec_export.h dllflags = RATEGEN_EXEC_BUILD_DLL IDL_Files { + RateGen_Impl.idl } Source_Files { + RateGen_ImplC.cpp RateGen_exec.cpp } } - - - diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenEI.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenEI.idl new file mode 100644 index 00000000000..9913c91c76f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenEI.idl @@ -0,0 +1,31 @@ +// $Id$ + +/** + * @file RateGen_Impl.idl + * + * Definition of the RateGen (a rate generator) component implementation. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef RATEGEN_IMPL_IDL +#define RATEGEN_IMPL_IDL + +#include "RateGenE.idl" + +module HUDisplay +{ + /** + * @interface RateGen_Exec + * + * The actually RateGen executor need to support + * Components::SessionComponent interface. Therefore, we need to + * define the component executor interface explicitly here. + */ + local interface RateGen_Exec : CCM_RateGen, Components::SessionComponent + { + }; + +}; + +#endif /* RATEGEN_IMPL_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp new file mode 100644 index 00000000000..c18637240e0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp @@ -0,0 +1,142 @@ +// $Id$ + +#include "RateGen_exec.h" + +MyImpl::RateGen_exec_impl::RateGen_exec_impl () + : active_ (0), + hertz_ (0) +{ + +} + +MyImpl::RateGen_exec_impl::RateGen_exec_impl (CORBA::Long hz) + : active_ (0), + hertz_ (hz) +{ +} + +MyImpl::RateGen_exec_impl::~RateGen_exec_impl () +{ +} + +CORBA::Long +MyImpl::RateGen_exec_impl::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->hertz_; +} + +void +MyImpl::RateGen_exec_impl::hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->hertz_ = hertz; +} + +// Operations from supported interface(s) + +void +MyImpl::RateGen_exec_impl::start (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (this->hertz_ == 0 || this->active_) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ Start the rate generator + +} + +void +MyImpl::RateGen_exec_impl::stop (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (! this->active_) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ stop the rate generator +} + +CORBA::Boolean +MyImpl::RateGen_exec_impl::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->active_ != 0; +} + +// Operations from Components::SessionComponent + +void +MyImpl::RateGen_exec_impl::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_RateGen_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. + +} + +void +MyImpl::RateGen_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_activate\n")); +} + +void +MyImpl::RateGen_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_passivate\n")); +} + +void +MyImpl::RateGen_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_remove\n")); +} + +MyImpl::RateGenHome_exec_impl::RateGenHome_exec_impl () +{ +} + +MyImpl::RateGenHome_exec_impl::~RateGenHome_exec_impl () +{ +} + +::Components::EnterpriseComponent_ptr +MyImpl::RateGenHome_exec_impl::new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + return new MyImpl::RateGen_exec_impl (hertz); +} + +::Components::EnterpriseComponent_ptr +MyImpl::RateGenHome_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + return new MyImpl::RateGen_exec_impl (); +} + + +extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr +createRateGenHome_Impl (void) +{ + return new MyImpl::RateGenHome_exec_impl (); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h new file mode 100644 index 00000000000..f2150aa4c07 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h @@ -0,0 +1,125 @@ +// $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_ImplC.h" +#include "tao/LocalObject.h" + +namespace MyImpl +{ + /** + * @class RateGen_exec_impl + * + * RateGen executor implementation class. + */ + class RATEGEN_EXEC_Export RateGen_exec_impl : + public virtual HUDisplay::RateGen_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + RateGen_exec_impl (); + + /// Initialize with a default frequency. + RateGen_exec_impl (CORBA::Long hz); + + /// Default destructor. + ~RateGen_exec_impl (); + + // Attribute operations. + + virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from supported interface(s) + + virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean active (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + protected: + /// status + int active_; + + /// Frequency + CORBA::Long hertz_; + + /// Copmponent specific context + HUDisplay::CCM_RateGen_Context_var context_; + }; + + /** + * @class RateGenHome_exec_impl + * + * RateGen home executor implementation class. + */ + class RATEGEN_EXEC_Export RateGenHome_exec_impl : + public virtual HUDisplay::CCM_RateGenHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + RateGenHome_exec_impl (); + + /// Default dtor. + ~RateGenHome_exec_impl (); + + // Explicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + }; +} + +extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr +createRateGenHome_Impl (void); + +#endif /* RATEGEN_EXEC_H */ |