From e32aa9aaf024cb08e9f59000c0ccb99a805823ff Mon Sep 17 00:00:00 2001 From: nanbor Date: Fri, 14 Mar 2003 22:11:07 +0000 Subject: *** empty log message *** --- TAO/CIAO/ChangeLog | 20 + .../docs/templates/CIAO_Glue_Session_Template.cpp | 45 +- .../docs/templates/CIAO_Glue_Session_Template.h | 158 +++-- .../docs/templates/CIAO_Glue_Session_Template.inl | 21 +- TAO/CIAO/docs/templates/Executor.idl | 8 +- .../handcrafted/Display/NavDisplay/NavDisplay.idl | 7 +- .../handcrafted/Display/NavDisplay/NavDisplayE.idl | 72 +++ .../Display/NavDisplay/NavDisplay_svnt.cpp | 665 +++++++++++++++++++++ .../Display/NavDisplay/NavDisplay_svnt.h | 474 +++++++++++++++ .../Display/NavDisplay/NavDisplay_svnt.inl | 218 +++++++ 10 files changed, 1598 insertions(+), 90 deletions(-) create mode 100644 TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayE.idl create mode 100644 TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp create mode 100644 TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h create mode 100644 TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 16a09c6e926..56efdd38ba8 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,23 @@ +Fri Mar 14 16:08:22 2003 Nanbor Wang + + * docs/todo.html: Recorded a compilation error in the generated + code that I commented out for later "study." + + * examples/handcrafted/Display/NavDisplay/NavDisplay.idl: Fixed a + typo. + + * examples/handcrafted/Display/NavDisplay/NavDisplayE.idl: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl: + Added new "generated" code. + + * 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 templates based on the code + they generated. + Thu Mar 13 20:11:49 2003 Nanbor Wang * examples/handcrafted/Display/NavDisplay/NavDisplay.idl: diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp index f6c5e10bf6f..c2530718b32 100644 --- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.cpp @@ -123,7 +123,7 @@ void // Operations for publishes interfaces. ##foreach [publish name] with [eventtype] in (list of all publishers) generate: -ACE_INLINE ::Components::Cookie_ptr +::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, @@ -140,7 +140,7 @@ ACE_INLINE ::Components::Cookie_ptr return retv._retn (); } -ACE_INLINE [eventtype]Consumer_ptr +[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, @@ -166,7 +166,7 @@ ACE_INLINE [eventtype]Consumer_ptr ## if [receptacle name] is a simplex receptacle ('uses') -ACE_INLINE [uses type]_ptr +[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)) { @@ -174,7 +174,7 @@ ACE_INLINE [uses type]_ptr } // Simplex [receptacle name] connection management operations -ACE_INLINE void +void [ciao module name]::[component name]_Context::connect_[receptacle name] ([uses type]_ptr c ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, @@ -191,7 +191,7 @@ ACE_INLINE void this->ciao_uses_[receptacle name]_ = [uses type]::_duplicate (c); } -ACE_INLINE [uses type]_ptr +[uses type]_ptr [ciao module name]::[component name]_Context::disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::NoConnection)) @@ -199,12 +199,12 @@ ACE_INLINE [uses type]_ptr if (CORBA::is_nil (this->ciao_uses_[receptacle name]_.in ())) ACE_THROW (::Components::NoConnection ()); - return this->ciao_uses_[receptacle name]_.retn (); + 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 +::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, @@ -222,7 +222,7 @@ ACE_INLINE ::Components::Cookie_ptr return retv._retn (); } -ACE_INLINE [uses type]_ptr +[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, @@ -556,8 +556,8 @@ CORBA::Object_ptr if (ACE_OS_String::strcmp (name, "[receptacle name]") == 0) { ## if [receptacle name] is a simplex receptacle ('uses') - [receptacle name]Connections_var retv = - new ::Components::ConnectionConnections (1); + ::Components::ConnectionDescriptions_var retv = + new ::Components::ConnectionDescriptions (1); retv->length (1); retv[0] = new OBV_Components::ConnectionDescription; @@ -617,9 +617,9 @@ CORBA::Object_ptr CORBA::ULong i = 0; for (; i < names.length (); ++i) { - retv[i] = new OBV_ReceptacleDescription; + retv[i] = new ::OBV_Components::ReceptacleDescription; ##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: - (else) if (ACE_OS_String::strcmp (name, "[receptacle name]") == 0) + (else) if (ACE_OS_String::strcmp (names[i].in (), "[receptacle name]") == 0) { retv[i]->Name ((const char *) "[receptacle name]"); retv[i]->type_id ((const char *) "[uses type repo id]"); @@ -784,6 +784,8 @@ void ACE_CHECK_RETURN (0); retv[i]->consumer (c.in ()); + + i++; ##end foreach [consumer name] with [eventtype] return retv._retn (); @@ -837,6 +839,8 @@ void retv[i]->Name ("[emit name]"); retv[i]->type_id ("[eventtype]Consumer repo id"); retv[i]->consumer ([eventtype]Consumer::_duplicate (this->context_->ciao_emits_[emit name]_consumer_)); + + i++; ##end foreach [emitter name] with [eventtype] return retv._retn (); @@ -862,7 +866,7 @@ void { retv[i]->Name ("[emit name]"); retv[i]->type_id ("[eventtype]Consumer repo id"); - retv[i]->consumer ([eventtype]Consumer::_duplicate (this->context_->ciao_emits_[emit name]_consumer_)); + retv[i]->consumer ([eventtype]Consumer::_duplicate (this->context_->ciao_emits_[emit name]_consumer_.in ())); } ##end foreach [consumer name] with [eventtype] else @@ -997,8 +1001,9 @@ CORBA::Object_ptr ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - [component name]_var ho = [component name]::_narrow (obj - ACE_ENV_ARG_PARAMETER); + [component name]_var ho + = [component name]::_narrow (obj + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); return ho._retn (); @@ -1020,12 +1025,14 @@ CORBA::Object_ptr 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); + CORBA::Object_var hobj + = this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - [home name]_var home = [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 module name]::[component name]_Servant *svt = diff --git a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h index 52eca80c2d4..97f85da6811 100644 --- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.h @@ -68,7 +68,8 @@ namespace CIAO_GLUE ## end foreach [operation] // get_component implementation. - virtual CORBA::Object_ptr _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); protected: @@ -104,12 +105,14 @@ namespace CIAO_GLUE ##foreach [receptacle name] with [uses type] in (list of all 'uses' interfaces) generate: ## if [receptacle name] is a simplex receptacle ('uses') - [uses type]_ptr get_connection_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + [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) // [receptacle name]Connections typedef'ed as a sequence of // struct [receptacle name]Connection. - [receptacle name]Connections *get_connections_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + [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] @@ -121,25 +124,37 @@ namespace CIAO_GLUE ##end foreach [event name] with [eventtype] // Operations for ::Components::CCMContext - virtual ::Components::Principal_ptr get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + 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) + + 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) + + 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) + + 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) + + 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) + + 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) + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, Components::IllegalState)); protected: @@ -149,13 +164,16 @@ 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) - ACE_THROW_SPEC ((CORBA::SytemException, + 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) - ACE_THROW_SEPC ((CORBA::SystemException, + + [uses type]_ptr + disconnect_[receptacle name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, ::Components::NoConnection)); // Simplex [receptacle name] connection @@ -163,13 +181,16 @@ namespace CIAO_GLUE ## 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) + ::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) + + [uses type]_ptr + disconnect_[receptacle name] (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::InvalidConnection)); @@ -181,12 +202,14 @@ namespace CIAO_GLUE // 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) + 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) + [eventtype]Consumer_ptr + disconnect_[emit name] (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::NoConnection)); @@ -248,7 +271,8 @@ namespace CIAO_GLUE // Operations for provides interfaces. ##foreach [facet name] with [facet type] in (list of all provided interfaces) generate: - virtual [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] @@ -257,28 +281,38 @@ 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 - virtual 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)); - virtual [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)); - virtual [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 - virtual ::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)); - virtual [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)); - virtual [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] @@ -295,6 +329,7 @@ namespace CIAO_GLUE // Constructor and destructor. [event type]Consumer_[consumer name]_Servant (CCM_[component name]_ptr executor, CCM_[component name]_Context_ptr c); + ~[event type]Consumer_[consumer name]_Servant (); ## foreach [type] in ([eventtype] and all its parent eventtype, if any) @@ -304,7 +339,7 @@ namespace CIAO_GLUE ## end [type] // Inherit from ::Compopnents::EventBConsumerBase - virtual void push_event (EventBase_ptr ev + virtual void push_event (::Components::EventBase_ptr ev ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::BadEventType)); @@ -322,18 +357,21 @@ namespace CIAO_GLUE CCM_[component name]_Context_var ctx_; }; - virtual [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: - virtual 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)); - virtual [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] @@ -354,8 +392,9 @@ namespace CIAO_GLUE ##end foreach [publish name] with [eventtype] // Operations for Navigation interface - virtual CORBA::Object_ptr provide_facet (const char * name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual CORBA::Object_ptr + provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException , Components::InvalidName)) ; @@ -369,23 +408,26 @@ namespace CIAO_GLUE ACE_THROW_SPEC ((CORBA::SystemException , Components::InvalidName)); - virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + 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) + 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) + 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, @@ -432,9 +474,10 @@ namespace CIAO_GLUE Components::InvalidName, Components::InvalidConnection)); - virtual void connect_consumer (const char * emitter_name, - Components::EventConsumerBase_ptr consumer - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + 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, @@ -491,11 +534,13 @@ namespace CIAO_GLUE ACE_THROW_SPEC ((CORBA::SystemException, Components::NoKeyAvailable)); - virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + 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) + virtual void + remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, Components::RemoveFailure)); @@ -511,7 +556,8 @@ namespace CIAO_GLUE // CIAO specific operations. // Activate the object in the container_ - [component name]_ptr _ciao_activate_component + [component name]_ptr + _ciao_activate_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); @@ -547,7 +593,7 @@ namespace CIAO_GLUE { public: // Ctor. - [home anem]_Servant (CCM_[home name]_ptr exe, + [home name]_Servant (CCM_[home name]_ptr exe, CIAO::Session_Container *c); // Dtor. @@ -665,7 +711,7 @@ namespace CIAO_GLUE } #if defined (__ACE_INLINE__) -# include "[idl-basename]_svnt.inl" +# include "[idl-name]_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 e565c954507..64e5d908865 100644 --- a/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl +++ b/TAO/CIAO/docs/templates/CIAO_Glue_Session_Template.inl @@ -195,7 +195,7 @@ ACE_INLINE [operation return_type] ##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 +// Simplex [receptacle name] connection management operations ACE_INLINE void [ciao module name]::[component name]_Servant::connect_[receptacle name] ([uses type]_ptr c ACE_ENV_ARG_DECL) @@ -203,7 +203,8 @@ ACE_INLINE void ::Components::AlreadyConnected, ::Components::InvalidConnection)) { - this->context_->connect_[receptacle name] (c ACE_ENV_ARG_PARAMETER); + this->context_->connect_[receptacle name] (c + ACE_ENV_ARG_PARAMETER); } ACE_INLINE [uses type]_ptr @@ -222,7 +223,7 @@ ACE_INLINE [uses type]_ptr } ## else ([receptacle name] is a multiplex ('uses multiple') receptacle) - // Multiplex [receptacle name] connection management operations +// Multiplex [receptacle name] connection management operations ACE_INLINE ::Components::Cookie_ptr [ciao module name]::[component name]_Servant::connect_[receptacle name] ([uses type]_ptr c ACE_ENV_ARG_DECL) @@ -268,7 +269,7 @@ ACE_INLINE [receptacle name]Connections * // Constructor and destructor. ACE_INLINE -[ciao module name]::[component name]_Servant::[event type]Consumer_[consumer name]_Servant::[event type]Consumer_[consumer name]_Servant +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::[eventtype]Consumer_[consumer name]_Servant (CCM_[component name]_ptr executor, CCM_[component name]_Context_ptr c) : executor_ (CCM_[component name]::_duplicate (executor)), @@ -277,19 +278,19 @@ ACE_INLINE } ACE_INLINE -[ciao module name]::[component name]_Servant::[event type]Consumer_[consumer name]_Servant::~[event type]Consumer_[consumer name]_Servant () +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::~[eventtype]Consumer_[consumer name]_Servant () { } ACE_INLINE CORBA::Object_ptr -[ciao module name]::[component name]_Servant::[event type]Consumer_[consumer name]_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); } ACE_INLINE void -[ciao module name]::[component name]_Servant::[event type]Consumer_[consumer name]_Servant::push_[eventtype] +[ciao module name]::[component name]_Servant::[eventtype]Consumer_[consumer name]_Servant::push_[eventtype] ([eventtype]_ptr evt ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) @@ -421,7 +422,7 @@ ACE_INLINE [component name]_ptr ## if [home name] is a keyless home - // Operations for KeylessHome interface +// Operations for KeylessHome interface ACE_INLINE ::Components::CCMObject_ptr [ciao module name]::[home name]_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, @@ -433,8 +434,8 @@ ACE_INLINE ::Components::CCMObject_ptr ## else [home basename] is keyed home with [key type] - // We do not support key'ed home at the moment but we might - // as well generate the mapping. +// We do not support key'ed home at the moment but we might +// as well generate the mapping. ACE_INLINE [component name]_ptr [ciao module name]::[home name]_Servant::create ([key type]_ptr key) ACE_THROW_SPEC ((CORBA::SystemException, diff --git a/TAO/CIAO/docs/templates/Executor.idl b/TAO/CIAO/docs/templates/Executor.idl index 00147796d95..259bffac0df 100644 --- a/TAO/CIAO/docs/templates/Executor.idl +++ b/TAO/CIAO/docs/templates/Executor.idl @@ -102,7 +102,7 @@ module [module_name] { ## if [component basename] inherits from [parent component name] CCM_[parent component name]_Executor ## else - ::Components:EnterpriseComponent + ::Components::EnterpriseComponent ## endif ## foreach [interface name] in (all component supported interfaces) generate: , [interface name] @@ -123,7 +123,7 @@ module [module_name] { ## if [component basename] inherits from [parent component name] CCM_[parent component name] ## else - ::Components:EnterpriseComponent + ::Components::EnterpriseComponent ## endif ## foreach [interface name] in (all component supported interfaces) generate: , [interface name] @@ -156,7 +156,7 @@ module [module_name] { ## if [component basename] inherits from [parent component name] CCM_[parent component name]_Context ## else - ::Components:SessionContext + ::Components::SessionContext ## endif { @@ -189,7 +189,7 @@ module [module_name] { ## if [home basename] inherits from [parent home name] CCM_[parent home name]Explicit ## else - ::Components:HomeExecutorBase + ::Components::HomeExecutorBase ## endif ## foreach [interface name] in (all home supported interfaces) generate: , [interface name] diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.idl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.idl index 3570fd42de7..2a5dc51e201 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.idl +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay.idl @@ -8,11 +8,14 @@ * @author Nanbor Wang */ +#ifndef NAVDISPLAY_IDL +#define NAVDISPLAY_IDL + #include "../HUDisplay.idl" module HUDisplay { - component navDisplay + component NavDisplay { consumes tick Refresh; uses position GPSLocation; @@ -22,3 +25,5 @@ module HUDisplay { }; }; + +#endif /* NAVDISPLAY_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayE.idl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayE.idl new file mode 100644 index 00000000000..ff687126873 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplayE.idl @@ -0,0 +1,72 @@ +// $Id$ + +// =========================================================== +// +// @file Executor.idl +// +// Handlecrafted "generated" code. :) +// +// @author Nanbor Wang +// +// =========================================================== + +#ifndef NAVDISPLAYE_IDL +#define NAVDISPLAYE_IDL + +#include "CCM_Container.idl" // Found in $(CIAO_ROOT)/ciao + // For various definitions of container + // internal/callback interfaces +#include "NavDisplay.idl" // Original component IDL definition +#include "../HUDisplayE.idl" + +module HUDisplay { + // Component Main Executor Interface. We currently do not + // support Executor-based implementation. + + local interface CCM_NavDisplay_Executor + : Components::EnterpriseComponent + { + }; + + // Monolithic component executor. + // For implementing monolithic component call back interface. + + local interface CCM_NavDisplay + : Components::EnterpriseComponent + { + void push_Refresh (in tick ev); + }; + + /** + * 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_NavDisplay_Context + : Components::SessionContext + { + position get_connection_GPSLocation (); + }; + + + local interface CCM_NavDisplayHomeExplicit + : Components::HomeExecutorBase + { + }; + + local interface CCM_NavDisplayHomeImplicit + { + ::Components::EnterpriseComponent create () + raises (::Components::CCMException); + }; + + local interface CCM_NavDisplayHome + : CCM_NavDisplayHomeExplicit, + CCM_NavDisplayHomeImplicit + { + }; +}; + +#endif /* NAVDISPLAYE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp new file mode 100644 index 00000000000..d82b03b8827 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.cpp @@ -0,0 +1,665 @@ +// $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 "NavDisplay_svnt.h" +#include "Cookies.h" + +#if !defined (__ACE_INLINE__) +# include "NavDisplay_svnt.inl" +#endif /* __ACE_INLINE__ */ + +HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return HUDisplay::position::_duplicate (this->ciao_uses_GPSLocation_.in ()); +} + +// Simplex [receptacle name] connection management operations +void +CIAO_GLUE_HUDisplay::NavDisplay_Context::connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + if (! CORBA::is_nil (this->ciao_uses_GPSLocation_.in ())) + ACE_THROW (::Components::AlreadyConnected ()); + + if (CORBA::is_nil (c)) + ACE_THROW (::Components::InvalidConnection ()); + + // When do we throw InvalidConnection exception? + this->ciao_uses_GPSLocation_ = HUDisplay::position::_duplicate (c); +} + +HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Context::disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + if (CORBA::is_nil (this->ciao_uses_GPSLocation_.in ())) + ACE_THROW (::Components::NoConnection ()); + + return this->ciao_uses_GPSLocation_._retn (); +} + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_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::NavDisplay::_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::NavDisplay::_duplicate (this->component_.in ()); +} + +////////////////////////////////////////////////////////////////// +// Component Servant Glue code implementation +////////////////////////////////////////////////////////////////// + +// Operations for provides interfaces. + +// Operations for consumers interfaces. + +// EventConsumer Glue Code implementation +// Inherit from ::Compopnents::EventBConsumerBase +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::push_event (::Components::EventBase_ptr ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)) +{ + HUDisplay::tick_var ev_type = HUDisplay::tick::_downcast (ev); + if (ev_type != 0) + { + this->push_tick (ev_type.in () + ACE_ENV_ARG_PARAMETER); + return; + } + + // @@ This include the case when we receive a parent eventtype of [eventtype] + + ACE_THROW (::Components::BadEventType ()); +} + +// get_component implementation. +HUDisplay::tickConsumer_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_consumer_Refresh (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->consumes_Refresh_.in ())) + { + CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant *svt = + new CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant (this->executor_, + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = this->container_->install_servant (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + HUDisplay::tickConsumer_var eco + = HUDisplay::tickConsumer::_narrow (obj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->consumes_Refresh_ = eco; + } + + return HUDisplay::tickConsumer::_duplicate (this->consumes_Refresh_.in ()); +} + +// Operations for Navigation interface +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (0); // #99 = number of all provided + // facets including those inherited + // from parent component(s). + return collection._retn (); + +} + +::Components::FacetDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +CORBA::Boolean +CIAO_GLUE_HUDisplay::NavDisplay_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::NavDisplay_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)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "GPSLocation") == 0) + { + HUDisplay::position_var _ciao_conn = + HUDisplay::position::_narrow (connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_conn.in ())) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + this->connect_GPSLocation (_ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + return 0; + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_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)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "GPSLocation") == 0) + return this->disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_connections (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "GPSLocation") == 0) + { + ::Components::ConnectionDescriptions_var retv + = new ::Components::ConnectionDescriptions; + retv->length (1); + + ::Components::ConnectionDescription_var x + = new OBV_Components::ConnectionDescription; + x ->ck (0); + x ->objref (this->get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER)); + ACE_CHECK_RETURN (0); + + // retv[0] = x._retn (); + + return retv._retn (); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (1); // #99 is number of receptacles + // this component has. + retv->length (1); + CORBA::ULong i = 0; + + retv[i] = new OBV_Components::ReceptacleDescription; + + retv[i]->Name ((const char *) "GPSLocation"); + retv[i]->type_id ((const char *) "IDL:HUDisplay/position:1.0"); + retv[i]->is_multiple (0); + retv[i]->connections (*this->get_connections ("GPSLocation" + ACE_ENV_ARG_PARAMETER)); + return retv._retn (); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_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 ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new ::OBV_Components::ReceptacleDescription; + if (ACE_OS_String::strcmp (names[i].in (), "GPSLocation") == 0) + { + retv[i]->Name ((const char *) "GPSLocation"); + retv[i]->type_id ((const char *) "IDL:HUDisplay/position:1.0"); + retv[i]->is_multiple (0); + retv[i]->connections (*this->get_connections ("GPSLocation" + ACE_ENV_ARG_PARAMETER)); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_consumer (const char * sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no event sinks in this component. + if (sink_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (sink_name, "Refresh") == 0) + return this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::Cookie_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::subscribe (const char * , + Components::EventConsumerBase_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::unsubscribe (const char * , + Components::Cookie_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::connect_consumer (const char * , + Components::EventConsumerBase_ptr + 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::NavDisplay_Servant::disconnect_consumer (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (1); // #99 is the number of consumers + // this component has. + retv->length (1); + + CORBA::ULong i = 0; + retv[i] = new OBV_Components::ConsumerDescription; + retv[i]->Name ("Refresh"); + retv[i]->type_id ("IDL:HUDisplay/tickConsumer:1.0"); + HUDisplay::tickConsumer_var c + = this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + + return retv._retn (); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_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 ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new OBV_Components::ConsumerDescription; + + if (ACE_OS_String::strcmp (names[i].in (), "Refresh") == 0) + { + retv[i]->Name ("Refresh"); + retv[i]->type_id ("IDL:HUDisplay/tickConsumer:1.0"); + HUDisplay::tickConsumer_var c = + this->get_consumer_Refresh (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (0); // #99 is the number of emitters + // this component has. + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_HUDisplay::NavDisplay_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 ()); + retv->length (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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_ptr +CIAO_GLUE_HUDisplay::NavDisplay_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::NavDisplay_var ho + = HUDisplay::NavDisplay::_narrow (obj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return ho._retn (); + +} + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +HUDisplay::NavDisplay_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::_ciao_create_helper (::Components::EnterpriseComponent_ptr com + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + HUDisplay::CCM_NavDisplay_var hw + = HUDisplay::CCM_NavDisplay::_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::NavDisplayHome_var home + = HUDisplay::NavDisplayHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CIAO_GLUE_HUDisplay::NavDisplay_Servant *svt = + new CIAO_GLUE_HUDisplay::NavDisplay_Servant (hw.in (), + home.in (), + this->container_); + return svt->_ciao_activate_component (ACE_ENV_ARG_PARAMETER); +} + +// Operations for Implicit Home interface +HUDisplay::NavDisplay_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_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::NavDisplayHome_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/NavDisplay/NavDisplay_svnt.h b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h new file mode 100644 index 00000000000..000a2e5b782 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.h @@ -0,0 +1,474 @@ +// $Id$ + +// =========================================================== +// +// @file CIAO_Glue_Session_Template.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. +// +// The generated filename for files using this template shoule be +// [idl-basename]_svnt.h +// +// @author Nanbor Wang +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_NAVDISPLAY_SVNT_H +#define CIAO_GLUE_SESSION_NAVDISPLAY_SVNT_H +#include "ace/pre.h" + +#include "NavDisplayS.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "NavDisplayEC.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 */ + +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +/// @@@ 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. +/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +namespace CIAO_GLUE_HUDisplay +{ + + ////////////////////////////////////////////////////////////////// + // Component specific context implementation + class NAVDISPLAY_SVNT_Export NavDisplay_Context : + public virtual HUDisplay::CCM_NavDisplay_Context + { + public: + // We will allow the the servant glue code we generate to access + // our states. + friend class NavDisplay_Servant; + + // Ctor. + NavDisplay_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + NavDisplay_Servant *sv); + + // Dtor. + virtual ~NavDisplay_Context (); + + // Operations for [component name] event source, and + // receptacles defined in CCM_[component name]_Context. + + HUDisplay::position_ptr + get_connection_GPSLocation (ACE_ENV_SINGLE_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. + + // Simplex [receptacle name] connection management operations + void + connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + HUDisplay::position_ptr + disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + // Simplex [receptacle name] connection + HUDisplay::position_var ciao_uses_GPSLocation_; + + protected: + /// Cached component home reference. + ::Components::CCMHome_var home_; + + /// session container + ::CIAO::Session_Container *container_; + + /// Reference back to owner. + NavDisplay_Servant *servant_; + + /// @@ Cached component reference. + HUDisplay::NavDisplay_var component_; + + }; + + ////////////////////////////////////////////////////////////////// + // Component Servant Glue code implementation + class NAVDISPLAY_SVNT_Export NavDisplay_Servant + : public virtual POA_HUDisplay::NavDisplay, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + NavDisplay_Servant (HUDisplay::CCM_NavDisplay_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + // Dtor. + ~NavDisplay_Servant (void); + + // Operations for provides interfaces. + + // Operations for receptacles interfaces. + + // Simplex [receptacle name] connection management operations + virtual void + connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual HUDisplay::position_ptr + disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + virtual HUDisplay::position_ptr + get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for consumers interfaces. + // First we need to generate the event sink specific servant + class NAVDISPLAY_SVNT_Export tickConsumer_Refresh_Servant + : public virtual POA_HUDisplay::tickConsumer, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Constructor and destructor. + tickConsumer_Refresh_Servant (HUDisplay::CCM_NavDisplay_ptr executor, + HUDisplay::CCM_NavDisplay_Context_ptr c); + + ~tickConsumer_Refresh_Servant (); + + virtual void push_tick (HUDisplay::tick_ptr evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherit from ::Compopnents::EventBConsumerBase + virtual void push_event (::Components::EventBase_ptr ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Executor + HUDisplay::CCM_NavDisplay_var executor_; + + // Context object. + HUDisplay::CCM_NavDisplay_Context_var ctx_; + }; + + virtual HUDisplay::tickConsumer_ptr + get_consumer_Refresh (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + + // 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::NavDisplay_ptr + _ciao_activate_component + (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // My Executor. + HUDisplay::CCM_NavDisplay_var executor_; + + // My Run-time Context. + NavDisplay_Context *context_; + + // Managing container. + ::CIAO::Session_Container *container_; + + // Cached provided interfaces. + HUDisplay::tickConsumer_var consumes_Refresh_; + }; + + + ////////////////////////////////////////////////////////////////// + // Component Home Glue code implementation + + // Foreach component home + class NAVDISPLAY_SVNT_Export NavDisplayHome_Servant : + public virtual POA_HUDisplay::NavDisplayHome, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + NavDisplayHome_Servant (HUDisplay::CCM_NavDisplayHome_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~NavDisplayHome_Servant (void); + + // Factory operations + + // 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::NavDisplay_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::NavDisplay_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_NavDisplayHome_var executor_; + + // My Container + CIAO::Session_Container *container_; + }; + + extern "C" NAVDISPLAY_SVNT_Export ::PortableServer::Servant + createNavDisplayHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); +} + +#if defined (__ACE_INLINE__) +# include "NavDisplay_svnt.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_NAVDISPLAY_SVNT_H */ diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl new file mode 100644 index 00000000000..99b44f784cc --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_svnt.inl @@ -0,0 +1,218 @@ +// $Id$ + +// 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::NavDisplay_Context::NavDisplay_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CIAO_GLUE_HUDisplay::NavDisplay_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) +{ + +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Context::~NavDisplay_Context () +{ +} + +// Operations for emits interfaces. + +// Operations for ::Components::CCMContext +ACE_INLINE ::Components::Principal_ptr +CIAO_GLUE_HUDisplay::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_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::NavDisplay_Servant::NavDisplay_Servant (HUDisplay::CCM_NavDisplay_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_NavDisplay::_duplicate (exe)), + container_ (c) +{ + this->context_ = new CIAO_GLUE_HUDisplay::NavDisplay_Context (h, c, this); +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Servant::~NavDisplay_Servant (void) +{ + this->context_->_remove_ref (); +} + +// Simplex [receptacle name] connection management operations +ACE_INLINE void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::connect_GPSLocation (HUDisplay::position_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + this->context_->connect_GPSLocation (c + ACE_ENV_ARG_PARAMETER); +} + +ACE_INLINE HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + return this->context_->disconnect_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE HUDisplay::position_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Constructor and destructor. +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::tickConsumer_Refresh_Servant +(HUDisplay::CCM_NavDisplay_ptr executor, + HUDisplay::CCM_NavDisplay_Context_ptr c) + : executor_ (HUDisplay::CCM_NavDisplay::_duplicate (executor)), + ctx_ (HUDisplay::CCM_NavDisplay_Context::_duplicate (c)) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::~tickConsumer_Refresh_Servant () +{ +} + +ACE_INLINE CORBA::Object_ptr +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +ACE_INLINE void +CIAO_GLUE_HUDisplay::NavDisplay_Servant::tickConsumer_Refresh_Servant::push_tick +(HUDisplay::tick_ptr evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->executor_->push_Refresh (evt + ACE_ENV_ARG_PARAMETER); +} + +// Operations for emits interfaces. + +// Operations for publishes interfaces. + +////////////////////////////////////////////////////////////////// +// Component Home Glue code implementation +////////////////////////////////////////////////////////////////// + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::NavDisplayHome_Servant (HUDisplay::CCM_NavDisplayHome_ptr exe, + CIAO::Session_Container *c) + : executor_ (HUDisplay::CCM_NavDisplayHome::_duplicate (exe)), + container_ (c) +{ +} + +ACE_INLINE +CIAO_GLUE_HUDisplay::NavDisplayHome_Servant::~NavDisplayHome_Servant (void) +{ +} + +// Operations for KeylessHome interface +ACE_INLINE ::Components::CCMObject_ptr +CIAO_GLUE_HUDisplay::NavDisplayHome_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::NavDisplayHome_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::NavDisplayHome_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