From c0617df38dd0bb482f18aa62f56c8b20eda1e594 Mon Sep 17 00:00:00 2001 From: nanbor Date: Thu, 13 Mar 2003 05:42:09 +0000 Subject: *** empty log message *** --- TAO/CIAO/ChangeLog | 37 ++ TAO/CIAO/bin/generate_component_mpc.pl | 15 +- TAO/CIAO/docs/releasenotes.html | 8 + .../docs/templates/CIAO_Glue_Session_Template.cpp | 290 ++++++---- .../docs/templates/CIAO_Glue_Session_Template.h | 97 ++-- .../docs/templates/CIAO_Glue_Session_Template.inl | 132 +---- TAO/CIAO/docs/templates/Executor.idl | 31 +- TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc | 6 +- .../examples/handcrafted/Display/HUDisplay.idl | 17 + .../examples/handcrafted/Display/HUDisplayE.idl | 13 + TAO/CIAO/examples/handcrafted/Display/NOTE | 12 + .../handcrafted/Display/NavDisplay/NavDisplay.mpc | 6 +- .../handcrafted/Display/RateGen/RateGen.idl | 19 +- .../handcrafted/Display/RateGen/RateGen.mpc | 6 +- .../handcrafted/Display/RateGen/RateGenE.idl | 28 +- .../handcrafted/Display/RateGen/RateGen_svnt.cpp | 594 +++++++++++++++++++++ .../handcrafted/Display/RateGen/RateGen_svnt.h | 377 +++++++++++++ .../handcrafted/Display/RateGen/RateGen_svnt.inl | 235 ++++++++ 18 files changed, 1610 insertions(+), 313 deletions(-) create mode 100644 TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp create mode 100644 TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h create mode 100644 TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.inl diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 256ecdba4e0..2cd4bc03859 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,40 @@ +Wed Mar 12 23:29:27 2003 Nanbor Wang + + * bin/generate_component_mpc.pl: Fixed an incomplete library + expansion and added a flag to specify library path + dependencies. + + * docs/releasenotes.html: Updated the status of single component + deployment capability. I forgot to do that when it was done. + + * examples/handcrafted/Display/NOTE: Added directions on how to + generate various mpc files. + + * examples/handcrafted/Display/GPS/GPS.mpc: + * examples/handcrafted/Display/NavDisplay/NavDisplay.mpc: + * examples/handcrafted/Display/RateGen/RateGen.mpc: Regenerated + MPC files to fix incomplete dependent library names and to add + library path dependencies. + + * examples/handcrafted/Display/HUDisplay.idl: + * examples/handcrafted/Display/RateGen/RateGen.idl: + * examples/handcrafted/Display/HUDisplayE.idl: + * examples/handcrafted/Display/RateGen/RateGenE.idl: Moved the + opmode interface definition from RateGen.idl back to + HUDisplay.idl. This interface is a supported interface of + RateGen but it should be viewed as a shared interface. + + * examples/handcrafted/Display/RateGen/RateGen_svnt.cpp: + * examples/handcrafted/Display/RateGen/RateGen_svnt.h: + * examples/handcrafted/Display/RateGen/RateGen_svnt.inl: Added + more handcrafted servant glue code for RateGen component. + + * docs/templates/CIAO_Glue_Session_Template.cpp: + * docs/templates/CIAO_Glue_Session_Template.h: + * docs/templates/CIAO_Glue_Session_Template.inl: + * docs/templates/Executor.idl: Updated and fixed CIDL template + code based on results from using these templates manually. + Wed Mar 12 00:03:56 2003 Nanbor Wang * examples/handcrafted/Display/HUDisplay_svnt.h: diff --git a/TAO/CIAO/bin/generate_component_mpc.pl b/TAO/CIAO/bin/generate_component_mpc.pl index 079ee613f71..98f6a153790 100755 --- a/TAO/CIAO/bin/generate_component_mpc.pl +++ b/TAO/CIAO/bin/generate_component_mpc.pl @@ -12,11 +12,12 @@ use Getopt::Std; $flags = join (" ", @ARGV); -if (!getopts ('dcnp:h') || $opt_h) { +if (!getopts ('dcnp:l:h') || $opt_h) { print "generate_component_mpc.pl [-d] [-h] component_name\n"; print "\n"; print " -d Turn on debug mode\n"; print " -p Dependent component name\n"; + print " -l Dependent component path\n"; print " -n Supress component make/project\n"; print " -c Create a client makefile\n"; print "\n"; @@ -48,7 +49,11 @@ $UCOM_NAME = uc $com_name; if (defined $opt_p) { $stub_depend = "depends += $opt_p".'_stub'; $svnt_depend = "$opt_p".'_svnt'; - $lib_depend = "$opt_t".'_stub'; + $lib_depend = "$opt_p".'_stub'; +} + +if (defined $opt_l) { + $lib_paths = "libpaths += $opt_l"; } if (defined $opt_c) { @@ -74,7 +79,8 @@ if (! defined $opt_n) { project('."$com_name".'_exec) : ciao_server { depends += '."$com_name".'_svnt sharedname = '."$com_name".'_exec - libs += '."$com_name".'_stub '."$lib_depend $com_name".'_svnt + libs += '."$com_name".'_stub '."$lib_depend $com_name".'_svnt'." + $lib_paths".' dllflags = '."$UCOM_NAME".'_EXEC_BUILD_DLL IDL_Files { @@ -106,7 +112,8 @@ project('."$com_name".'_stub): ciao_client {'." project('."$com_name".'_svnt) : ciao_server { depends += '."$svnt_depend $com_name".'_stub sharedname = '."$com_name".'_svnt - libs += '."$com_name".'_stub'." $lib_depend".' + libs += '."$com_name".'_stub'." $lib_depend + $lib_paths".' idlflags += -Wb,export_macro='."$UCOM_NAME".'_SVNT_Export -Wb,export_include='."$com_name".'_svnt_export.h dllflags = '."$UCOM_NAME".'_SVNT_BUILD_DLL diff --git a/TAO/CIAO/docs/releasenotes.html b/TAO/CIAO/docs/releasenotes.html index 3ce005664cb..0d76db1ca40 100644 --- a/TAO/CIAO/docs/releasenotes.html +++ b/TAO/CIAO/docs/releasenotes.html @@ -20,6 +20,14 @@
  • Latest News

      +
    • Thu Mar 6 2003 - The HelloWorld now uses the new command + Daemon control options to read in the component softpkg + descriptor, spawn a ComponentServer, and instantiate the + component. See the + + run_test.pl for more details on how this can be + done.

      +

    • Sun Feb 16 2003 - A new implementation for the per-host daemon process is now availabe under $(CIAO_ROOT)/tools/Daemon/. This application diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp index 39640c41cb4..3c6fa420294 100644 --- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp @@ -12,10 +12,11 @@ /// container glue code. /// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -#include "[idl-basename]GS.h" +#include "[idl-basename]_svnt.h" +#include "Cookies.h" #if !defined (__ACE_INLINE__) -# include "[idl-basename]GS.inl" +# include "[idl-basename]_svnt.inl" #endif /* __ACE_INLINE__ */ ////////////////////////////////////////////////////////////////// @@ -64,73 +65,6 @@ template class TAO::Utils::Servant_Var<[facet type]>; // Component specific context implementation ////////////////////////////////////////////////////////////////// -void * -[ciao module name]::[component name]_Context::_tao_QueryInterface (ptr_arith_t type) -{ - void *retv = 0; - - if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &CCM_[component name]_Context::_tao_class_id) - ) - { - retv = ACE_reinterpret_cast (void*, this); // Does this look right? - } - else if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &::Components::SessionContext::_tao_class_id) - ) - { - retv = - ACE_reinterpret_cast ( - void *, - ACE_static_cast ( - Components::SessionContext_ptr, - this - ) - ); - } - else if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &::Components::CCMContext::_tao_class_id) - ) - { - retv = - ACE_reinterpret_cast ( - void *, - ACE_static_cast ( - Components::CCMContext_ptr, - this - ) - ); - } - else if (type == ACE_reinterpret_cast ( - ptr_arith_t, - &CORBA::Object::_tao_class_id) - ) - { - retv = - ACE_reinterpret_cast ( - void *, - ACE_static_cast (CORBA::Object_ptr, this) - ); - } - - if (retv != 0) - { - this->_add_ref (); - } - - return retv; -} - -const char* -[ciao module name]::[component name]_Context::_interface_repository_id (void) const -{ - // replay to - return CCM_[component]_Context::_interface_repository_id (); -} - ##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: ## if ([receptacle name] is a multiplex ('uses multiple') receptacle) // [receptacle name]Connections typedef'ed as a sequence of @@ -145,13 +79,15 @@ const char* new [receptacle name]Connections (this->ciao_muses_[receptacle name]_.current_size ()); CORBA::ULong i = 0; - CIAO::Active_Objref_Map::iterator end = this->ciso_muses_[receptacle name]_.end (); - for (CIAO::Active_Objref_Map::iterator iter = this->ciso_muses_[receptacle name]_.begin (); + ACE_Active_Map_Manager<[uses type]_var>::iterator + end = this->ciso_muses_[receptacle name]_.end (); + for (ACE_Active_Map_Manager<[uses type]_var>::iterator + iter = this->ciso_muses_[receptacle name]_.begin (); iter != end; ++iter) { - CIAO::Active_Objref_Map::ENTRY &entry = *iter; - retv[i].objref = [uses type]::_narrow (entry.in_id_.in ()); + ACE_Active_Map_Manager<[uses type]_var>::ENTRY &entry = *iter; + retv[i].objref = [uses type]::_narrow (entry.int_id_.in ()); retv[i].ck = new CIAO::Map_Key_Cookie (entry.ext_id_); ++i; } @@ -170,15 +106,17 @@ void this->ciao_emits_[event name]_consumer_->push_[event name] (ev ACE_ENV_ARG_PARAMETER); ## else [event name] belongs to a 'publishes' port - CIAO::Active_Objref_Map::iterator end = this->ciao_publishes_[event name]_map_.end (); - for (CIAO::Active_Objref_Map::iterator iter = this->ciao_publishes_[event name]_map_.begin (); + ACE_Active_Map_Manager<[eventtype]Consumer_var>::iterator + end = this->ciao_publishes_[event name]_map_.end (); + for (ACE_Active_Map_Manager<[eventtype]Consumer_var>::iterator + iter = this->ciao_publishes_[event name]_map_.begin (); iter != end; ++iter) { - CIAO::Active_Objref_Map::ENTRY &entry = *iter; - [eventtype]Consumer_var c = [eventtype]Consumer::_narrow (entry.in_id_.in ()); - c->push_[event name] (ev - ACE_ENV_ARG_PARAMETER); + ACE_Active_Map_Manager<[eventtype]Consumer_var>::ENTRY &entry = *iter; + [eventtype]Consumer_var c = [eventtype]Consumer::_narrow (entry.int_id_.in ()); + c->push_[eventtype] (ev + ACE_ENV_ARG_PARAMETER); ACE_CHECK; } ## endif [event name] @@ -187,6 +125,130 @@ void ##end foreach [event name] with [eventtype] +// Operations for publishes interfaces. +##foreach [publish name] with [eventtype] in (list of all publishers) generate: +ACE_INLINE ::Components::Cookie_ptr +[ciao module name]::[component name]_Context::subscribe_[publish name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_[publish name]_map_.bind (c, + key); + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +ACE_INLINE [eventtype]Consumer_ptr +[ciao module name]::[component name]_Context::unsubscribe_[publish name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + [eventtype]Consumer_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_publishes_[publish name]_map_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +##end foreach [publish name] with [eventtype] + +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: + +## if [receptacle name] is a simplex receptacle ('uses') + +ACE_INLINE [uses type]_ptr +[ciao module name]::[component name]_Context::get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return [uses type]::_duplicate (this->ciao_uses_[receptacle name]_.in ()); +} + +// Simplex [receptacle name] connection management operations +ACE_INLINE void +[ciao module name]::[component name]_Context::connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + if (! CORBA::is_nil (this->ciao_uses_[receptacle name]_.in ())) + ACE_THROW (::Components::AlreadyConnected ()); + + if (CORBA::is_nil (c)) + ACE_THROW (::Components::InvalidConnection ()); + + // When do we throw InvalidConnection exception? + this->ciao_uses_[receptacle name]_ = [uses type]::_duplicate (c); +} + +ACE_INLINE [uses type]_ptr +[ciao module name]::[component name]_Context::disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + if (CORBA::is_nil (this->ciao_uses_[receptacle name]_.in ())) + ACE_THROW (::Components::NoConnection ()); + + return this->ciao_uses_[receptacle name]_.retn (); +} + +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) +// Multiplex [receptacle name] connection management operations +ACE_INLINE ::Components::Cookie_ptr +[ciao module name]::[component name]_Context::connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceedConnectionLimit, + ::Components::InvalidConnection)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + ACE_Active_Map_Manager_Key key; + this->ciao_muses_[receptacle name]_.bind (c, + key); + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +ACE_INLINE [uses type]_ptr +[ciao module name]::[component name]_Context::disconnect_[receptacle name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + [uses type]_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_muses_[receptacle name]_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] + // Operations for ::Components::SessionContext interface CORBA::Object_ptr [ciao module name]::[component name]_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) @@ -217,13 +279,6 @@ CORBA::Object_ptr // Component Servant Glue code implementation ////////////////////////////////////////////////////////////////// -##foreach [operation] in all supported interfaces of own component and all inherited components - - // Generate the [operation] here. - - -##end - // Operations for provides interfaces. ##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: @@ -430,12 +485,20 @@ CORBA::Boolean ##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: if (ACE_OS_String::strcmp (name, "[receptacle name]") == 0) { + [uses type]_var _ciao_conn = + [uses type]::_narrow (connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_conn.in ())) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + ## if [receptacle name] is a simplex receptacle ('uses') - this->connect_[receptacle name] (connection + this->connect_[receptacle name] (_caio_conn.in () ACE_ENV_ARG_PARAMETER); return 0; ## else ([receptacle name] is a multiplex ('uses multiple') receptacle) - return this->connect_[receptacle name] (connection + return this->connect_[receptacle name] (_ciao_conn.in () ACE_ENV_ARG_PARAMETER); ## endif [receptacle name] } @@ -601,8 +664,16 @@ CORBA::Object_ptr ##foreach [publish name] with [eventtype] in (list of all publishers) generate: if (ACE_OS_String::strcmp (publisher_name, "[publish name]") == 0) { - return this->subscribe_[publish name] (subscriber - ACE_ENV_ARG_PARAMTER); + [eventtype]Consumer_var _ciao_consumer = + [eventtype]Consumer::_narrow (subscriber + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW_RETURN (Components::InvalidConnection (), 0); + + return this->subscribe_[publish name] (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); } ##end foreach [publish name] with [eventtype] @@ -625,7 +696,7 @@ CORBA::Object_ptr if (ACE_OS_String::strcmp (publisher_name, "[publish name]") == 0) { return this->unsubscribe_[publish name] (ck - ACE_ENV_ARG_PARAMTER); + ACE_ENV_ARG_PARAMETER); } ##end foreach [publish name] with [eventtype] @@ -643,18 +714,26 @@ void { // @@ We can omit this if clause if there's no emitter in this component. if (emitter_name == 0) - ACE_THROW_RETURN (Components::InvalidName (), 0); + ACE_THROW (Components::InvalidName ()); ##foreach [emit name] with [eventtype] in (list of all emitters) generate: if (ACE_OS_String::strcmp (emitter_name, "[emit name]") == 0) { - this->connect_[emit name] (consumer - ACE_ENV_ARG_PARAMTER); + [eventtype]Consumer_var _ciao_consumer = + [eventtype]Consumer::_narrow (consumer + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW (Components::InvalidConnection); + + this->connect_[emit name] (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); return; } ##end foreach [emit name] with [eventtype] - ACE_THROW_RETURN (Components::InvalidName (), 0); + ACE_THROW (Components::InvalidName ()); } ::Components::EventConsumerBase_ptr @@ -671,7 +750,7 @@ void ##foreach [emit name] with [eventtype] in (list of all emitters) generate: if (ACE_OS_String::strcmp (source_name, "[emit name]") == 0) { - return this->disconnect_[emit name] (ACE_ENV_SINGLE_ARG_PARAMTER); + return this->disconnect_[emit name] (ACE_ENV_SINGLE_ARG_PARAMETER); } ##end foreach [emit name] with [eventtype] @@ -777,6 +856,7 @@ void // Need to add interfaces in the Context class to gather the information. // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); } ::Components::PublisherDescriptions * @@ -789,6 +869,7 @@ void // Need to add interfaces in the Context class to gather the information. // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); } // Operations for CCMObject interface @@ -840,7 +921,7 @@ void ACE_THROW_SPEC ((CORBA::SystemException)) { ::Components::ComponentPortDescription_var retv = - new ::Components::ComponentPortDescription; + new OBV_Components::ComponentPortDescription; ::Components::FacetDescriptions_var facets_desc = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -906,7 +987,7 @@ CORBA::Object_ptr ////////////////////////////////////////////////////////////////// [component name]_ptr -[ciao module name]::[home name]_Servant::_ciao_create_helper (::Components::EnterpriseComponent_ptr c +[ciao module name]::[home name]_Servant::_ciao_create_helper (::Components::EnterpriseComponent_ptr com ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CreateFailure)) @@ -920,13 +1001,14 @@ CORBA::Object_ptr ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - ::Components::[home name]_var home = ::Components::[home name]::_narrow (hobj.in () - ACE_ENV_ARG_PARAMETER); + [home name]_var home = [home name]::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - CIAO_[component name]_Servant *svt = new CIAO_[component name]_Servant (hw.in (), - home.in (), - this->container_); + [ciao module name]::[component name]_Servant *svt = + new [ciao module name]::[component name]_Servant (hw.in (), + home.in (), + this->container_); return svt->_ciao_activate_component (ACE_ENV_ARG_PARAMETER); } @@ -955,7 +1037,7 @@ void Components::RemoveFailure)) { if (CORBA::is_nil (comp)) - ACE_THROW (CORBA::INTERNAL (), 0); // What is the right exception to throw here? + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? comp->remove (ACE_ENV_ARG_PARAMETER); ACE_CHECK; diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h index 9a55d4b382a..2b4fdb0ccc3 100644 --- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h @@ -24,6 +24,7 @@ #include "[idl-name]EC.h" // Source in the executor mapping // that component implementations use #include "ciao/Container_Base.h" //Source in the container interface definitions +#include "ace/Active_Map_Manager_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -84,11 +85,8 @@ namespace CIAO_GLUE ////////////////////////////////////////////////////////////////// // Component specific context implementation class [SERVANT]_Export [component name]_Context : - public virtual CCM_[component name]_Context - // @@ The following line is causing compiler to barf, what gives? - // It looks like we need to overwrite _repository_id and - // _tao_QueryInterface operations here. - // , public virtual ::Components::SessionContext + public virtual CCM_[component name]_Context, + public virtual ::Components::CCMContext { public: // We will allow the the servant glue code we generate to access @@ -103,14 +101,6 @@ namespace CIAO_GLUE // Dtor. virtual ~[component name]_Context (); - // We need to overwrite the following method to avoid ambiguity - // This is strange, but thankfully, this is generated code so it's - // okay (?) to mess with this. - - virtual void *_tao_QueryInterface (ptr_arith_t type); - - virtual const char* _interface_repository_id (void) const; - // Operations for [component name] event source, and // receptacles defined in CCM_[component name]_Context. @@ -127,7 +117,8 @@ namespace CIAO_GLUE ##end foreach [receptacle name] with [uses type] ##foreach [event name] with [eventtype] in (list of all event sources) generate: - void push_[event name] ([eventtype]_ptr ev ACE_ENV_ARG_DECL_WITH_DEFAULTS) + void push_[event name] ([eventtype]_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); ##end foreach [event name] with [eventtype] @@ -186,7 +177,7 @@ namespace CIAO_GLUE // Multiplex [receptacle name] connections - CIAO::Active_Objref_Map ciao_muses_[receptacle name]_; + ACE_Active_Map_Manager<[uses type]_var> ciao_muses_[receptacle name]_; ## endif [receptacle name] ##end foreach [receptacle name] with [uses type] @@ -218,7 +209,7 @@ namespace CIAO_GLUE ACE_THROW_SPEC ((CORBA::SystemException, ::Components::InvalidConnection)); - CIAO::Active_Objref_Map ciao_publishes_[publish name]_map_; + ACE_Active_Map_Manager<[eventtype]Consumer_var> ciao_publishes_[publish name]_map_; ##end foreach [publish name] with [eventtype] protected: @@ -259,7 +250,7 @@ namespace CIAO_GLUE // Operations for provides interfaces. ##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: - [facet type]_ptr provide_[facet name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual [facet type]_ptr provide_[facet name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); ##end foreach [facet name] with [facet type] @@ -268,28 +259,28 @@ namespace CIAO_GLUE ##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: ## if [receptacle name] is a simplex receptacle ('uses') // Simplex [receptacle name] connection management operations - void connect_[receptacle name] ([uses type]_ptr c - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::AlreadyConnected, ::Components::InvalidConnection)); - [uses type]_ptr disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual [uses type]_ptr disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::NoConnection)); - [uses type]_ptr get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual [uses type]_ptr get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); ## else ([receptacle name] is a multiplex ('uses multiple') receptacle) // Multiplex [receptacle name] connection management operations - ::Components::Cookie_ptr connect_[receptacle name] ([uses type]_ptr c - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual ::Components::Cookie_ptr connect_[receptacle name] ([uses type]_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::ExceedConnectionLimit, ::Components::InvalidConnection)); - [uses type]_ptr disconnect_[receptacle name] (::Components::Cookie_ptr ck - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual [uses type]_ptr disconnect_[receptacle name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::InvalidConnection)); - [receptacle name]Connections *get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual [receptacle name]Connections *get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); ## endif [receptacle name] ##end foreach [receptacle name] with [uses type] @@ -309,14 +300,14 @@ namespace CIAO_GLUE ~[event type]Consumer-[consumer name]_Servant (); ## foreach [type] in ([eventtype] and all its parent eventtype, if any) - void push_[type] ([type]_ptr evt - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void push_[type] ([type]_ptr evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); ## end [type] // Inherit from ::Compopnents::EventBConsumerBase - void push_event (EventBase_ptr ev - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void push_event (EventBase_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::BadEventType)); @@ -324,7 +315,7 @@ namespace CIAO_GLUE virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - protected: + protected: // Consumer Executor CCM_[component name]_var executor_; @@ -332,33 +323,33 @@ namespace CIAO_GLUE CCM_[component name]_Context_var ctx_; }; - [eventtype]Consumer_ptr get_consumer_[consumer name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual [eventtype]Consumer_ptr get_consumer_[consumer name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); ##end foreach [consumer name] with [eventtype] // Operations for emits interfaces. ##foreach [emit name] with [eventtype] in (list of all emitters) generate: - void connect_[emit name] ([eventtype]Consumer_ptr c - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void connect_[emit name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException ::Components::AlreadyConnected)); - [eventtype]Consumer_ptr disconnect_[emit name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual [eventtype]Consumer_ptr disconnect_[emit name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::NoConnection)); ##end foreach [emit name] with [eventtype] // Operations for publishes interfaces. ##foreach [publish name] with [eventtype] in (list of all publishers) generate: - ::Components::Cookie_ptr - subscribe_[publish name] ([eventtype]Consumer_ptr c - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual ::Components::Cookie_ptr + subscribe_[publish name] ([eventtype]Consumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::ExceededConnectionLimit)); - [eventtype]Consumer_ptr - unsubscribe_[publish name] (::Components::Cookie_ptr ck - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual [eventtype]Consumer_ptr + unsubscribe_[publish name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::InvalidConnection)); ##end foreach [publish name] with [eventtype] @@ -488,7 +479,7 @@ namespace CIAO_GLUE CCM_[component name]_var executor_; // My Run-time Context. - CCM_[component name]_Context_var context_; + [component name]_Context *context_; // Managing container. ::CIAO::Session_Container *container_; @@ -522,27 +513,27 @@ namespace CIAO_GLUE ~[home name]_Servant (void); // User defined and inherited operations - // (Factories, Finders, and explicit operations.) - ##foreach [operation] in (all explicit operations in [home basename] including its parents) // The operation decl here. ## end foreach opeartion + // Factory operations ##foreach [factory name] in (all factory operations in [home basename] including its parents) // for factory operations inherit from parent home(s), they should return // the corresponding component types their homes manage - [component name]_ptr [factory name] (.... ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual [component name]_ptr [factory name] (.... ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::CreateFailure, ....)); ##end foreach [factory name] + // Finder operations ##foreach [finder name] in (all finder operations in [home basename] including its parents) // for finder operations inherit from parent home(s), they should return // the corresponding component types their homes manage - [component name]_ptr [finder name] (.... ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual [component name]_ptr [finder name] (.... ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, Components::FinderFailure, ....)); @@ -559,25 +550,29 @@ namespace CIAO_GLUE // We do not support key'ed home at the moment but we might // as well generate the mapping. - [component name]_ptr create ([key type]_ptr key) + virtual [component name]_ptr create ([key type]_ptr key + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::CreationFailure, ::Components::DuplicateKeyValue, ::Components::InvalidKey)); - [component name]_ptr find_by_primary_key ([key type]_ptr key) + virtual [component name]_ptr find_by_primary_key ([key type]_ptr key + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::FinderFailure, ::Components::UnknownKeyValue, ::Components::InvalidKey)); - void remove ([key type]_ptr key) + virtual void remove ([key type]_ptr key + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::RemoveFailure, ::Components::UnknownKeyValue, ::Components::InvalidKey)); - [key type]_ptr get_primary_key ([component name]_ptr comp) + virtual [key type]_ptr get_primary_key ([component name]_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); ## endif (keyed or keyless home) @@ -620,7 +615,7 @@ namespace CIAO_GLUE #endif #if defined (__ACE_INLINE__) -# include "[idl-basename]_SVNT.inl" +# include "[idl-basename]_svnt.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl index cff99446301..865ab29bc67 100644 --- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl @@ -62,7 +62,7 @@ ACE_INLINE [ciao module name]::[component name]_Context::[component name]_Context (::Components::CCMHome_ptr home, ::CIAO::Session_Container *c, [component name]_Servant *sv) - : home_ (::Components::CCMHome::_duplicate (h)), + : home_ (::Components::CCMHome::_duplicate (home)), container_ (c), servant_ (sv) { @@ -74,85 +74,6 @@ ACE_INLINE { } -##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: - -## if [receptacle name] is a simplex receptacle ('uses') - -ACE_INLINE [uses type]_ptr -[ciao module name]::[component name]_Context::get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return [uses type]::_duplicate (this->ciao_uses_[receptacle name]_.in ()); -} - -// Simplex [receptacle name] connection management operations -ACE_INLINE void -[ciao module name]::[component name]_Context::connect_[receptacle name] ([uses type]_ptr c - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::AlreadyConnected, - ::Components::InvalidConnection)) -{ - if (! CORBA::is_nil (this->ciao_uses_[receptacle name]_.in ())) - ACE_THROW (::Components::AlreadyConnected ()); - - if (CORBA::is_nil (c)) - ACE_THROW (::Components::InvalidConnection ()); - - // When do we throw InvalidConnection exception? - this->ciao_uses_[receptacle name]_ = [uses type]::_duplicate (c); -} - -ACE_INLINE [uses type]_ptr -[ciao module name]::[component name]_Context::disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::NoConnection)) -{ - if (CORBA::is_nil (this->ciao_uses_[receptacle name]_.in ())) - ACE_THROW (::Components::NoConnection ()); - - return this->ciao_uses_[receptacle name]_.retn (); -} - -## else ([receptacle name] is a multiplex ('uses multiple') receptacle) -// Multiplex [receptacle name] connection management operations -ACE_INLINE ::Components::Cookie_ptr -[ciao module name]::[component name]_Context::connect_[receptacle name] ([uses type]_ptr c - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::ExceedConnectionLimit, - ::Components::InvalidConnection)) -{ - if (CORBA::is_nil (c)) - ACE_THROW_RETURN (::Components::InvalidConnection (), 0); - - ACE_Active_Map_Manager_Key key; - this->ciao_muses_[receptacle name]_.bind (c, - key); - - ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); - return retv._retn (); -} - -ACE_INLINE [uses type]_ptr -[ciao module name]::[component name]_Context::disconnect_[receptacle name] (::Components::Cookie_ptr ck - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::InvalidConnection)) -{ - [uses type]_var retv; - - if (ck == 0 || - this->ciao_muses_[receptacle name]_.unbind (*ck, - retv) != 0) - ACE_THROW_RETURN (::Components::InvalidConnection (), 0); - - return retv._retn (); -} - -## endif [receptacle name] -##end foreach [receptacle name] with [uses type] - // Operations for emits interfaces. ##foreach [emit name] with [eventtype] in (list of all emitters) generate: @@ -184,43 +105,6 @@ ACE_INLINE [eventtype]Consumer_ptr ##end foreach [emit name] with [eventtype] - // Operations for publishes interfaces. -##foreach [publish name] with [eventtype] in (list of all publishers) generate: -ACE_INLINE ::Components::Cookie_ptr -[ciao module name]::[component name]_Context::subscribe_[publish name] ([eventtype]Consumer_ptr c - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::ExceededConnectionLimit)) -{ - if (CORBA::is_nil (c)) - ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); - - CIAO::Active_Objref_Map::key_type key; - this->ciao_publishes_[publish name]_map_.bind (c, - key); - - ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); - return retv._retn (); -} - -ACE_INLINE [eventtype]Consumer_ptr -[ciao module name]::[component name]_Context::unsubscribe_[publish name] (::Components::Cookie_ptr ck - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - ::Components::InvalidConnection)); -{ - [eventtype]Consumer_var retv; - - if (ck == 0 || - this->ciao_publishes_[publish name]_map_.unbind (ck, - retv) != 0) - ACE_THROW_RETURN (::Components::InvalidConnection (), 0); - - return retv._retn (); -} - -##end foreach [publish name] with [eventtype] - // Operations for ::Components::CCMContext ACE_INLINE ::Components::Principal_ptr [ciao module name]::[component name]_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) @@ -292,9 +176,10 @@ ACE_INLINE ACE_INLINE [ciao module name]::[component name]_Servant::~[component name]_Servant (void) { + this->context_->_remove_ref (); } -##foreach [operation] in all supported interfaces of own component and all inherited components +##foreach [operation] in all supported interfaces of own component and all inherited components and attribute accessors/mutators // This is only a guideline... we always relay the operation to underlying // executor. @@ -458,7 +343,7 @@ ACE_INLINE ::Components::Cookie_ptr ::Components::ExceededConnectionLimit)) { return this->context_->subscribe_[publish name] (c - ACE_ENV_ARG_PARAMATER); + ACE_ENV_ARG_PARAMETER); } ACE_INLINE [eventtype]Consumer_ptr @@ -508,7 +393,8 @@ ACE_INLINE [component name]_ptr this->executor_->[factory name] (.... ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - return this->create_helper (com ACE_ENV_ARG_PARAMETER); + return this->_ciao_create_helper (com + ACE_ENV_ARG_PARAMETER); } ##end foreach [factory name] @@ -527,7 +413,8 @@ ACE_INLINE [component name]_ptr // Do we create a new object reference referring to the same object, // or do we try to create a different objref referring to the same object? - return this->create_helper (com ACE_ENV_ARG_PARAMETER); + return this->_ciao_create_helper (com + ACE_ENV_ARG_PARAMETER); } ##end foreach [finder name] @@ -606,7 +493,8 @@ ACE_INLINE ::CORBA::IRObject_ptr ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); } -ACE_INLINE CORBA::IRObject_ptr get_home_def (ACE_ENV_SINGLE_ARG_DECL) +ACE_INLINE CORBA::IRObject_ptr +[ciao module name]::[home name]_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { // @@ TO-DO. Contact IfR? diff --git a/TAO/CIAO/docs/templates/Executor.idl b/TAO/CIAO/docs/templates/Executor.idl index be8bbdb29cc..820ff340fcf 100644 --- a/TAO/CIAO/docs/templates/Executor.idl +++ b/TAO/CIAO/docs/templates/Executor.idl @@ -28,11 +28,28 @@ // For various definitions of container // internal/callback interfaces #include "[component_idl].idl" // Original component IDL definition +// @@ We may need to include other *E.idl here.... Can't figure out +// if we can do this automagically or not. ##if there are module definitions, preserve them all module [module_name] { ##endif +//////////////////////////////////////////////////////////////////// +//// * Iterate thru all supported interface types +//// It's possible that we need to put some of the common supported +//// interface definitions into a separate compilation unit. How do we +//// specify that in CCIDL? I haven't figured that out. Perhaps +//// allowing CCIDL to compile files that contain no component +//// definition? +##foreach [interface_type] in (types of all supported interface) generate: + + local interface CCM_[interface_type] : [interface_type] + { + }; + +##end foreach [interface_type] + //////////////////////////////////////////////////////////////////// //// * Iterate thru all facet ('provides' interface) interface types //// It's possible that we need to put some of the common facet @@ -124,13 +141,19 @@ module [module_name] { }; - // Component Context Interface + /** + * Component Context Interface + * + * Notice that we are taking a shortcut here to inherit the + * component-specific context from SessionContext directly instead + * of CCMContext. + */ local interface CCM_[component basename]_Context : ## if [component basename] inherits from [parent component name] CCM_[parent component name]_Context ## else - ::Components:CCMContext + ::Components:SessionContext ## endif { @@ -176,12 +199,12 @@ module [module_name] { ## end foreach opeartion ##foreach [factory name] in (all factory operations defined in [home basename]) - ::Enterprise::EnterpriseComponent [factory name] (....) + ::Components::EnterpriseComponent [factory name] (....) raise (Components::CreateFailure, ....); ##end foreach [factory name] ##foreach [finder name] in (all finder operations defined in [home basename]) - ::Enterprise::EnterpriseComponent [finder name] (....) + ::Components::EnterpriseComponent [finder name] (....) raise (Components::FinderFailure, ....); ##end foreach [finder name] }; diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc index 80ab9e77968..38d9b3353ea 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS.mpc @@ -17,7 +17,8 @@ project(GPS_stub): ciao_client { project(GPS_svnt) : ciao_server { depends += HUDisplay_svnt GPS_stub sharedname = GPS_svnt - libs += GPS_stub _stub + libs += GPS_stub HUDisplay_stub + libpaths += .. idlflags += -Wb,export_macro=GPS_SVNT_Export -Wb,export_include=GPS_svnt_export.h dllflags = GPS_SVNT_BUILD_DLL @@ -36,7 +37,8 @@ project(GPS_svnt) : ciao_server { project(GPS_exec) : ciao_server { depends += GPS_svnt sharedname = GPS_exec - libs += GPS_stub _stub GPS_svnt + libs += GPS_stub HUDisplay_stub GPS_svnt + libpaths += .. dllflags = GPS_EXEC_BUILD_DLL IDL_Files { diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl index 9a799995165..64251cd9357 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay.idl @@ -8,10 +8,25 @@ * @author Nanbor Wang */ +#ifndef HUDISPLAY_IDL +#define HUDISPLAY_IDL + #include "ciao/CCM_Component.idl" module HUDisplay { + /** + * @brief interface opmode defines the "operation mode" interface. + */ + interface opmode + { + void start (); + + void stop (); + + boolean active (); + }; + /** * @brief a timed event that happens at some fix rate. */ @@ -28,3 +43,5 @@ module HUDisplay long pos (); }; }; + +#endif /* HUDISPLAY_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplayE.idl b/TAO/CIAO/examples/handcrafted/Display/HUDisplayE.idl index b2e77190050..cc3b97a73e4 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplayE.idl +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplayE.idl @@ -10,10 +10,21 @@ * @author Nanbor Wang */ +#ifndef HUDISPLAYE_IDL +#define HUDISPLAYE_IDL + + #include "HUDisplay.idl" module HUDisplay { + /** + * Executor interface mapping for supported interfaces. + */ + local interface CCM_opmode : opmode + { + }; + /** * Executor interface for tick event comsumers. This interface is * only needed if a component implementation uses the @@ -32,3 +43,5 @@ module HUDisplay { }; }; + +#endif /* HUDISPLAYE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NOTE b/TAO/CIAO/examples/handcrafted/Display/NOTE index 9a667046fe1..a8390e4fbfc 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NOTE +++ b/TAO/CIAO/examples/handcrafted/Display/NOTE @@ -12,3 +12,15 @@ actualy component definition nor cidl definition are available) situation with CIDL compiler. It looks like we should be able to pass a bunch of IDL definitions thru CIDL compiler and get the equivalent executor interfaces automatically. But we'll have to see. + + +To generate mpc files: + + HUDisplay: + + generate_component_mpc.pl -n HUDisplay + + + All others + + generate_component_mpc.pl -l .. -p HUDisplay {RateGen|GPS|NavDisplay} \ No newline at end of file diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc index dee7fbe50ed..5ad5fb82393 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.mpc @@ -17,7 +17,8 @@ project(NavDisplay_stub): ciao_client { project(NavDisplay_svnt) : ciao_server { depends += HUDisplay_svnt NavDisplay_stub sharedname = NavDisplay_svnt - libs += NavDisplay_stub _stub + libs += NavDisplay_stub HUDisplay_stub + libpaths += .. idlflags += -Wb,export_macro=NAVDISPLAY_SVNT_Export -Wb,export_include=NavDisplay_svnt_export.h dllflags = NAVDISPLAY_SVNT_BUILD_DLL @@ -36,7 +37,8 @@ project(NavDisplay_svnt) : ciao_server { project(NavDisplay_exec) : ciao_server { depends += NavDisplay_svnt sharedname = NavDisplay_exec - libs += NavDisplay_stub _stub NavDisplay_svnt + libs += NavDisplay_stub HUDisplay_stub NavDisplay_svnt + libpaths += .. 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 112f83d033a..4eaeb6a3c12 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.idl @@ -8,29 +8,20 @@ * @author Nanbor Wang */ +#ifndef RATEGEN_IDL +#define RATEGEN_IDL + #include "../HUDisplay.idl" module HUDisplay { - /** - * @brief interface opmode defines the "operation mode" interface. - */ - interface opmode - { - void start (); - - void stop (); - - boolean active (); - }; - component RateGen supports opmode { publishes tick Pulse; /// The attribute can be configured via the home or the /// component property file. - readonly attribute long hertz; + attribute long hertz; }; home RateGenHome manages RateGen @@ -39,3 +30,5 @@ module HUDisplay factory new_RateGen (in long hertz); }; }; + +#endif /* RATEGEN_GEN */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc index 5c1bd342df2..34323603450 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen.mpc @@ -17,7 +17,8 @@ project(RateGen_stub): ciao_client { project(RateGen_svnt) : ciao_server { depends += HUDisplay_svnt RateGen_stub sharedname = RateGen_svnt - libs += RateGen_stub _stub + libs += RateGen_stub HUDisplay_stub + libpaths += .. idlflags += -Wb,export_macro=RATEGEN_SVNT_Export -Wb,export_include=RateGen_svnt_export.h dllflags = RATEGEN_SVNT_BUILD_DLL @@ -36,7 +37,8 @@ project(RateGen_svnt) : ciao_server { project(RateGen_exec) : ciao_server { depends += RateGen_svnt sharedname = RateGen_exec - libs += RateGen_stub _stub RateGen_svnt + libs += RateGen_stub HUDisplay_stub RateGen_svnt + libpaths += .. dllflags = RATEGEN_EXEC_BUILD_DLL IDL_Files { diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenE.idl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenE.idl index c0148e08225..51399782b25 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenE.idl +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGenE.idl @@ -10,6 +10,10 @@ * @author Nanbor Wang */ +#ifndef RATEGENE_IDL +#define RATEGENE_IDL + +#include "CCM_Container.idl" #include "RateGen.idl" #include "../HUDisplayE.idl" @@ -18,35 +22,39 @@ module HUDisplay local interface CCM_RateGen_Executor : Components::EnterpriseComponent, opmode { - readonly attribute long hertz; - } + attribute long hertz; + }; local interface CCM_RateGen : Components::EnterpriseComponent, opmode { - readonly attribute long hertz; + attribute long hertz; }; /** * Context interface. This interface defines the mapping. The * container framework provides the implmentation. + * + * Notice that we are taking a shortcut here to inherit the + * component-specific context from SessionContext directly instead + * of CCMContext. */ local interface CCM_RateGen_Context - : Components::CCMContext + : Components::SessionContext { void push_Pulse (in tick ev); }; - local interface CCM_RateGenHomeImplicit + local interface CCM_RateGenHomeExplicit + : Components::HomeExecutorBase { - Components::EnterpriseComponent create () + Components::EnterpriseComponent new_RateGen (in long hertz) raises (Components::CreateFailure); }; - local interface CCM_RateGenHomeExplicit - : Components::HomeExecutorBase + local interface CCM_RateGenHomeImplicit { - Components::EnterpriseComponent new_RateGen (in long hertz) + Components::EnterpriseComponent create () raises (Components::CreateFailure); }; @@ -56,3 +64,5 @@ module HUDisplay { }; }; + +#endif /* RATEGENE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp new file mode 100644 index 00000000000..da098c4ee4e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.cpp @@ -0,0 +1,594 @@ +// $Id$ + +// The generated filename for files using this template shoule be +// [idl-basename]GS.cpp GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +#include "RateGen_svnt.h" +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +# include "RateGen_svnt.inl" +#endif /* __ACE_INLINE__ */ + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +void +CIAO_GLUE_HUDisplay::RateGen_Context::push_Pulse (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_Active_Map_Manager::iterator + end = this->ciao_publishes_Pulse_map_.end (); + for (ACE_Active_Map_Manager::iterator + iter = this->ciao_publishes_Pulse_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager::ENTRY &entry = *iter; + HUDisplay::tickConsumer_var c + = HUDisplay::tickConsumer::_narrow (entry.int_id_.in ()); + c->push_tick (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + +// Operations for publishes interfaces. +ACE_INLINE ::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_Pulse_map_.bind (c, + key); + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +ACE_INLINE HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + HUDisplay::tickConsumer_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_publishes_Pulse_map_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ How do I check for IllegalState here? When it's not in a + // callback operation... + // ACE_THROW_RETURN (::Components::IllegalState (), 0); + + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = this->container_->get_objref (this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->component_ = HUDisplay::RateGen::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->component_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... + } + return HUDisplay::RateGen::_duplicate (this->component_.in ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +// Operations for provides interfaces. + +// Operations for consumers interfaces. + +// Operations for Navigation interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + if (name == 0) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + // We simply iterate thru all the facets this component provides + // now. We can also use a hash map along with perfect hashing + // (i.e., gperf) if we need faster performance since all the provided + // interfaces are static to a component definition. + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions; // #99 = number of all provided + // facets including those inherited + // from parent component(s). + + return collection._retn (); + +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return collection._retn (); +} + +CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Servant::same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (object_ref)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + CORBA::Object_var the_other + = object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var me + = this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent (object_ref + ACE_ENV_ARG_PARAMETER); +} + +// Operations for Receptacles interface +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +/* +##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: +## if [receptacle name] is a simplex receptacle ('uses') +## else ([receptacle name] is a multiplex ('uses multiple') receptacle) +## endif [receptacle name] +##end foreach [receptacle name] with [uses type] +*/ + +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_connections (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions; // #99 is number of receptacles + // this component has. + return retv._retn (); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::get_consumer (const char * sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "Pulse") == 0) + { + HUDisplay::tickConsumer_var _ciao_consumer = + HUDisplay::tickConsumer::_narrow (subscriber + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return this->subscribe_Pulse (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "Pulse") == 0) + { + return this->unsubscribe_Pulse (ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + ACE_THROW (Components::InvalidName ()); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions; // #99 is the number of consumers + // this component has. + return retv._retn (); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions; // #99 is the number of emitters + // this component has. + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +// Operations for CCMObject interface +::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do: Connect to an IfR? + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::PrimaryKeyBase * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)) +{ + // This is a keyless component. + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + // @@ to-do + // No-op. Don't know how to pass this info to monolithic executor. +} + +void +CIAO_GLUE_HUDisplay::RateGen_Servant::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ to-do + // Need to figure out what to do here. E.g., tear down the all the connections + // this component has? +} + +::Components::ComponentPortDescription * +CIAO_GLUE_HUDisplay::RateGen_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc + = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ReceptacleDescriptions_var receptacle_desc + = get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ConsumerDescriptions_var consumer_desc + = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::EmitterDescriptions_var emitter_desc + = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::PublisherDescriptions_var publisher_desc + = this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + + retv->facets (facets_desc.in()); + retv->receptacles (receptacle_desc.in()); + retv->consumers (consumer_desc.in()); + retv->emitters (emitter_desc.in()); + retv->publishers (publisher_desc.in()); + + return retv._retn(); +} + +// get_component implementation. +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->context_); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + // @@ Do we need to try the following case here? We are afterall implementing + // a session component here. + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->context_); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +HUDisplay::RateGen_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::_ciao_activate_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var obj + = this->container_->install_servant (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::RateGen_var ho = HUDisplay::RateGen::_narrow (obj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return ho._retn (); + +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +HUDisplay::RateGen_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::_ciao_create_helper (::Components::EnterpriseComponent_ptr com + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + HUDisplay::CCM_RateGen_var hw = HUDisplay::CCM_RateGen::_narrow (com + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + // Acquiring the home reference and pass it to the component servant + CORBA::Object_var hobj= this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::RateGenHome_var home = HUDisplay::RateGenHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CIAO_GLUE_HUDisplay::RateGen_Servant *svt = + new CIAO_GLUE_HUDisplay::RateGen_Servant (hw.in (), + home.in (), + this->container_); + return svt->_ciao_activate_component (ACE_ENV_ARG_PARAMETER); +} + +// Operations for Implicit Home interface +HUDisplay::RateGen_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + Components::EnterpriseComponent_var com = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_create_helper (com + ACE_ENV_ARG_PARAMETER); +} + +// Operations for CCMHome interface +void +CIAO_GLUE_HUDisplay::RateGenHome_Servant::remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + if (CORBA::is_nil (comp)) + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? + + comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Removing the object reference? get the servant from the POA with + // the objref, and call remove() on the component, deactivate the + // component, and then remove-ref the servant? + this->container_->uninstall (comp + ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h new file mode 100644 index 00000000000..d786c57372e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.h @@ -0,0 +1,377 @@ +// $Id$ + +// =========================================================== +// +// @file RateGen_svnt.h +// +// This is a pseudo-meta generic servant implementations template +// for CIAO's CIDL compiler. It demonstrates how a servant +// implementation for a session component should look like. +// +// @author Nanbor Wang +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_RATEGEN_SVNT_H +#define CIAO_GLUE_SESSION_RATEGEN_SVNT_H +#include "ace/pre.h" + +#include "RateGenS.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "RateGenEC.h" // Source in the executor mapping + // that component implementations use +#include "ciao/Container_Base.h" //Source in the container interface definitions +#include "ace/Active_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_HUDisplay +{ + ////////////////////////////////////////////////////////////////// + // Component specific context implementation + class RATEGEN_SVNT_Export RateGen_Context : + public virtual HUDisplay::CCM_RateGen_Context + { + public: + // We will allow the the servant glue code we generate to access + // our states. + friend class RateGen_Servant; + + // Ctor. + RateGen_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + RateGen_Servant *sv); + + // Dtor. + virtual ~RateGen_Context (); + + void push_Pulse (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for ::Components::CCMContext + virtual ::Components::Principal_ptr get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual CORBA::Boolean is_caller_in_role (const char * role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + // Operations for ::Components::SessionContext interface + virtual CORBA::Object_ptr get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + protected: + // We need to generate, in protected section, stuff that manage + // connections and consumers of this component. + + // Operations for publishes interfaces. + ::Components::Cookie_ptr + subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + HUDisplay::tickConsumer_ptr + unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + ACE_Active_Map_Manager ciao_publishes_Pulse_map_; + + protected: + /// Cached component home reference. + ::Components::CCMHome_var home_; + + /// session container + ::CIAO::Session_Container *container_; + + /// Reference back to owner. + RateGen_Servant *servant_; + + /// @@ Cached component reference. + HUDisplay::RateGen_var component_; + }; + + ////////////////////////////////////////////////////////////////// + // Component Servant Glue code implementation + class RATEGEN_SVNT_Export RateGen_Servant + : public virtual POA_HUDisplay::RateGen, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + RateGen_Servant (HUDisplay::CCM_RateGen_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + // Dtor. + ~RateGen_Servant (void); + + // Operations from supported interfaces and inherited components + + 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)); + + 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 for provides interfaces. + + // Operations for receptacles interfaces. + + // Operations for consumers interfaces. + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + virtual ::Components::Cookie_ptr + subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual HUDisplay::tickConsumer_ptr + unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + // Operations for Navigation interface + virtual CORBA::Object_ptr provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) ; + virtual ::Components::FacetDescriptions * get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::FacetDescriptions * get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)); + virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface + virtual ::Components::Cookie_ptr connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)); + virtual CORBA::Object_ptr disconnect (const char * name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)); + virtual ::Components::ConnectionDescriptions * get_connections (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::ReceptacleDescriptions * get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for Events interface + virtual ::Components::EventConsumerBase_ptr get_consumer (const char * sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::Cookie_ptr subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)); + virtual ::Components::EventConsumerBase_ptr unsubscribe (const char * publisher_name, + Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + virtual void connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + virtual ::Components::EventConsumerBase_ptr disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + virtual ::Components::ConsumerDescriptions * get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::ConsumerDescriptions * get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::EmitterDescriptions * get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::EmitterDescriptions * get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + virtual ::Components::PublisherDescriptions * get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::PublisherDescriptions * get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for CCMObject interface + virtual ::CORBA::IRObject_ptr get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::CCMHome_ptr get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual ::Components::PrimaryKeyBase * get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + virtual ::Components::ComponentPortDescription * get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // get_component implementation. + virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO specific operations. + + // Activate the object in the container_ + HUDisplay::RateGen_ptr + _ciao_activate_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // My Executor. + HUDisplay::CCM_RateGen_var executor_; + + // My Run-time Context. + RateGen_Context *context_; + + // Managing container. + ::CIAO::Session_Container *container_; + }; + + ////////////////////////////////////////////////////////////////// + // Component Home Glue code implementation + + // Foreach component home + class RATEGEN_SVNT_Export RateGenHome_Servant : + public virtual POA_HUDisplay::RateGenHome, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + RateGenHome_Servant (HUDisplay::CCM_RateGenHome_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~RateGenHome_Servant (void); + + // User defined and inherited operations + + // Factory operations. + virtual HUDisplay::RateGen_ptr new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreateFailure)); + + // Finder operations. + + + // Operations for KeylessHome interface + virtual ::Components::CCMObject_ptr + create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for Implicit Home interface + virtual HUDisplay::RateGen_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for CCMHome interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + protected: + // Helper method for factory operations. + HUDisplay::RateGen_ptr + _ciao_create_helper (::Components::EnterpriseComponent_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // My Executor. + HUDisplay::CCM_RateGenHome_var executor_; + + // My Container + CIAO::Session_Container *container_; + }; +} + +#if defined (__ACE_INLINE__) +# include "RateGen_svnt.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_RATEGEN_SVNT_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.inl b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.inl new file mode 100644 index 00000000000..ad61010e49e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_svnt.inl @@ -0,0 +1,235 @@ +// $Id$ -*- C++ -*- + +// The generated filename for files using this template shoule be +// [idl-basename]GS.i GS --> GlueSession + +// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or +// CIAO_GLUE_[module name] as defined in the header file. + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ Notice that all component and interface names need to be +/// fully qualified as we are creating a new namespace for the CIAO's +/// container glue code. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + +////////////////////////////////////////////////////////////////// +// Component specific context implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGen_Context::RateGen_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CIAO_GLUE_HUDisplay::RateGen_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) +{ + +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGen_Context::~RateGen_Context () +{ +} + +// Operations for emits interfaces. + +// Operations for ::Components::CCMContext +ACE_INLINE ::Components::Principal_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ We don't support Security in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::CCMHome_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Components::CCMHome::_duplicate (this->home_.in ()); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE ::Components::Transaction::UserTransaction_ptr +CIAO_GLUE_HUDisplay::RateGen_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Context::is_caller_in_role (const char * role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (role); + + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGen_Servant::RateGen_Servant (HUDisplay::CCM_RateGen_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_RateGen::_duplicate (exe)), + container_ (c) +{ + this->context_ = new CIAO_GLUE_HUDisplay::RateGen_Context (h, c, this); +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGen_Servant::~RateGen_Servant (void) +{ + this->context_->_remove_ref (); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Servant::start (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->executor_->start (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Servant::stop (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + this->executor_->stop (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE CORBA::Boolean +CIAO_GLUE_HUDisplay::RateGen_Servant::active (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->active (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE CORBA::Long +CIAO_GLUE_HUDisplay::RateGen_Servant::hertz (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + return this->executor_->hertz (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::RateGen_Servant::hertz (CORBA::Long hertz + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Simply relay to executor. May not need to return the result... + this->executor_->hertz (hertz + ACE_ENV_ARG_PARAMETER); +} + +// Operations for publishes interfaces. +ACE_INLINE ::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::subscribe_Pulse (HUDisplay::tickConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + return this->context_->subscribe_Pulse (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::RateGen_Servant::unsubscribe_Pulse (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + return this->context_->unsubscribe_Pulse (ck + ACE_ENV_ARG_PARAMETER); +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGenHome_Servant::RateGenHome_Servant (HUDisplay::CCM_RateGenHome_ptr exe, + CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_RateGenHome::_duplicate (exe)), + container_ (c) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::RateGenHome_Servant::~RateGenHome_Servant (void) +{ +} + +// for factory operations inherit from parent home(s), they should return +// the corresponding component types their homes manage +ACE_INLINE HUDisplay::RateGen_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::CreateFailure)) +{ + Components::EnterpriseComponent_var com = + this->executor_->new_RateGen (hertz + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_create_helper (com + ACE_ENV_ARG_PARAMETER); +} + +// Operations for KeylessHome interface +ACE_INLINE ::Components::CCMObject_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + // Simply forward to the create method. + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Operations for CCMHome interface +ACE_INLINE ::CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +ACE_INLINE CORBA::IRObject_ptr +CIAO_GLUE_HUDisplay::RateGenHome_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} -- cgit v1.2.1