From d1b62af2ad0690aebf6e98ff2dfb69cc73ab455e Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Mon, 17 Apr 2006 03:56:23 +0000 Subject: *** empty log message *** --- TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp | 4 + TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp | 1 - TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp | 1 - TAO/CIAO/CIDLC/CIDLC.mpc | 18 +- TAO/CIAO/CIDLC/DescriptorGenerator.cpp | 6 +- TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp | 676 +------ TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp | 543 ++---- TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp | 10 +- TAO/CIAO/CIDLC/Literals.cpp | 16 +- TAO/CIAO/CIDLC/Literals.hpp | 16 +- TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp | 1020 ++-------- TAO/CIAO/CIDLC/ServantSourceGenerator.cpp | 1948 ++++++++++---------- .../Deployment_Configuration.h | 2 +- .../DomainApplicationManager_Impl.cpp | 605 ++++-- .../DomainApplicationManager_Impl.h | 83 +- TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h | 5 +- .../DAnCE/ExecutionManager/ExecutionManager.mpc | 9 +- .../DAnCE/ExecutionManager/Execution_Manager.cpp | 2 +- .../ExecutionManager/Execution_Manager_Impl.cpp | 1 + .../ExecutionManager/Execution_Manager_Impl.h | 2 +- TAO/CIAO/DAnCE/Interfaces/Interfaces.mpc | 12 +- .../DAnCE/NodeApplication/Configurator_Factory.cpp | 11 +- .../DAnCE/NodeApplication/Configurator_Factory.h | 2 +- TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp | 78 +- TAO/CIAO/DAnCE/NodeApplication/Container_Impl.h | 9 +- TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp | 9 + TAO/CIAO/DAnCE/NodeApplication/NodeApplication.mpc | 6 +- .../DAnCE/NodeApplication/NodeApplication_Impl.cpp | 1029 ++++++++--- .../DAnCE/NodeApplication/NodeApplication_Impl.h | 118 +- .../DAnCE/NodeApplication/NodeApplication_Impl.inl | 1 + .../NodeApplicationManager/Containers_Info_Map.cpp | 5 + .../NodeApplicationManager/ImplementationInfo.cpp | 2 +- .../NodeApplicationManager/ImplementationInfo.h | 5 +- .../NodeApplicationManager.mpc | 2 +- .../NodeApplicationManager_Impl.cpp | 255 ++- .../NodeApplicationManager_Impl.h | 27 +- TAO/CIAO/DAnCE/NodeManager/Monitor.mpc | 2 +- TAO/CIAO/DAnCE/NodeManager/MonitorController.cpp | 3 +- TAO/CIAO/DAnCE/NodeManager/MonitorController.h | 1 + TAO/CIAO/DAnCE/NodeManager/NAM_Map.h | 9 +- TAO/CIAO/DAnCE/NodeManager/NodeManager.mpc | 8 +- TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp | 25 +- TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h | 6 +- TAO/CIAO/DAnCE/NodeManager/Node_Manager.cpp | 4 +- TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp | 3 +- TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc | 4 +- TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h | 4 +- .../RTNodeApplication/NodeApplication_Task.cpp | 11 +- .../DAnCE/RTNodeApplication/NodeApplication_Task.h | 2 +- TAO/CIAO/DAnCE/RepositoryManager/PC_Updater.h | 1 - TAO/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp | 1 + TAO/CIAO/DAnCE/RepositoryManager/RM_Helper.h | 1 - TAO/CIAO/DAnCE/RepositoryManager/RMadmin.cpp | 3 +- .../DAnCE/RepositoryManager/RepositoryManager.cpp | 1 - .../DAnCE/RepositoryManager/RepositoryManager.mpc | 16 +- .../RepositoryManager/RepositoryManager_Impl.h | 4 +- .../DAnCE/StaticConfigurator/StaticDAnCEParser.mpc | 7 +- .../DAnCE/TargetManager/Deployment_Configuration.h | 6 +- TAO/CIAO/DAnCE/TargetManager/TargetManager.idl | 1 - TAO/CIAO/DAnCE/TargetManager/TargetManager.mpc | 13 +- .../tests/NodeApplicationTest/NodeAppTest.mpc | 2 +- TAO/CIAO/ciao/CCM_Base.idl | 3 - TAO/CIAO/ciao/CCM_Core.mpc | 41 +- TAO/CIAO/ciao/Container_Base.cpp | 24 +- TAO/CIAO/ciao/Container_Base.h | 37 +- TAO/CIAO/ciao/Deployment.idl | 247 +-- TAO/CIAO/ciao/Deployment_Base.idl | 2 +- TAO/CIAO/ciao/Deployment_Core.idl | 46 +- TAO/CIAO/ciao/Deployment_Data.idl | 2 +- TAO/CIAO/ciao/Dynamic_Component_Activator.h | 15 +- TAO/CIAO/ciao/NodeApp_CB_Impl.h | 14 +- TAO/CIAO/ciao/NodeApplication_CallBack.idl | 3 +- TAO/CIAO/ciao/Port_Activator.h | 4 +- TAO/CIAO/ciao/Servant_Impl_Base.cpp | 193 +- TAO/CIAO/ciao/Servant_Impl_Base.h | 103 +- TAO/CIAO/ciao/ServerResources.idl | 22 +- TAO/CIAO/ciao/Swapping_Container.cpp | 2 +- TAO/CIAO/ciao/Swapping_Container.h | 7 +- TAO/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h | 2 +- TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp | 4 +- TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.h | 4 +- TAO/CIAO/ciao/Upgradeable_Context_Impl_T.h | 7 +- TAO/CIAO/ciao/Version.h | 6 +- TAO/CIAO/docs/schema/Basic_Deployment_Data.xsd | 2 + TAO/CIAO/docs/schema/CIAOServerResources.xsd | 12 +- TAO/CIAO/docs/schema/ccd.xsd | 2 +- TAO/CIAO/docs/schema/cdd.xsd | 22 +- TAO/CIAO/docs/schema/cdp.xsd | 9 +- TAO/CIAO/docs/schema/ciaopolicy.xsd | 80 +- TAO/CIAO/docs/schema/iad.xsd | 2 +- TAO/CIAO/docs/schema/pcd.xsd | 4 +- TAO/CIAO/docs/schema/toplevel.xsd | 4 +- TAO/CIAO/docs/schema/unused_elements.xsd | 32 +- TAO/CIAO/tools/Config_Handlers/ADD_Handler.cpp | 20 +- TAO/CIAO/tools/Config_Handlers/CCD_Handler.cpp | 1 + TAO/CIAO/tools/Config_Handlers/CEPE_Handler.cpp | 5 +- TAO/CIAO/tools/Config_Handlers/CPD_Handler.cpp | 3 +- TAO/CIAO/tools/Config_Handlers/CRDD_Handler.cpp | 5 +- TAO/CIAO/tools/Config_Handlers/Config_Handlers.mpc | 148 +- TAO/CIAO/tools/Config_Handlers/DD_Handler.cpp | 1 + TAO/CIAO/tools/Config_Handlers/DP_Handler.cpp | 5 +- .../tools/Config_Handlers/DataType_Handler.cpp | 8 +- TAO/CIAO/tools/Config_Handlers/IDD_Handler.cpp | 8 +- TAO/CIAO/tools/Config_Handlers/IDREF_Base.cpp | 6 +- TAO/CIAO/tools/Config_Handlers/ID_Handler.cpp | 4 +- TAO/CIAO/tools/Config_Handlers/IRDD_Handler.cpp | 4 +- TAO/CIAO/tools/Config_Handlers/MDD_Handler.cpp | 2 +- TAO/CIAO/tools/Config_Handlers/PCD_Handler.cpp | 7 +- TAO/CIAO/tools/Config_Handlers/PCD_Handler.h | 73 +- TAO/CIAO/tools/Config_Handlers/PSPE_Handler.cpp | 1 + TAO/CIAO/tools/Config_Handlers/RDD_Handler.cpp | 1 + TAO/CIAO/tools/Config_Handlers/STD_PC_Intf.cpp | 4 +- TAO/CIAO/tools/Config_Handlers/Utils/Utils.mpc | 3 +- TAO/CIAO/tools/Config_Handlers/XML_File_Intf.cpp | 1 - TAO/CIAO/tools/IDL3_to_IDL2/be_global.h | 3 - TAO/CIAO/tools/IDL3_to_IDL2/be_init.cpp | 2 +- TAO/CIAO/tools/IDL3_to_IDL2/be_sunsoft.cpp | 14 +- .../tools/IDL3_to_IDL2/idl3_to_idl2_visitor.cpp | 269 +-- TAO/CIAO/tools/IDL3_to_IDL2/idl3_to_idl2_visitor.h | 2 +- 119 files changed, 3954 insertions(+), 4280 deletions(-) diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp b/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp index d3132eea980..f1d3ab4fb8c 100644 --- a/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp +++ b/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp @@ -16,6 +16,10 @@ namespace CCF class TokenStream { public: + // (JP 06-04-06) Not required by C++ spec, but it + // eliminates buggy GCC warnings. + virtual ~TokenStream () {} + virtual Token next () = 0; }; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp index 46fd9b9ef3a..f161123e690 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp @@ -1,7 +1,6 @@ // file : CCF/IDL2/SemanticGraph/Struct.cpp // author : Boris Kolpackov // cvs-id : $Id$ - #include "CCF/IDL2/SemanticGraph/Struct.hpp" #include "CCF/IDL2/SemanticGraph/Member.hpp" diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp index 28c673a94f3..d17c4cd4cea 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp @@ -1,7 +1,6 @@ // file : CCF/IDL2/SemanticGraph/Union.cpp // author : Boris Kolpackov // cvs-id : $Id$ - #include "CCF/IDL2/SemanticGraph/Union.hpp" namespace CCF diff --git a/TAO/CIAO/CIDLC/CIDLC.mpc b/TAO/CIAO/CIDLC/CIDLC.mpc index 9a153b3858f..034bf35a71b 100644 --- a/TAO/CIAO/CIDLC/CIDLC.mpc +++ b/TAO/CIAO/CIDLC/CIDLC.mpc @@ -7,20 +7,10 @@ project(CIDLC): cidlc { libs += CIDL IDL3 IDL2 CodeGenerationKit CompilerElements Source_Files { - ExecutorMappingGenerator.cpp - DescriptorGenerator.cpp - ExecImplGenerator.cpp - ExecImplHeaderGenerator.cpp - ExecImplSourceGenerator.cpp - ExecutorMappingGenerator.cpp - RepositoryIdGenerator.cpp - SizeTypeCalculator.cpp - ServantGenerator.cpp - ServantHeaderGenerator.cpp - ServantSourceGenerator.cpp - TypeNameEmitter.cpp - Literals.cpp - cidlc.cpp + *.cpp } + Header_Files { + *.hpp + } } diff --git a/TAO/CIAO/CIDLC/DescriptorGenerator.cpp b/TAO/CIAO/CIDLC/DescriptorGenerator.cpp index 740df3eda19..f7b5912f3fa 100644 --- a/TAO/CIAO/CIDLC/DescriptorGenerator.cpp +++ b/TAO/CIAO/CIDLC/DescriptorGenerator.cpp @@ -285,9 +285,9 @@ namespace << "" << endl; } - struct TypeNameEmitter : Traversal::Type, EmitterBase + struct FullTypeNameEmitter : Traversal::Type, EmitterBase { - TypeNameEmitter (fs::ofstream& ofs) + FullTypeNameEmitter (fs::ofstream& ofs) : EmitterBase (ofs) {} @@ -301,7 +301,7 @@ namespace }; private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; unsigned long facettag_; Traversal::Belongs belongs_; }; diff --git a/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp b/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp index 66d1d4abcd2..30c6ae09566 100644 --- a/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp +++ b/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp @@ -3,8 +3,16 @@ // cvs-id : $Id$ #include "ExecImplHeaderGenerator.hpp" -#include "TypeNameEmitter.hpp" +#include "CorbaTypeNameEmitters.hpp" +#include "UtilityTypeNameEmitters.hpp" +#include "AttributeHeaderEmitters.hpp" +#include "OperationHeaderEmitters.hpp" +#include "ParameterEmitter_T.hpp" +#include "CompositionEmitter.hpp" +#include "ModuleEmitter.hpp" +#include "InterfaceEmitter.hpp" #include "Literals.hpp" +#include "Upcase.hpp" #include @@ -18,351 +26,6 @@ using namespace CCF::CIDL::SemanticGraph; namespace { - // On some platforms toupper can be something other than a - // function. - int - upcase (int c) - { - return std::toupper (c); - } -} - -namespace -{ - class Context - { - public: - Context (std::ostream& os, - string export_macro) - : os_ (os), - export_macro_ (export_macro) - { - } - - std::ostream& - os () - { - return os_; - } - - string - export_macro () - { - return export_macro_; - } - - private: - std::ostream& os_; - string export_macro_; - }; - - class EmitterBase - { - public: - EmitterBase (Context& c) - : ctx (c), - os (ctx.os ()) - { - } - - protected: - Context& ctx; - std::ostream& os; - }; - - struct ModuleEmitter : Traversal::Module, EmitterBase - { - ModuleEmitter (Context& c) - : EmitterBase (c) - { - } - - virtual void - pre (Type& t) - { - os << "namespace " << t.name () << "{"; - } - - virtual void - post (Type&) - { - os << "}"; - } - }; - - struct CompositionEmitter : Traversal::Composition, EmitterBase - { - CompositionEmitter (Context& c) - : EmitterBase (c) - { - } - - virtual void - pre (Type& t) - { - os << STRS[CIDL_NS] << t.name () << "{"; - } - - virtual void - post (Type&) - { - os << "}"; - } - }; - - struct OperationEmitter : Traversal::Operation, EmitterBase - { - OperationEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - pre (Type&) - { - os << "virtual "; - } - - virtual void - name (Type& o) - { - os << endl << o.name (); - } - - virtual void - receives_pre (Type&) - { - os << " (" << endl; - } - - virtual void - receives_none (Type&) - { - os << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - receives_post (Type&) - { - os << endl << STRS[ENV_HDR] << ")" << endl; - } - - virtual void - raises_pre (Type&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - raises_none (Type&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - raises_post (Type&) - { - os << "))"; - } - - virtual void - post (Type&) - { - os << ";" << endl; - } - - virtual void - comma (Type&) - { - os << "," << endl; - } - }; - - // For generating parameter names. - template - struct ParameterEmitter : T - { - ParameterEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - name (typename T::Type& p) - { - os << " " << p.name (); - } - - private: - std::ostream& os; - }; - - // Generic scoped typename emitter used by various other emitters. - struct TypeNameEmitter : Traversal::Type - { - TypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name (); - } - - private: - std::ostream& os; - }; - - // Generic local typename emitter used by various other emitters. - struct SimpleTypeNameEmitter : Traversal::Type - { - SimpleTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.name (); - } - - private: - std::ostream& os; - }; - - // Generate name of type's enclosing scope. - struct EnclosingTypeNameEmitter : Traversal::Type - { - EnclosingTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name ().scope_name (); - } - - private: - std::ostream& os; - }; - - // Emits typename minus the leading double colon. - struct StrippedTypeNameEmitter : Traversal::Type - { - StrippedTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - ScopedName scoped (t.scoped_name ()); - os << Name (scoped.begin () + 1, scoped.end ()); - } - - private: - std::ostream& os; - }; - - // Generates operations associated with attributes. - // @@@ (JP) Need to support exceptions. - struct AttributeEmitter : Traversal::ReadWriteAttribute, - EmitterBase - { - AttributeEmitter (Context& c) - : EmitterBase (c), - write_type_name_emitter_ (c.os ()), - read_type_name_emitter_ (c.os ()) - { - write_belongs_.node_traverser (write_type_name_emitter_); - read_belongs_.node_traverser (read_type_name_emitter_); - } - - virtual void traverse (SemanticGraph::ReadWriteAttribute& a) - { - os << "virtual "; - - Traversal::ReadWriteAttribute::belongs (a, read_belongs_); - - os << endl - << a.name () << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; - - os << "virtual void" << endl - << a.name () << " (" << endl; - - Traversal::ReadWriteAttribute::belongs (a, write_belongs_); - - os << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; - } - - private: - INArgTypeNameEmitter write_type_name_emitter_; - ReturnTypeNameEmitter read_type_name_emitter_; - Traversal::Belongs write_belongs_; - Traversal::Belongs read_belongs_; - }; - - // Generates operations associated with readonly attributes. - // @@@ (JP) Need to support exceptions. - struct ReadOnlyAttributeEmitter : Traversal::ReadAttribute, - EmitterBase - { - ReadOnlyAttributeEmitter (Context& c) - : EmitterBase (c), - read_type_name_emitter_ (c.os ()) - { - read_belongs_.node_traverser (read_type_name_emitter_); - } - - virtual void traverse (SemanticGraph::ReadAttribute& a) - { - os << "virtual "; - - Traversal::ReadAttribute::belongs (a, read_belongs_); - - os << endl - << a.name () << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; - } - - private: - ReturnTypeNameEmitter read_type_name_emitter_; - Traversal::Belongs read_belongs_; - }; - - struct InterfaceEmitter : Traversal::UnconstrainedInterface, - EmitterBase - { - InterfaceEmitter (Context& c) - : EmitterBase (c) - {} - - bool - add (UnconstrainedInterface& i) - { - return interfaces_.insert (&i).second; - } - - virtual void - traverse (UnconstrainedInterface& i) - { - if (add (i)) - { - Traversal::UnconstrainedInterface::traverse (i); - } - } - - private: - std::set interfaces_; - }; - struct FacetEmitter : Traversal::UnconstrainedInterface, EmitterBase { @@ -378,9 +41,9 @@ namespace os << "class " << ctx.export_macro () << " " << i.name () << "_exec_i" << endl - << ": public virtual " << i.scoped_name ().scope_name () + << " : public virtual " << i.scoped_name ().scope_name () << "::CCM_" << i.name () << "," << endl - << "public virtual TAO_Local_RefCounted_Object" << endl + << " public virtual TAO_Local_RefCounted_Object" << endl << "{" << "public:" << endl << i.name () << "_exec_i (void);" @@ -395,10 +58,8 @@ namespace interface_emitter.edge_traverser (defines_); interface_emitter.edge_traverser (inherits_); - AttributeEmitter attribute_emitter (ctx); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines_.node_traverser (attribute_emitter); - defines_.node_traverser (read_only_attribute_emitter); OperationEmitter operation_emitter (ctx); defines_.node_traverser (operation_emitter); @@ -411,15 +72,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -428,9 +89,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -451,9 +112,9 @@ namespace { ExecPortsEmitter (Context& c) : EmitterBase (c), - enclosing_type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - type_name_emitter_ (c.os ()) + enclosing_type_name_emitter_ (c), + simple_type_name_emitter_ (c), + type_name_emitter_ (c) { enclosing_belongs_.node_traverser (enclosing_type_name_emitter_); simple_belongs_.node_traverser (simple_type_name_emitter_); @@ -472,31 +133,28 @@ namespace Traversal::ProviderData::belongs (p, simple_belongs_); os << "_ptr" << endl - << "get_" << p.name () << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << "get_" << p.name () << " (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; } virtual void traverse (SemanticGraph::Consumer& c) { - // @@@ (JP) May need to generate this for the eventtype's ancestors - // as well (the spec is vague on this point). If so, we need the - // CIDL compiler to support valuetype/eventtype inheritance. os << "virtual void" << endl - << "push_" << c.name () << " (" << endl; + << "push_" << c.name () << " (" << endl; Traversal::ConsumerData::belongs (c, belongs_); os << " *ev" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << STRS[ENV_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; } private: EnclosingTypeNameEmitter enclosing_type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs enclosing_belongs_; Traversal::Belongs simple_belongs_; Traversal::Belongs belongs_; @@ -538,8 +196,8 @@ namespace os << "class " << ctx.export_macro () << " " << t.name () << "_exec_i" << endl - << ": public virtual " << exec_.name () << "," << endl - << "public virtual TAO_Local_RefCounted_Object" << endl + << " : public virtual " << exec_.name () << "," << endl + << " public virtual TAO_Local_RefCounted_Object" << endl << "{" << "public:" << endl << t.name () << "_exec_i (void);" @@ -564,10 +222,8 @@ namespace interface_emitter.edge_traverser (defines); interface_emitter.edge_traverser (interface_inherits); - AttributeEmitter attribute_emitter (ctx); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); OperationEmitter operation_emitter (ctx); defines.node_traverser (operation_emitter); @@ -580,15 +236,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -597,9 +253,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -620,10 +276,8 @@ namespace Traversal::Defines defines; component_emitter.edge_traverser (defines); - AttributeEmitter attribute_emitter (ctx); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); component_emitter.traverse (t); } @@ -727,185 +381,6 @@ namespace } }; - // HomeFactory and HomeFinder are tied to Operation in - // the front end. Since we want to treat them differently - // than regular operations in a home (we want to generate - // base class factory operations returning the base component, - // for example), we use this class for regular home operations - // that overrides HomeFactory and HomeFinder traversals - // to do nothing. - struct HomeOperationEmitter : OperationEmitter, - Traversal::HomeFactory, - Traversal::HomeFinder - { - HomeOperationEmitter (Context& c) - : OperationEmitter (c) - {} - - virtual void - traverse (SemanticGraph::HomeFactory&) - { - } - - virtual void - traverse (SemanticGraph::HomeFinder&) - { - } - }; - - struct FactoryOperationEmitter : Traversal::HomeFactory, - Traversal::Home, - EmitterBase - { - FactoryOperationEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - pre (SemanticGraph::HomeFactory&) - { - os << "virtual "; - } - - virtual void - returns (SemanticGraph::HomeFactory&) - { - os << STRS[COMP_EC] << "_ptr" << endl; - } - - virtual void - name (SemanticGraph::HomeFactory& hf) - { - os << hf.name (); - } - - virtual void - receives_none (SemanticGraph::HomeFactory&) - { - os << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - receives_pre (SemanticGraph::HomeFactory&) - { - os << " (" << endl; - } - - virtual void - receives_post (SemanticGraph::HomeFactory&) - { - os << endl << STRS[ENV_HDR] << ")" << endl; - } - - virtual void - raises_none (SemanticGraph::HomeFactory&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - raises_pre (SemanticGraph::HomeFactory&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - raises_post (SemanticGraph::HomeFactory&) - { - os << "))"; - } - - virtual void - post (SemanticGraph::HomeFactory&) - { - os << ";" << endl; - } - - virtual void - comma (SemanticGraph::HomeFactory&) - { - os << "," << endl; - } - }; - - struct FinderOperationEmitter : Traversal::HomeFinder, - EmitterBase - { - FinderOperationEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - pre (SemanticGraph::HomeFinder&) - { - os << "virtual "; - } - - virtual void - returns (SemanticGraph::HomeFinder&) - { - os << STRS[COMP_EC] << "_ptr" << endl; - } - - virtual void - name (SemanticGraph::HomeFinder& t) - { - os << t.name (); - } - - virtual void - receives_none (SemanticGraph::HomeFinder&) - { - os << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - receives_pre (SemanticGraph::HomeFinder&) - { - os << " (" << endl; - } - - virtual void - receives_post (SemanticGraph::HomeFinder&) - { - os << endl << STRS[ENV_HDR] << ")" << endl; - } - - virtual void - raises_none (SemanticGraph::HomeFinder&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - raises_pre (SemanticGraph::HomeFinder&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - raises_post (SemanticGraph::HomeFinder&) - { - os << "))"; - } - - virtual void - post (SemanticGraph::HomeFinder&) - { - os << ";" << endl << endl; - } - - virtual void - comma (SemanticGraph::HomeFinder&) - { - os << "," << endl; - } - }; - struct HomeExecImplEmitter : Traversal::Home, EmitterBase { HomeExecImplEmitter (Context& c, HomeExecutor& exec) @@ -919,8 +394,8 @@ namespace { os << "class " << ctx.export_macro () << " " << t.name () << "_exec_i" << endl - << ": public virtual " << exec_.name () << "," << endl - << "public virtual TAO_Local_RefCounted_Object" << endl + << " : public virtual " << exec_.name () << "," << endl + << " public virtual TAO_Local_RefCounted_Object" << endl << "{" << "public:" << endl << t.name () << "_exec_i (void);" @@ -945,10 +420,8 @@ namespace interface_emitter.edge_traverser (defines); interface_emitter.edge_traverser (interface_inherits); - AttributeEmitter attribute_emitter (ctx); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); OperationEmitter operation_emitter (ctx); defines.node_traverser (operation_emitter); @@ -961,15 +434,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -978,9 +451,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1010,15 +483,15 @@ namespace home_operation_emitter.edge_traverser (returns); home_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -1027,9 +500,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1052,8 +525,9 @@ namespace Traversal::Defines defines; home_emitter.edge_traverser (defines); - FactoryOperationEmitter factory_operation_emitter (ctx); - FinderOperationEmitter finder_operation_emitter (ctx); + bool for_exec = true; + FactoryOperationEmitter factory_operation_emitter (ctx, for_exec); + FinderOperationEmitter finder_operation_emitter (ctx, for_exec); defines.node_traverser (factory_operation_emitter); defines.node_traverser (finder_operation_emitter); @@ -1067,15 +541,15 @@ namespace finder_operation_emitter.edge_traverser (returns); finder_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -1084,9 +558,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1107,10 +581,8 @@ namespace Traversal::Defines defines; home_emitter.edge_traverser (defines); - AttributeEmitter attribute_emitter (ctx); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); home_emitter.traverse (t); } @@ -1248,7 +720,7 @@ ExecImplHeaderEmitter::generate (TranslationUnit& u) { pre (u); - Context c (os, export_macro_); + Context c (os, export_macro_, cl_); Traversal::TranslationUnit unit; diff --git a/TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp b/TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp index 5bbd50fb84b..34bb6866061 100644 --- a/TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp +++ b/TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp @@ -3,100 +3,25 @@ // cvs-id : $Id$ #include "ExecImplSourceGenerator.hpp" +#include "CorbaTypeNameEmitters.hpp" +#include "UtilityTypeNameEmitters.hpp" +#include "ParameterEmitter_T.hpp" +#include "AttributeSourceEmitters_T.hpp" +#include "CompositionEmitter.hpp" +#include "ModuleEmitter.hpp" +#include "InterfaceEmitter.hpp" #include "Literals.hpp" -#include "TypeNameEmitter.hpp" - -#include "CCF/CodeGenerationKit/Regex.hpp" #include +#include "CCF/CodeGenerationKit/Regex.hpp" + using namespace CCF::CIDL; using namespace CCF::CIDL::SemanticGraph; using namespace StringLiterals; namespace { - class Context - { - public: - Context (std::ostream& os, - string export_macro) - : os_ (os), - export_macro_ (export_macro) - { - } - - std::ostream& - os () - { - return os_; - } - - string - export_macro () - { - return export_macro_; - } - - private: - std::ostream& os_; - string export_macro_; - }; - - class EmitterBase - { - public: - EmitterBase (Context& c) - : ctx (c), - os (ctx.os ()) - { - } - - protected: - Context& ctx; - std::ostream& os; - }; - - struct ModuleEmitter : Traversal::Module, EmitterBase - { - ModuleEmitter (Context& c) - : EmitterBase (c) - { - } - - virtual void - pre (Type& t) - { - os << "namespace " << t.name () << "{"; - } - - virtual void - post (Type&) - { - os << "}"; - } - }; - - struct CompositionEmitter : Traversal::Composition, EmitterBase - { - CompositionEmitter (Context& c) - : EmitterBase (c) - { - } - - virtual void - pre (Type& t) - { - os << STRS[CIDL_NS] << t.name () << "{"; - } - - virtual void - post (Type&) - { - os << "}"; - } - }; - template struct OperationEmitter : Traversal::Operation, EmitterBase { @@ -134,7 +59,7 @@ namespace virtual void raises_pre (Type&) { - os << STRS[EXCP_START] << endl + os << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl; } @@ -161,7 +86,7 @@ namespace Traversal::Belongs returns; operation_emitter.edge_traverser (returns); - NullReturnEmitter return_emitter (os); + NullReturnEmitter return_emitter (ctx); returns.node_traverser (return_emitter); operation_emitter.traverse (o); @@ -179,222 +104,6 @@ namespace T& scope_; }; - // For generating parameter names. - template - struct ParameterEmitter : T - { - ParameterEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - name (typename T::Type& p) - { - os << " /* " << p.name () << " */"; - } - - private: - std::ostream& os; - }; - - // Generic scoped typename emitter used by various other emitters. - struct TypeNameEmitter : Traversal::Type - { - TypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name (); - } - - private: - std::ostream& os; - }; - - // Generic local typename emitter used by various other emitters. - struct SimpleTypeNameEmitter : Traversal::Type - { - SimpleTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.name (); - } - - private: - std::ostream& os; - }; - - // Generate name of type's enclosing scope. - struct EnclosingTypeNameEmitter : Traversal::Type - { - EnclosingTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name ().scope_name (); - } - - private: - std::ostream& os; - }; - - // Emits typename minus the leading double colon. - struct StrippedTypeNameEmitter : Traversal::Type - { - StrippedTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - ScopedName scoped (t.scoped_name ()); - os << Name (scoped.begin () + 1, scoped.end ()); - } - - private: - std::ostream& os; - }; - - // Generates operations associated with attributes. - // @@@ (JP) Need to support exceptions. - template - struct AttributeEmitter : Traversal::ReadWriteAttribute, - EmitterBase - { - AttributeEmitter (Context& c, T& scope) - : EmitterBase (c), - scope_ (scope), - write_type_name_emitter_ (c.os ()), - read_type_name_emitter_ (c.os ()), - return_emitter_ (c.os ()) - { - write_belongs_.node_traverser (write_type_name_emitter_); - read_belongs_.node_traverser (read_type_name_emitter_); - return_belongs_.node_traverser (return_emitter_); - } - - virtual void traverse (SemanticGraph::ReadWriteAttribute& a) - { - Traversal::ReadWriteAttribute::belongs (a, read_belongs_); - - os << endl - << scope_.name () << "_exec_i::" << a.name () - << " (" << endl - << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << STRS[YCH] << endl; - - Traversal::ReadWriteAttribute::belongs (a, return_belongs_); - - os << "}"; - - os << "void" << endl - << scope_.name () << "_exec_i::" << a.name () - << " (" << endl; - - Traversal::ReadWriteAttribute::belongs (a, write_belongs_); - - os << " /* " << a.name () << " */" << endl - << STRS[ENV_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << STRS[YCH] - << "}"; - } - - protected: - T& scope_; - - private: - INArgTypeNameEmitter write_type_name_emitter_; - ReturnTypeNameEmitter read_type_name_emitter_; - NullReturnEmitter return_emitter_; - Traversal::Belongs write_belongs_; - Traversal::Belongs read_belongs_; - Traversal::Belongs return_belongs_; - }; - - // Generates operations associated with readonly attributes. - // @@@ (JP) Need to support exceptions. - template - struct ReadOnlyAttributeEmitter : Traversal::ReadAttribute, - EmitterBase - { - ReadOnlyAttributeEmitter (Context& c, T& scope) - : EmitterBase (c), - scope_ (scope), - read_type_name_emitter_ (c.os ()), - return_emitter_ (c.os ()) - { - read_belongs_.node_traverser (read_type_name_emitter_); - return_belongs_.node_traverser (return_emitter_); - } - - virtual void traverse (SemanticGraph::ReadAttribute& a) - { - Traversal::ReadAttribute::belongs (a, read_belongs_); - - os << endl - << scope_.name () << "_exec_i::" << a.name () - << " (" << endl - << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << STRS[YCH] << endl; - - Traversal::ReadAttribute::belongs (a, return_belongs_); - - os << "}"; - } - - protected: - T& scope_; - - private: - ReturnTypeNameEmitter read_type_name_emitter_; - NullReturnEmitter return_emitter_; - Traversal::Belongs read_belongs_; - Traversal::Belongs return_belongs_; - }; - - struct InterfaceEmitter : Traversal::UnconstrainedInterface, - EmitterBase - { - InterfaceEmitter (Context& c) - : EmitterBase (c) - {} - - bool - add (UnconstrainedInterface& i) - { - return interfaces_.insert (&i).second; - } - - virtual void - traverse (UnconstrainedInterface& i) - { - if (add (i)) - { - Traversal::UnconstrainedInterface::traverse (i); - } - } - - private: - std::set interfaces_; - }; - struct FacetEmitter : Traversal::UnconstrainedInterface, EmitterBase { @@ -431,10 +140,13 @@ namespace interface_emitter.edge_traverser (defines_); interface_emitter.edge_traverser (inherits_); - AttributeEmitter attribute_emitter (ctx, i); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx, i); + bool exec_src = true; + AttributeSourceEmitter attribute_emitter ( + ctx, + i, + exec_src + ); defines_.node_traverser (attribute_emitter); - defines_.node_traverser (read_only_attribute_emitter); OperationEmitter operation_emitter (ctx, i); defines_.node_traverser (operation_emitter); @@ -447,15 +159,25 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + bool for_exec_src = true; + ParameterEmitter in_param ( + ctx, + for_exec_src + ); + ParameterEmitter inout_param ( + ctx, + for_exec_src + ); + ParameterEmitter out_param ( + ctx, + for_exec_src + ); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -464,9 +186,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -485,9 +207,9 @@ namespace { ExecPortsEmitter (Context& c, SemanticGraph::Component& scope) : EmitterBase (c), - enclosing_type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - type_name_emitter_ (c.os ()), + enclosing_type_name_emitter_ (c), + simple_type_name_emitter_ (c), + type_name_emitter_ (c), scope_ (scope) { enclosing_belongs_.node_traverser (enclosing_type_name_emitter_); @@ -526,9 +248,6 @@ namespace virtual void traverse (SemanticGraph::Consumer& c) { - // @@@ (JP) May need to generate this for the eventtype's ancestors - // as well (the spec is vague on this point). If so, we need the - // CIDL compiler to support valuetype/eventtype inheritance. os << "void" << endl << scope_.name () << "_exec_i::push_" << c.name () << " (" << endl; @@ -546,7 +265,7 @@ namespace private: EnclosingTypeNameEmitter enclosing_type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs enclosing_belongs_; Traversal::Belongs simple_belongs_; Traversal::Belongs belongs_; @@ -619,10 +338,13 @@ namespace interface_emitter.edge_traverser (defines); interface_emitter.edge_traverser (interface_inherits); - AttributeEmitter attribute_emitter (ctx, t); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx, t); + bool exec_src = true; + AttributeSourceEmitter attribute_emitter ( + ctx, + t, + exec_src + ); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); OperationEmitter operation_emitter (ctx, t); defines.node_traverser (operation_emitter); @@ -635,15 +357,25 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + bool for_exec_src = true; + ParameterEmitter in_param ( + ctx, + for_exec_src + ); + ParameterEmitter inout_param ( + ctx, + for_exec_src + ); + ParameterEmitter out_param ( + ctx, + for_exec_src + ); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -652,9 +384,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -675,10 +407,13 @@ namespace Traversal::Defines defines; component_emitter.edge_traverser (defines); - AttributeEmitter attribute_emitter (ctx, t); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx, t); + bool exec_src = true; + AttributeSourceEmitter attribute_emitter ( + ctx, + t, + exec_src + ); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); component_emitter.traverse (t); } @@ -708,26 +443,26 @@ namespace << t.name () << "_exec_i::set_session_context (" << endl << STRS[COMP_SC] << "_ptr ctx" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_CE] << "))" << endl << "{" << "this->context_ =" << endl - << t.name () << "_Context::_narrow (" << endl - << "ctx" << endl - << STRS[ENV_ARG] <<");" + << " " << t.name () << "_Context::_narrow (" << endl + << " ctx" << endl + << " " << STRS[ENV_ARG] <<");" << "ACE_CHECK;" << endl; os << "if (this->context_ == 0)" << endl << "{" - << "ACE_THROW (CORBA::INTERNAL ());" + << "ACE_THROW ( ::CORBA::INTERNAL ());" << "}" << "}"; os << "void" << endl << t.name () << "_exec_i::ciao_preactivate (" << endl << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_CE] << "))" << endl << "{" @@ -737,7 +472,7 @@ namespace os << "void" << endl << t.name () << "_exec_i::ciao_postactivate (" << endl << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_CE] << "))" << endl << "{" @@ -747,7 +482,7 @@ namespace os << "void" << endl << t.name () << "_exec_i::ccm_activate (" << endl << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_CE] << "))" << endl << "{" @@ -757,7 +492,7 @@ namespace os << "void" << endl << t.name () << "_exec_i::ccm_passivate (" << endl << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_CE] << "))" << endl << "{" @@ -767,7 +502,7 @@ namespace os << "void" << endl << t.name () << "_exec_i::ccm_remove (" << endl << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_CE] << "))" << endl << "{" @@ -812,8 +547,8 @@ namespace { FactoryOperationEmitter (Context& c, SemanticGraph::Home& scope) : EmitterBase (c), - enclosing_type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), + enclosing_type_name_emitter_ (c), + simple_type_name_emitter_ (c), scope_ (scope) { enclosing_returns_.node_traverser (enclosing_type_name_emitter_); @@ -860,7 +595,7 @@ namespace virtual void raises_pre (SemanticGraph::HomeFactory&) { - os << STRS[EXCP_START] << endl + os << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl; } @@ -906,8 +641,8 @@ namespace { FinderOperationEmitter (Context& c, SemanticGraph::Home& scope) : EmitterBase (c), - enclosing_type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), + enclosing_type_name_emitter_ (c), + simple_type_name_emitter_ (c), scope_ (scope) { enclosing_returns_.node_traverser (enclosing_type_name_emitter_); @@ -954,7 +689,7 @@ namespace virtual void raises_pre (SemanticGraph::HomeFinder&) { - os << STRS[EXCP_START] << endl + os << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl; } @@ -1038,10 +773,13 @@ namespace interface_emitter.edge_traverser (defines); interface_emitter.edge_traverser (interface_inherits); - AttributeEmitter attribute_emitter (ctx, t); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx, t); + bool exec_src = true; + AttributeSourceEmitter attribute_emitter ( + ctx, + t, + exec_src + ); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); OperationEmitter operation_emitter (ctx, t); defines.node_traverser (operation_emitter); @@ -1054,15 +792,25 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + bool for_exec_src = true; + ParameterEmitter in_param ( + ctx, + for_exec_src + ); + ParameterEmitter inout_param ( + ctx, + for_exec_src + ); + ParameterEmitter out_param ( + ctx, + for_exec_src + ); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -1071,9 +819,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1103,15 +851,25 @@ namespace home_operation_emitter.edge_traverser (returns); home_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + bool for_exec_src = true; + ParameterEmitter in_param ( + ctx, + for_exec_src + ); + ParameterEmitter inout_param ( + ctx, + for_exec_src + ); + ParameterEmitter out_param ( + ctx, + for_exec_src + ); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -1120,9 +878,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1160,15 +918,25 @@ namespace finder_operation_emitter.edge_traverser (returns); finder_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + bool for_exec_src = true; + ParameterEmitter in_param ( + ctx, + for_exec_src + ); + ParameterEmitter inout_param ( + ctx, + for_exec_src + ); + ParameterEmitter out_param ( + ctx, + for_exec_src + ); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -1177,9 +945,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1200,10 +968,13 @@ namespace Traversal::Defines defines; home_emitter.edge_traverser (defines); - AttributeEmitter attribute_emitter (ctx, t); - ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx, t); + bool exec_src = true; + AttributeSourceEmitter attribute_emitter ( + ctx, + t, + exec_src + ); defines.node_traverser (attribute_emitter); - defines.node_traverser (read_only_attribute_emitter); home_emitter.traverse (t); } @@ -1212,12 +983,12 @@ namespace << STRS[COMP_EC] << "_ptr" << endl << t.name () << "_exec_i::create (" << endl << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_CE] << "))" << endl << "{" << STRS[COMP_EC] << "_ptr retval =" << endl - << STRS[COMP_EC] << "::_nil ();" << endl + << " " << STRS[COMP_EC] << "::_nil ();" << endl << "ACE_NEW_THROW_EX (" << endl << "retval," << endl; @@ -1226,13 +997,13 @@ namespace Traversal::Manages manages_; home_emitter.edge_traverser (manages_); - SimpleTypeNameEmitter manages_emitter (os); + SimpleTypeNameEmitter manages_emitter (ctx); manages_.node_traverser (manages_emitter); home_emitter.traverse (t); os << "_exec_i," << endl - << "CORBA::NO_MEMORY ());" + << "::CORBA::NO_MEMORY ());" << STRS[ACE_CR] << " (" << STRS[COMP_EC] << "::_nil ());" << endl << "return retval;" @@ -1249,7 +1020,7 @@ namespace << "_Impl (void)" << endl << "{" << "::Components::HomeExecutorBase_ptr retval =" << endl - << "::Components::HomeExecutorBase::_nil ();" << endl + << " ::Components::HomeExecutorBase::_nil ();" << endl << "ACE_NEW_RETURN (" << endl << "retval," << endl << t.name () << "_exec_i," << endl @@ -1299,7 +1070,7 @@ ExecImplSourceEmitter::generate (TranslationUnit& u) { pre (u); - Context c (os, export_macro_); + Context c (os, export_macro_, cl_); Traversal::TranslationUnit unit; diff --git a/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp b/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp index 46106c5572a..ca62ef3d3a2 100644 --- a/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp +++ b/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp @@ -290,11 +290,11 @@ namespace // // // - struct TypeNameEmitter : Traversal::FundamentalType, + struct FullTypeNameEmitter : Traversal::FundamentalType, Traversal::Type, Emitter { - TypeNameEmitter (Context& c, ostream& os) + FullTypeNameEmitter (Context& c, ostream& os) : Emitter (c, os) { } @@ -462,7 +462,7 @@ namespace private: Traversal::GetRaises get_raises_; Traversal::SetRaises set_raises_; - TypeNameEmitter type_name_; + FullTypeNameEmitter type_name_; }; @@ -634,7 +634,7 @@ namespace Traversal::Belongs belongs; Traversal::Belongs provider_belongs; - TypeNameEmitter type_name_emitter; + FullTypeNameEmitter type_name_emitter; }; @@ -2046,7 +2046,7 @@ generate (CommandLine const& cl, home_explicit.edge_traverser (home_explicit_defines); //-- - TypeNameEmitter type (ctx, os); + FullTypeNameEmitter type (ctx, os); ComponentContextEmitter session_component_context (ctx, os); ComponentExecutorEmitter session_component_executor (ctx, os); diff --git a/TAO/CIAO/CIDLC/Literals.cpp b/TAO/CIAO/CIDLC/Literals.cpp index af9a3d5e809..b318288a22c 100644 --- a/TAO/CIAO/CIDLC/Literals.cpp +++ b/TAO/CIAO/CIDLC/Literals.cpp @@ -28,7 +28,7 @@ namespace StringLiterals "// http://www.dre.vanderbilt.edu/CIAO" "\n\n"; - char const* const STRS[SIZE] = + char const* const STRS[LIT_SIZE] = { // ACE Environment portability macros. "ACE_ENV_ARG_DECL_WITH_DEFAULTS", // ENV_HDR @@ -41,9 +41,10 @@ namespace StringLiterals "ACE_ENV_SINGLE_ARG_PARAMETER", // ENV_SNGL_ARG // Common CORBA and all Components exceptions. - "ACE_THROW_SPEC ((CORBA::SystemException))", // EXCP_SNGL + "ACE_THROW_SPEC (( ::CORBA::SystemException))", // EXCP_SNGL "ACE_THROW_SPEC ((", // EXCP_START "::CORBA::SystemException", // EXCP_SYS + "::CORBA::BAD_PARAM ()", // EXCP_BP "::Components::IllegalState", // EXCP_IS "::Components::AlreadyConnected", // EXCP_AC "::Components::InvalidConnection", // EXCP_IC @@ -64,6 +65,9 @@ namespace StringLiterals "::Components::EnterpriseComponent", // COMP_EC "::Components::SessionContext", // COMP_SC "::Components::ConsumerDescriptions", // COMP_CD + "::Components::ReceptacleDescriptions", // COMP_RD + "::Components::PublisherDescriptions", // COMP_PD + "::Components::EmitterDescriptions", // COMP_ED // This could change - don't want it scattered all over. "namespace CIDL_", // CIDL_NS @@ -79,9 +83,11 @@ namespace StringLiterals "variable-size", // VAR_SIZE "_ciao_extract_val", // EXTRACT "_ciao_extract_tmp", // EXTRACT_TMP - "ACE_UNUSED_ARG", // ACE_UA - "ACE_CHECK_RETURN", // ACE_CR - "ACE_THROW_RETURN" // ACE_TR + "ACE_UNUSED_ARG", // ACE_UA + "ACE_CHECK", // ACE_CK + "ACE_CHECK_RETURN", // ACE_CR + "ACE_THROW", // ACE_TH + "ACE_THROW_RETURN" // ACE_TR }; } diff --git a/TAO/CIAO/CIDLC/Literals.hpp b/TAO/CIAO/CIDLC/Literals.hpp index 84f70e1a4c2..9d20978dfcc 100644 --- a/TAO/CIAO/CIDLC/Literals.hpp +++ b/TAO/CIAO/CIDLC/Literals.hpp @@ -23,6 +23,7 @@ namespace StringLiterals EXCP_SNGL, EXCP_START, EXCP_SYS, + EXCP_BP, EXCP_IS, EXCP_AC, EXCP_IC, @@ -41,6 +42,9 @@ namespace StringLiterals COMP_EC, COMP_SC, COMP_CD, + COMP_RD, + COMP_PD, + COMP_ED, CIDL_NS, TYPE_ID, TYPE_PREFIX, @@ -50,13 +54,15 @@ namespace StringLiterals VAR_SIZE, EXTRACT, EXTRACT_TMP, - ACE_UA, - ACE_CR, - ACE_TR, - SIZE + ACE_UA, + ACE_CK, + ACE_CR, + ACE_TH, + ACE_TR, + LIT_SIZE }; - extern char const* const STRS[SIZE]; + extern char const* const STRS[LIT_SIZE]; } #endif // LITERALS_HPP diff --git a/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp b/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp index 8b677954b4c..795fd3dfd5b 100644 --- a/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp +++ b/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp @@ -3,8 +3,16 @@ // cvs-id : $Id$ #include "ServantHeaderGenerator.hpp" -#include "TypeNameEmitter.hpp" +#include "CorbaTypeNameEmitters.hpp" +#include "UtilityTypeNameEmitters.hpp" +#include "AttributeHeaderEmitters.hpp" +#include "OperationHeaderEmitters.hpp" +#include "ParameterEmitter_T.hpp" +#include "CompositionEmitter.hpp" +#include "ModuleEmitter.hpp" +#include "InterfaceEmitter.hpp" #include "Literals.hpp" +#include "Upcase.hpp" #include @@ -17,475 +25,8 @@ using namespace StringLiterals; using namespace CCF::CIDL; using namespace CCF::CIDL::SemanticGraph; -using std::string; - -namespace -{ - // On some platforms toupper can be something other than a - // function. - int - upcase (int c) - { - return std::toupper (c); - } -} - namespace { - class Context - { - public: - Context (std::ostream& os, - string export_macro) - : os_ (os), - export_macro_ (export_macro) - { - } - - std::ostream& - os () - { - return os_; - } - - string - export_macro () - { - return export_macro_; - } - - private: - std::ostream& os_; - string export_macro_; - }; - - class EmitterBase - { - public: - EmitterBase (Context& c) - : ctx (c), - os (ctx.os ()) - { - } - - protected: - Context& ctx; - std::ostream& os; - }; - - struct ModuleEmitter : Traversal::Module, EmitterBase - { - ModuleEmitter (Context& c) - : EmitterBase (c) - { - } - - virtual void - pre (Type& t) - { - os << "namespace " << t.name () << "{"; - } - - virtual void - post (Type&) - { - os << "}"; - } - }; - - struct OperationEmitter : Traversal::Operation, EmitterBase - { - OperationEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - pre (Type&) - { - os << "virtual "; - } - - virtual void - name (Type& o) - { - os << endl << o.name (); - } - - virtual void - receives_pre (Type&) - { - os << " (" << endl; - } - - virtual void - receives_none (Type&) - { - os << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - receives_post (Type&) - { - os << endl << STRS[ENV_HDR] << ")" << endl; - } - - virtual void - raises_pre (Type&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - raises_none (Type&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - raises_post (Type&) - { - os << "))"; - } - - virtual void - post (Type&) - { - os << ";" << endl << endl; - } - - virtual void - comma (Type&) - { - os << "," << endl; - } - }; - - // For generating parameter names. - template - struct ParameterEmitter : T - { - ParameterEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - name (typename T::Type& p) - { - os << " " << p.name (); - } - - private: - std::ostream& os; - }; - - // Generic scoped typename emitter used by various other emitters. - struct TypeNameEmitter : Traversal::Type - { - TypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name (); - } - - private: - std::ostream& os; - }; - - // Generic local typename emitter used by various other emitters. - struct SimpleTypeNameEmitter : Traversal::Type - { - SimpleTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.name (); - } - - private: - std::ostream& os; - }; - - // Generate name of type's enclosing scope. - struct EnclosingTypeNameEmitter : Traversal::Type - { - EnclosingTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name ().scope_name (); - } - - private: - std::ostream& os; - }; - - // Emits typename minus the leading double colon. - struct StrippedTypeNameEmitter : Traversal::Type - { - StrippedTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - ScopedName scoped (t.scoped_name ()); - os << Name (scoped.begin () + 1, scoped.end ()); - } - - private: - std::ostream& os; - }; - - // Generates the set operation of a ReadWriteAttribute. - struct WriteAttributeEmitter : Traversal::ReadWriteAttribute, - EmitterBase - { - WriteAttributeEmitter (Context& c) - : EmitterBase (c), - write_type_name_emitter_ (c.os ()), - type_name_emitter_ (c.os ()) - { - write_belongs_.node_traverser (write_type_name_emitter_); - - edge_traverser (set_raises_); - set_raises_.node_traverser (type_name_emitter_); - } - - virtual void - pre (SemanticGraph::ReadWriteAttribute&) - { - os << "virtual void" << endl; - } - - virtual void - name (SemanticGraph::ReadWriteAttribute& a) - { - os << a.name () << " (" << endl; - - Traversal::ReadWriteAttribute::belongs (a, write_belongs_); - - os << " " << a.name () << endl - << STRS[ENV_HDR] << ")" << endl; - } - - virtual void - get_raises (SemanticGraph::ReadWriteAttribute&) - { - } - - virtual void - set_raises_none (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - set_raises_pre (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - set_raises_post (SemanticGraph::ReadWriteAttribute&) - { - os << "))"; - } - - virtual void - post (SemanticGraph::ReadWriteAttribute&) - { - os << ";" << endl << endl; - } - - virtual void - comma (SemanticGraph::ReadWriteAttribute&) - { - os << "," << endl; - } - - private: - INArgTypeNameEmitter write_type_name_emitter_; - TypeNameEmitter type_name_emitter_; - Traversal::Belongs write_belongs_; - Traversal::SetRaises set_raises_; - }; - - // Generates operations associated with attributes. - struct AttributeEmitter : Traversal::ReadAttribute, - Traversal::ReadWriteAttribute, - EmitterBase - { - AttributeEmitter (Context& c) - : EmitterBase (c), - read_type_name_emitter_ (c.os ()), - type_name_emitter_ (c.os ()) - { - read_belongs_.node_traverser (read_type_name_emitter_); - - edge_traverser (get_raises_); - get_raises_.node_traverser (type_name_emitter_); - } - - // ReadWriteAttribute - // - virtual void - pre (SemanticGraph::ReadWriteAttribute& a) - { - os << "virtual "; - - Traversal::ReadWriteAttribute::belongs (a, read_belongs_); - - os << endl; - } - - virtual void - name (SemanticGraph::ReadWriteAttribute& a) - { - os << a.name () << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - get_raises_none (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - get_raises_pre (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - get_raises_post (SemanticGraph::ReadWriteAttribute&) - { - os << "))"; - } - - virtual void - set_raises (SemanticGraph::ReadWriteAttribute&) - { - } - - virtual void - post (SemanticGraph::ReadWriteAttribute& a) - { - os << ";" << endl << endl; - - WriteAttributeEmitter write_attribute_emitter (ctx); - write_attribute_emitter.traverse (a); - } - - virtual void - comma (SemanticGraph::ReadWriteAttribute&) - { - os << "," << endl; - } - - // ReadAttribute - // - virtual void - pre (SemanticGraph::ReadAttribute& a) - { - os << "virtual "; - - Traversal::ReadAttribute::belongs (a, read_belongs_); - - os << endl; - } - - virtual void - name (SemanticGraph::ReadAttribute& a) - { - os << a.name () << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - get_raises_none (SemanticGraph::ReadAttribute&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - get_raises_pre (SemanticGraph::ReadAttribute&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - get_raises_post (SemanticGraph::ReadAttribute&) - { - os << "))"; - } - - virtual void - set_raises (SemanticGraph::ReadAttribute&) - { - } - - virtual void - post (SemanticGraph::ReadAttribute&) - { - os << ";" << endl << endl; - } - - virtual void - comma (SemanticGraph::ReadAttribute&) - { - os << "," << endl; - } - - private: - ReturnTypeNameEmitter read_type_name_emitter_; - TypeNameEmitter type_name_emitter_; - Traversal::Belongs read_belongs_; - Traversal::GetRaises get_raises_; - }; - - struct InterfaceEmitter : Traversal::Interface, - EmitterBase - { - InterfaceEmitter (Context& c) - : EmitterBase (c) - {} - - bool - add (Interface& i) - { - return interfaces_.insert (&i).second; - } - - virtual void - traverse (Interface& i) - { - if (add (i)) - { - Traversal::Interface::traverse (i); - } - } - - private: - std::set interfaces_; - }; - struct FacetEmitter : Traversal::UnconstrainedInterface, EmitterBase { @@ -522,7 +63,7 @@ namespace interface_emitter.edge_traverser (inherits_); // Works for both read/write and readonly attributes. - AttributeEmitter attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines_.node_traverser (attribute_emitter); OperationEmitter operation_emitter (ctx); @@ -536,15 +77,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -553,9 +94,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -569,7 +110,6 @@ namespace << "_get_component (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl << STRS[EXCP_SNGL] << ";" << endl - << endl << "protected:" << endl << "// Facet executor." << endl << i.scoped_name ().scope_name ()<< "::CCM_" << i.name () @@ -602,7 +142,7 @@ namespace { PortsEmitterPublic (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -672,7 +212,7 @@ namespace { PortsEmitterProtected (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -687,9 +227,9 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_AC] << "));" << endl << endl; + << STRS[EXCP_AC] << "));" << endl; os << "virtual "; @@ -698,9 +238,9 @@ namespace os << "Consumer_ptr" << endl << "disconnect_" << e.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_NC] << "));" << endl << endl; + << STRS[EXCP_NC] << "));" << endl; } virtual void @@ -713,10 +253,10 @@ namespace os << "_ptr" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_AC] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; os << "virtual "; @@ -725,9 +265,9 @@ namespace os << "_ptr" << endl << "disconnect_" << u.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_NC] << "));" << endl << endl; + << STRS[EXCP_NC] << "));" << endl; } virtual void @@ -740,10 +280,10 @@ namespace os << "_ptr" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; os << "virtual "; @@ -753,9 +293,9 @@ namespace << "disconnect_" << u.name () << " (" << endl << "::Components::Cookie * ck" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; } virtual void @@ -768,18 +308,18 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_ECL] << "));" << endl << endl; + << STRS[EXCP_ECL] << "));" << endl; os << "// CIAO-specific." << endl << STRS[COMP_CK] << " *" << endl << "subscribe_" << p.name () << "_generic (" << endl << STRS[COMP_ECB] << "_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_ECL] << "));" << endl << endl; + << STRS[EXCP_ECL] << "));" << endl; os << "virtual "; @@ -789,13 +329,13 @@ namespace << "unsubscribe_" << p.name () << " (" << endl << STRS[COMP_CK] << " *ck" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; }; @@ -807,7 +347,7 @@ namespace { PortsEmitterMembers (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -819,7 +359,7 @@ namespace os << "Consumer_var" << endl << "ciao_emits_" << e.name () << "_consumer_;" - << endl << endl; + << endl; } virtual void @@ -830,7 +370,7 @@ namespace Traversal::SingleUserData::belongs (u, belongs_); os << "_var" << endl - << "ciao_uses_" << u.name () << "_;" << endl << endl; + << "ciao_uses_" << u.name () << "_;" << endl; } virtual void @@ -842,7 +382,7 @@ namespace Traversal::MultiUserData::belongs (u, belongs_); os << "_var>" << endl - << "ciao_uses_" << u.name () << "_;" << endl << endl; + << "ciao_uses_" << u.name () << "_;" << endl; } virtual void @@ -854,16 +394,16 @@ namespace os << "Consumer_var>" << endl << "ciao_publishes_" << p.name () << "_map_;" - << endl << endl; + << endl; os << "ACE_Active_Map_Manager<" << endl << STRS[COMP_ECB] << "_var>" << endl << "ciao_publishes_" << p.name () << "_generic_map_;" - << endl << endl; + << endl; } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; }; @@ -1063,9 +603,9 @@ namespace { PortsEmitterPublic (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - stripped_type_name_emitter_ (c.os ()) + type_name_emitter_ (c), + simple_type_name_emitter_ (c), + stripped_type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); simple_belongs_.node_traverser (simple_type_name_emitter_); @@ -1082,7 +622,7 @@ namespace os << "_ptr" << endl << "provide_" << p.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; } virtual void @@ -1095,10 +635,10 @@ namespace os << "_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_AC] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; os << "virtual "; @@ -1107,9 +647,9 @@ namespace os << "_ptr" << endl << "disconnect_" << u.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_NC] << "));" << endl << endl; + << STRS[EXCP_NC] << "));" << endl; os << "virtual "; @@ -1118,7 +658,7 @@ namespace os << "_ptr" << endl << "get_connection_" << u.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; } virtual void @@ -1131,10 +671,10 @@ namespace os << "_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; os << "virtual "; @@ -1144,14 +684,14 @@ namespace << "disconnect_" << u.name () << " (" << endl << "::Components::Cookie * ck" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; os << "virtual " << u.scoped_name () << "Connections *" << endl << "get_connections_" << u.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; } virtual void @@ -1181,18 +721,15 @@ namespace << endl << c.scoped_name ().scope_name ().scope_name () << "::CCM_" << c.scoped_name ().scope_name ().simple_name () - << "_Context_ptr c);" << endl << endl; + << "_Context_ptr c);" << endl; os << "virtual ~"; Traversal::ConsumerData::belongs (c, simple_belongs_); os << "Consumer_" - << c.name () << "_Servant (void);" << endl << endl; + << c.name () << "_Servant (void);" << endl; - // @@@ (JP) May need to generate this for the eventtype's ancestors - // as well (the spec is vague on this point). If so, we need the - // CIDL compiler to support valuetype/eventtype inheritance. os << "virtual void" << endl << "push_"; @@ -1204,39 +741,39 @@ namespace os << " *evt" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; os << "// Inherited from " << STRS[COMP_ECB] << "." << endl << "virtual void" << endl - << "push_event (::Components::EventBase *ev" << endl + << "push_event ( ::Components::EventBase *ev" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_BET] << "));" << endl << endl; + << STRS[EXCP_BET] << "));" << endl; os << "// CIAO-specific in " << STRS[COMP_ECB] << "." << endl << "virtual CORBA::Boolean" << endl << "ciao_is_substitutable (" << endl << "const char *event_repo_id" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; os << "// Get component implementation." << endl << "virtual CORBA::Object_ptr" << endl << "_get_component (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; os << "protected:" << endl << c.scoped_name ().scope_name ().scope_name () << "::CCM_" << c.scoped_name ().scope_name ().simple_name () << "_var" << endl - << "executor_;" << endl << endl; + << "executor_;" << endl; os << c.scoped_name ().scope_name ().scope_name () << "::CCM_" << c.scoped_name ().scope_name ().simple_name () << "_Context_var" << endl - << "ctx_;" << endl << endl; + << "ctx_;" << endl; os << "};"; @@ -1247,7 +784,7 @@ namespace os << "Consumer_ptr" << endl << "get_consumer_" << c.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; } virtual void @@ -1260,9 +797,9 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_AC] << "));" << endl << endl; + << STRS[EXCP_AC] << "));" << endl; os << "virtual "; @@ -1271,9 +808,9 @@ namespace os << "Consumer_ptr" << endl << "disconnect_" << e.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_NC] << "));" << endl << endl; + << STRS[EXCP_NC] << "));" << endl; } virtual void @@ -1286,18 +823,18 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_ECL] << "));" << endl << endl; + << STRS[EXCP_ECL] << "));" << endl; os << "// CIAO-specific." << endl << STRS[COMP_CK] << " *" << endl << "subscribe_" << p.name () << "_generic (" << endl << STRS[COMP_ECB] << "_ptr c" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_ECL] << "));" << endl << endl; + << STRS[EXCP_ECL] << "));" << endl; os << "virtual "; @@ -1307,13 +844,13 @@ namespace << "unsubscribe_" << p.name () << " (" << endl << STRS[COMP_CK] << " *ck" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; StrippedTypeNameEmitter stripped_type_name_emitter_; Traversal::Belongs belongs_; @@ -1327,7 +864,7 @@ namespace { PortsEmitterProtected (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -1338,7 +875,7 @@ namespace Traversal::ProviderData::belongs (p, belongs_); os << "_var" << endl - << "provide_" << p.name () << "_;" << endl << endl; + << "provide_" << p.name () << "_;" << endl; } virtual void @@ -1347,11 +884,11 @@ namespace Traversal::ConsumerData::belongs (c, belongs_); os << "Consumer_var" << endl - << "consumes_" << c.name () << "_;" << endl << endl; + << "consumes_" << c.name () << "_;" << endl; } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; }; @@ -1365,9 +902,9 @@ namespace { PortsEmitterPrivate (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - stripped_type_name_emitter_ (c.os ()) + type_name_emitter_ (c), + simple_type_name_emitter_ (c), + stripped_type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); simple_belongs_.node_traverser (simple_type_name_emitter_); @@ -1380,7 +917,7 @@ namespace os << "::CORBA::Object_ptr" << endl << "provide_" << p.name () << "_i (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; } virtual void @@ -1399,7 +936,7 @@ namespace os << "::Components::EventConsumerBase_ptr" << endl << "get_consumer_" << c.name () << "_i (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; } virtual void @@ -1413,7 +950,7 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; StrippedTypeNameEmitter stripped_type_name_emitter_; Traversal::Belongs belongs_; @@ -1449,7 +986,7 @@ namespace << " " << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_var," << endl << " " << t.name () << "_Context" << endl - << " > comp_svnt_base;" << endl << endl; + << " > comp_svnt_base;" << endl; os << t.name () << "_Servant (" << endl << t.scoped_name ().scope_name () << "::CCM_" << t.name () @@ -1457,15 +994,14 @@ namespace << "::Components::CCMHome_ptr h," << endl << "const char *ins_name," << endl << "::CIAO::Home_Servant_Impl_Base *hs," << endl - << "::CIAO::Session_Container *c);" << endl << endl; + << "::CIAO::Session_Container *c);" << endl; - os << "virtual ~" << t.name () << "_Servant (void);" - << endl << endl; + os << "virtual ~" << t.name () << "_Servant (void);" << endl; os << "virtual void" << endl << "set_attributes (" << endl << "const ::Components::ConfigValues &descr" << endl - << STRS[ENV_SRC] << ");" << endl << endl; + << STRS[ENV_SRC] << ");" << endl; os << "// Supported operations." << endl << endl; @@ -1488,7 +1024,7 @@ namespace interface_emitter.edge_traverser (interface_inherits); // Works for both read/write and readonly attributes. - AttributeEmitter attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); OperationEmitter operation_emitter (ctx); @@ -1502,15 +1038,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -1519,9 +1055,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1563,7 +1099,7 @@ namespace component_emitter.edge_traverser (component_inherits); // Works for both read/write and readonly attributes. - AttributeEmitter attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); component_emitter.traverse (t); @@ -1576,24 +1112,29 @@ namespace << "const char *name," << endl << "CORBA::Object_ptr connection" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_IC] << "," << endl << STRS[EXCP_AC] << "," << endl - << STRS[EXCP_ECL] << "));" << endl << endl; + << STRS[EXCP_ECL] << "));" << endl; os << "virtual CORBA::Object_ptr" << endl << "disconnect (" << endl << "const char *name," << endl << STRS[COMP_CK] << " *ck" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_IC] << "," << endl << STRS[EXCP_CR] << "," << endl - << STRS[EXCP_NC] << "));" << endl << endl; + << STRS[EXCP_NC] << "));" << endl; + + os << "virtual " << STRS[COMP_RD] << " *" << endl + << "get_all_receptacles (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; os << "// Operations for Events interface." << endl << endl; @@ -1602,40 +1143,59 @@ namespace << "const char *publisher_name," << endl << STRS[COMP_ECB] << "_ptr subscriber" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_IC] << "," << endl - << STRS[EXCP_ECL] << "));" << endl << endl; + << STRS[EXCP_ECL] << "));" << endl; os << "virtual " << STRS[COMP_ECB] << "_ptr" << endl << "unsubscribe (" << endl << "const char *publisher_name," << endl << STRS[COMP_CK] << " *ck" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; os << "virtual void" << endl << "connect_consumer (" << endl << "const char *emitter_name," << endl << STRS[COMP_ECB] << "_ptr consumer" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_AC] << "," << endl - << STRS[EXCP_IC] << "));" << endl << endl; + << STRS[EXCP_IC] << "));" << endl; - os << "// CIAO specific operations on the servant " << endl + os << "virtual " << STRS[COMP_ECB] << "_ptr" << endl + << "disconnect_consumer (" << endl + << "const char *source_name" << endl + << STRS[ENV_HDR] << ")" << endl + << STRS[EXCP_START] << " " + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_IN] << "," << endl + << STRS[EXCP_NC] << "));" << endl; + + os << "virtual " << STRS[COMP_PD] << " *" << endl + << "get_all_publishers (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; + + os << "virtual " << STRS[COMP_ED] << " *" << endl + << "get_all_emitters (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; + + os << "// CIAO specific operations on the servant. " << endl << "CORBA::Object_ptr" << endl << "get_facet_executor (" << endl << "const char *name" << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS]<< "));" << endl << endl; + << STRS[EXCP_START] << " " + << STRS[EXCP_SYS]<< "));" << endl; os << "private:" << endl << endl; @@ -1656,13 +1216,13 @@ namespace component_emitter.traverse (t); } - os << "const char *ins_name_;" << endl << endl; + os << "const char *ins_name_;" << endl; os << "private:" << endl << endl << "void" << endl << "populate_port_tables (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; + << STRS[EXCP_SNGL] << ";" << endl; // Generate private operations for ports. { @@ -1695,211 +1255,15 @@ namespace HomeEmitter (Context& c, CommandLine const& cl) : EmitterBase (c), cl_ (cl), - type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - enclosing_type_name_emitter_ (c.os ()) + type_name_emitter_ (c), + simple_type_name_emitter_ (c), + enclosing_type_name_emitter_ (c) { manages_.node_traverser (type_name_emitter_); simple_manages_.node_traverser (simple_type_name_emitter_); enclosing_manages_.node_traverser (enclosing_type_name_emitter_); } - // Nested classes used by this emitter. - private: - // HomeFactory and HomeFinder are tied to Operation in - // the front end. Since we want to treat them differently - // than regular operations in a home (we want to generate - // base class factory operations returning the base component, - // for example), we use this class for regular home operations - // that overrides HomeFactory and HomeFinder traversals - // to do nothing. - struct HomeOperationEmitter : OperationEmitter, - Traversal::HomeFactory, - Traversal::HomeFinder - { - HomeOperationEmitter (Context& c) - : OperationEmitter (c) - {} - - virtual void - traverse (SemanticGraph::HomeFactory&) - { - } - - virtual void - traverse (SemanticGraph::HomeFinder&) - { - } - }; - - struct FactoryOperationEmitter : Traversal::HomeFactory, - EmitterBase - { - FactoryOperationEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - pre (SemanticGraph::HomeFactory&) - { - os << "virtual "; - } - - virtual void - returns (SemanticGraph::HomeFactory& t) - { - ReturnTypeNameEmitter returns_emitter (os); - Traversal::Returns returns_; - returns_.node_traverser (returns_emitter); - - Traversal::HomeFactory::returns (t, returns_); - - os << endl; - } - - virtual void - name (SemanticGraph::HomeFactory& t) - { - os << t.name (); - } - - virtual void - receives_none (SemanticGraph::HomeFactory&) - { - os << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - receives_pre (SemanticGraph::HomeFactory&) - { - os << " (" << endl; - } - - virtual void - receives_post (SemanticGraph::HomeFactory&) - { - os << endl << STRS[ENV_HDR] << ")" << endl; - } - - virtual void - raises_none (SemanticGraph::HomeFactory&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - raises_pre (SemanticGraph::HomeFactory&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - raises_post (SemanticGraph::HomeFactory&) - { - os << "))"; - } - - virtual void - post (SemanticGraph::HomeFactory&) - { - os << ";" << endl << endl; - } - - virtual void - comma (SemanticGraph::HomeFactory&) - { - os << "," << endl; - } - }; - - struct FinderOperationEmitter : Traversal::HomeFinder, - EmitterBase - { - FinderOperationEmitter (Context& c) - : EmitterBase (c), - returns_emitter_ (c.os ()) - { - returns_.node_traverser (returns_emitter_); - } - - virtual void - pre (SemanticGraph::HomeFinder&) - { - os << "virtual "; - } - - virtual void - returns (SemanticGraph::HomeFinder& t) - { - Traversal::HomeFinder::returns (t, returns_); - - os << endl; - } - - virtual void - name (SemanticGraph::HomeFinder& t) - { - os << t.name (); - } - - virtual void - receives_none (SemanticGraph::HomeFinder&) - { - os << " (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl; - } - - virtual void - receives_pre (SemanticGraph::HomeFinder&) - { - os << " (" << endl; - } - - virtual void - receives_post (SemanticGraph::HomeFinder&) - { - os << endl << STRS[ENV_HDR] << ")" << endl; - } - - virtual void - raises_none (SemanticGraph::HomeFinder&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - raises_pre (SemanticGraph::HomeFinder&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - raises_post (SemanticGraph::HomeFinder&) - { - os << "))"; - } - - virtual void - post (SemanticGraph::HomeFinder&) - { - os << ";" << endl << endl; - } - - virtual void - comma (SemanticGraph::HomeFinder&) - { - os << "," << endl; - } - - private: - ReturnTypeNameEmitter returns_emitter_; - Traversal::Returns returns_; - }; - - public: virtual void pre (Type& t) { os << "class " << ctx.export_macro () << " " << t.name () @@ -1995,19 +1359,18 @@ namespace Traversal::Home::manages (t, simple_manages_); os << "_Servant" << endl - << " > home_svnt_base;" << endl << endl; + << " > home_svnt_base;" << endl; os << t.name () << "_Servant (" << endl << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_ptr exe," << endl << "const char *ins_name," << endl - << "::CIAO::Session_Container *c);" << endl << endl; + << "::CIAO::Session_Container *c);" << endl; - os << "virtual ~" << t.name () << "_Servant (void);" - << endl << endl; + os << "virtual ~" << t.name () << "_Servant (void);" << endl; // Generate home operations. - os << "// Home operations." << endl << endl; + os << "// Home operations." << endl; { Traversal::Home home_emitter; @@ -2029,15 +1392,15 @@ namespace home_operation_emitter.edge_traverser (returns); home_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -2046,9 +1409,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -2086,15 +1449,15 @@ namespace finder_operation_emitter.edge_traverser (returns); finder_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -2103,9 +1466,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -2127,7 +1490,7 @@ namespace home_emitter.edge_traverser (home_inherits); // Works for both read/write and readonly attributes. - AttributeEmitter attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); home_emitter.traverse (t); @@ -2153,7 +1516,7 @@ namespace interface_emitter.edge_traverser (inherits); // Works for both read/write and readonly attributes. - AttributeEmitter attribute_emitter (ctx); + AttributeHeaderEmitter attribute_emitter (ctx); defines.node_traverser (attribute_emitter); OperationEmitter operation_emitter (ctx); @@ -2167,15 +1530,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -2184,9 +1547,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -2210,7 +1573,7 @@ namespace private: CommandLine const& cl_; - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; EnclosingTypeNameEmitter enclosing_type_name_emitter_; Traversal::Manages manages_; @@ -2218,26 +1581,6 @@ namespace Traversal::Manages enclosing_manages_; }; - struct CompositionEmitter : Traversal::Composition, EmitterBase - { - CompositionEmitter (Context& c) - : EmitterBase (c) - { - } - - virtual void - pre (Type& t) - { - os << STRS[CIDL_NS] << t.name () << "{"; - } - - virtual void - post (Type&) - { - os << "}"; - } - }; - struct IncludesEmitter : Traversal::QuoteIncludes, Traversal::BracketIncludes, EmitterBase @@ -2361,8 +1704,7 @@ ServantHeaderEmitter::pre (TranslationUnit&) << "#include \"ciao/" << (swapping ? "Swapping_Servant_Home_Impl_T.h" : "Home_Servant_Impl_T.h") - << "\"" << endl - << "#include \"ace/Active_Map_Manager_T.h\"" << endl << endl; + << "\"" << endl << endl; } void @@ -2370,7 +1712,7 @@ ServantHeaderEmitter::generate (TranslationUnit& u) { pre (u); - Context c (os, export_macro_); + Context c (os, export_macro_, cl_); Traversal::TranslationUnit unit; diff --git a/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp b/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp index a83c7673f4f..8226b0d8fe3 100644 --- a/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp +++ b/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp @@ -1,15 +1,20 @@ // file : CIDLC/ServantSourceGenerator.cpp // author : Jeff Parsons // cvs-id : $Id$ - #include "ServantSourceGenerator.hpp" +#include "CorbaTypeNameEmitters.hpp" +#include "UtilityTypeNameEmitters.hpp" +#include "ParameterEmitter_T.hpp" +#include "AttributeSourceEmitters_T.hpp" +#include "CompositionEmitter.hpp" +#include "ModuleEmitter.hpp" +#include "InterfaceEmitter.hpp" #include "Literals.hpp" -#include "TypeNameEmitter.hpp" - -#include "CCF/CodeGenerationKit/Regex.hpp" #include +#include "CCF/CodeGenerationKit/Regex.hpp" + using namespace CCF::CIDL; using namespace CCF::CIDL::SemanticGraph; using namespace StringLiterals; @@ -18,137 +23,51 @@ using std::string; namespace { - class Context - { - public: - Context (std::ostream& os, - string export_macro, - CommandLine const& cl) - : os_ (os), - export_macro_ (export_macro), - cl_ (cl) - { - } - - std::ostream& - os () - { - return os_; - } - - string - export_macro () - { - return export_macro_; - } - - CommandLine const& - cl () - { - return cl_; - } - - string - composition_name () - { - return composition_name_; - } - - void - composition_name (const string& name) - { - composition_name_ = name; - } - - private: - std::ostream& os_; - string export_macro_; - CommandLine const& cl_; - string composition_name_; - }; - - class EmitterBase + struct RepoIdEmitter : Traversal::Type, + EmitterBase { - public: - EmitterBase (Context& c) - : ctx (c), - os (ctx.os ()) + RepoIdEmitter (Context& c) + : EmitterBase (c) { } - - protected: - Context& ctx; - std::ostream& os; - }; - - struct RepoIdEmitter : Traversal::Type - { - RepoIdEmitter (std::ostream& os_) - : os (os_) - {} - + virtual void traverse (SemanticGraph::Type& t) { os << "\"" << t.context ().get (STRS[REPO_ID]) << "\""; } - - private: - std::ostream& os; }; - struct ModuleEmitter : Traversal::Module, EmitterBase + struct ConsumerRepoIdEmitter : Traversal::Type, + EmitterBase { - ModuleEmitter (Context& c) + ConsumerRepoIdEmitter (Context& c) : EmitterBase (c) { } virtual void - pre (Type& t) - { - os << "namespace " << t.name () << "{"; - } - - virtual void - post (Type&) + traverse (SemanticGraph::Type& t) { - os << "}"; + string holder (t.context ().get (STRS[REPO_ID])); + os << "\"" << holder.substr (0, holder.rfind (':')) + << "Consumer:1.0\""; } }; - struct FlatNameEmitter : Traversal::Type + struct FlatNameEmitter : Traversal::Type, + EmitterBase { - FlatNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) + FlatNameEmitter (Context& c) + : EmitterBase (c) { - os << regex::perl_s (t.scoped_name ().str (), "/::/_/"); } - private: - std::ostream& os; - }; - - struct ConsumerRepoIdEmitter : Traversal::Type - { - ConsumerRepoIdEmitter (std::ostream& os_) - : os (os_) - {} - virtual void traverse (SemanticGraph::Type& t) { - string holder (t.context ().get (STRS[REPO_ID])); - os << "\"" << holder.substr (0, holder.rfind (':')) - << "Consumer:1.0\""; + os << regex::perl_s (t.scoped_name ().str (), "/::/_/"); } - - private: - std::ostream& os; }; struct OperationExecEmitter : Traversal::Operation, @@ -224,24 +143,6 @@ namespace std::ostream& os; }; - // For generating parameter names. - template - struct ParameterEmitter : T - { - ParameterEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - name (typename T::Type& p) - { - os << " " << p.name (); - } - - private: - std::ostream& os; - }; - // For generating parameter names in operation delegation. template struct ParameterExecEmitter : T @@ -267,7 +168,7 @@ namespace T& scope) : EmitterBase (c), scope_ (scope), - ace_check_return_emitter_ (c.os ()) + ace_check_return_emitter_ (c) { ace_check_returns_.node_traverser (ace_check_return_emitter_); } @@ -316,510 +217,61 @@ namespace } virtual void - raises_pre (Type&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - raises_none (Type&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - raises_post (Type&) - { - os << "))"; - } - - virtual void - post (Type& o) - { - os << "{"; - - this->gen_swap_related (o); - - OperationExecEmitter operation_emitter (ctx); - - Traversal::Receives receives; - Traversal::Belongs returns; - operation_emitter.edge_traverser (receives); - operation_emitter.edge_traverser (returns); - - ParameterExecEmitter param (os); - receives.node_traverser (param); - - OpExecReturnEmitter return_emitter (os); - returns.node_traverser (return_emitter); - - operation_emitter.traverse (o); - - os << "}"; - } - - virtual void - comma (Type&) - { - os << "," << endl; - } - - protected: - T& scope_; - AceCheckReturnEmitter ace_check_return_emitter_; - Traversal::Returns ace_check_returns_; - }; - - // Generic scoped typename emitter used by various other emitters. - struct TypeNameEmitter : Traversal::Type - { - TypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name (); - } - - private: - std::ostream& os; - }; - - // Generic local typename emitter used by various other emitters. - struct SimpleTypeNameEmitter : Traversal::Type - { - SimpleTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.name (); - } - - private: - std::ostream& os; - }; - - // Generate name of type's enclosing scope. - struct EnclosingTypeNameEmitter : Traversal::Type - { - EnclosingTypeNameEmitter (std::ostream& os_) - : os (os_) - {} - - virtual void - traverse (SemanticGraph::Type& t) - { - os << t.scoped_name ().scope_name (); - } - - private: - std::ostream& os; - }; - - struct InterfaceEmitter : Traversal::Interface, - EmitterBase - { - InterfaceEmitter (Context& c) - : EmitterBase (c) - {} - - bool - add (Interface& i) - { - return interfaces_.insert (&i).second; - } - - virtual void - traverse (Interface& i) - { - if (add (i)) - { - Traversal::Interface::traverse (i); - } - } - - private: - std::set interfaces_; - }; - - // Generates the set operation of a ReadWriteAttribute. - template - struct WriteAttributeEmitter : Traversal::ReadWriteAttribute, - EmitterBase - { - WriteAttributeEmitter (Context& c, T& scope, bool swapping) - : EmitterBase (c), - scope_ (scope), - write_type_name_emitter_ (c.os ()), - type_name_emitter_ (c.os ()), - swapping_ (swapping) - { - write_belongs_.node_traverser (write_type_name_emitter_); - - edge_traverser (set_raises_); - set_raises_.node_traverser (type_name_emitter_); - } - - virtual void - gen_swapping_set () - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK;" << endl; - } - - virtual void - pre (SemanticGraph::ReadWriteAttribute&) - { - os << "void" << endl; - } - - virtual void - name (SemanticGraph::ReadWriteAttribute& a) - { - os << scope_.name () << "_Servant::" << a.name () << " (" << endl; - - Traversal::ReadWriteAttribute::belongs (a, write_belongs_); - - os << " " << a.name () << endl - << STRS[ENV_SRC] << ")" << endl; - } - - virtual void - get_raises (SemanticGraph::ReadWriteAttribute&) - { - } - - virtual void - set_raises_none (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_SNGL]; - } - - virtual void - set_raises_pre (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - set_raises_post (SemanticGraph::ReadWriteAttribute&) - { - os << "))" << endl; - } - - virtual void - post (SemanticGraph::ReadWriteAttribute& a) - { - os << "{"; - - if (swapping_) - { - this->gen_swapping_set (); - } - - os << "this->executor_->" << a.name () << " (" << endl - << a.name () << endl - << STRS[ENV_ARG] << ");" << endl - << "}"; - } - - virtual void - comma (SemanticGraph::ReadWriteAttribute&) - { - os << "," << endl; - } - - protected: - T& scope_; - Traversal::Belongs write_belongs_; - - private: - INArgTypeNameEmitter write_type_name_emitter_; - TypeNameEmitter type_name_emitter_; - Traversal::SetRaises set_raises_; - bool swapping_; - }; - - // Generates operations associated with attributes. - template - struct AttributeEmitter : Traversal::ReadAttribute, - Traversal::ReadWriteAttribute, - EmitterBase - { - AttributeEmitter (Context& c, T& scope) - : EmitterBase (c), - scope_ (scope), - read_type_name_emitter_ (c.os ()), - type_name_emitter_ (c.os ()), - ace_check_return_emitter_ (c.os ()) - { - read_belongs_.node_traverser (read_type_name_emitter_); - ace_check_return_belongs_.node_traverser (ace_check_return_emitter_); - - edge_traverser (get_raises_); - get_raises_.node_traverser (type_name_emitter_); - } - - // ReadWriteAttribute - // - - // Overridden by facet attribute emitter. - virtual void - gen_swapping_get (SemanticGraph::ReadWriteAttribute& a) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");"; - - Traversal::ReadWriteAttribute::belongs (a, ace_check_return_belongs_); - - os << endl; - } - - // Overridden by facet attribute emitter. - virtual void - gen_write_operation (SemanticGraph::ReadWriteAttribute& a, - bool swapping) - { - WriteAttributeEmitter write_attribute_emitter (ctx, - scope_, - swapping); - write_attribute_emitter.traverse (a); - } - - virtual void - pre (SemanticGraph::ReadWriteAttribute& a) - { - Traversal::ReadWriteAttribute::belongs (a, read_belongs_); - - os << endl; - } - - virtual void - name (SemanticGraph::ReadWriteAttribute& a) - { - os << scope_.name () << "_Servant::" << a.name () << " (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl; - } - - virtual void - get_raises_none (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_SNGL] << endl; - } - - virtual void - get_raises_pre (SemanticGraph::ReadWriteAttribute&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - get_raises_post (SemanticGraph::ReadWriteAttribute&) - { - os << "))" << endl; - } - - virtual void - set_raises (SemanticGraph::ReadWriteAttribute&) - { - } - - virtual void - post (SemanticGraph::ReadWriteAttribute& a) - { - os << "{"; - - string swap_option = ctx.cl ().get_value ("custom-container", ""); - bool swapping = (swap_option == "upgradeable"); - - if (swapping) - { - this->gen_swapping_get (a); - } - - os << "return this->executor_->" << a.name () << " (" << endl - << STRS[ENV_SNGL_ARG] << ");" << endl - << "}"; - - this->gen_write_operation (a, swapping); - } - - virtual void - comma (SemanticGraph::ReadWriteAttribute&) - { - os << "," << endl; - } - - // ReadAttribute - // - - // Overridden by facet attribute emitter to do nothing. - virtual void - gen_swapping_get (SemanticGraph::ReadAttribute& a) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");"; - - Traversal::ReadAttribute::belongs (a, ace_check_return_belongs_); - - os << endl; - } - - virtual void - pre (SemanticGraph::ReadAttribute& a) - { - Traversal::ReadAttribute::belongs (a, read_belongs_); - - os << endl; - } - - virtual void - name (SemanticGraph::ReadAttribute& a) - { - os << scope_.name () << "_Servant::" << a.name () << " (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl; - } - - virtual void - get_raises_none (SemanticGraph::ReadAttribute&) - { - os << STRS[EXCP_SNGL] << endl; - } - - virtual void - get_raises_pre (SemanticGraph::ReadAttribute&) - { - os << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl; - } - - virtual void - get_raises_post (SemanticGraph::ReadAttribute&) - { - os << "))" << endl; - } - - virtual void - set_raises (SemanticGraph::ReadAttribute&) - { - } - - virtual void - post (SemanticGraph::ReadAttribute& a) - { - os << "{"; - - string swap_option = ctx.cl ().get_value ("custom-container", ""); - bool swapping = (swap_option == "upgradeable"); - - if (swapping) - { - this->gen_swapping_get (a); - } - - os << "return this->executor_->" << a.name () << " (" << endl - << STRS[ENV_SNGL_ARG] << ");" << endl - << "}"; - } - - virtual void - comma (SemanticGraph::ReadAttribute&) - { - os << "," << endl; - } - - protected: - T& scope_; - - private: - ReturnTypeNameEmitter read_type_name_emitter_; - TypeNameEmitter type_name_emitter_; - AceCheckReturnEmitter ace_check_return_emitter_; - Traversal::Belongs read_belongs_; - Traversal::Belongs ace_check_return_belongs_; - Traversal::GetRaises get_raises_; - }; - - // Generates operations associated with readonly attributes. - // @@@ (JP) Need to support exceptions. - template - struct ReadOnlyAttributeEmitter : Traversal::ReadAttribute, - EmitterBase - { - ReadOnlyAttributeEmitter (Context& c, - T& scope) - : EmitterBase (c), - scope_ (scope), - read_type_name_emitter_ (c.os ()), - ace_check_return_emitter_ (c.os ()) - { - read_belongs_.node_traverser (read_type_name_emitter_); - ace_check_return_belongs_.node_traverser (ace_check_return_emitter_); - } - - // Overridden by facet attribute emitter to do nothing. - - virtual void - gen_swapping_get (SemanticGraph::ReadAttribute& a) + raises_pre (Type&) { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");"; + os << STRS[EXCP_START] << " " + << STRS[EXCP_SYS] << "," << endl; + } - Traversal::ReadAttribute::belongs (a, ace_check_return_belongs_); + virtual void - os << endl; + raises_none (Type&) + { + os << STRS[EXCP_SNGL]; } virtual void - name (SemanticGraph::ReadAttribute& a) + raises_post (Type&) { - os << scope_.name () << "_Servant::" << a.name (); + os << "))"; } virtual void - traverse (SemanticGraph::ReadAttribute& a) + post (Type& o) { - // Does nothing here, overridden for facet attributes. - this->pre (a); + os << "{"; - Traversal::ReadAttribute::belongs (a, read_belongs_); + this->gen_swap_related (o); - os << endl; + OperationExecEmitter operation_emitter (ctx); - // Overridden for facet attributes. - this->name (a); + Traversal::Receives receives; + Traversal::Belongs returns; + operation_emitter.edge_traverser (receives); + operation_emitter.edge_traverser (returns); - os << " (" << endl - << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{"; + ParameterExecEmitter param (os); + receives.node_traverser (param); - string swap_option = ctx.cl ().get_value ("custom-container", ""); - bool swapping = (swap_option == "upgradeable"); + OpExecReturnEmitter return_emitter (os); + returns.node_traverser (return_emitter); - if (swapping) - { - this->gen_swapping_get (a); - } + operation_emitter.traverse (o); - os << "return this->executor_->" << a.name () << " (" << endl - << STRS[ENV_SNGL_ARG] << ");" << endl - << "}"; + + os << "}"; + } + + virtual void + comma (Type&) + { + os << "," << endl; } protected: T& scope_; - - private: - ReturnTypeNameEmitter read_type_name_emitter_; AceCheckReturnEmitter ace_check_return_emitter_; - Traversal::Belongs read_belongs_; - Traversal::Belongs ace_check_return_belongs_; + Traversal::Returns ace_check_returns_; }; struct FacetEmitter : Traversal::UnconstrainedInterface, @@ -860,12 +312,15 @@ namespace }; struct FacetWriteAttributeEmitter - : WriteAttributeEmitter + : WriteAttributeSourceEmitter { // Since swapping does not affect facets, we can just pass 'false' // to the base class constructor, and not override gen_swapping_set(). FacetWriteAttributeEmitter (Context& c, SemanticGraph::Interface& i) - : WriteAttributeEmitter (c, i, false) + : WriteAttributeSourceEmitter (c, + i, + false, + false) {} virtual void @@ -873,7 +328,7 @@ namespace { os << "template " << endl; - WriteAttributeEmitter::pre (a); + WriteAttributeSourceEmitter::pre (a); } virtual void @@ -890,11 +345,11 @@ namespace }; struct FacetAttributeEmitter - : AttributeEmitter + : AttributeSourceEmitter { FacetAttributeEmitter (Context& c, SemanticGraph::Interface& i) - : AttributeEmitter (c, i) + : AttributeSourceEmitter (c, i) {} // ReadWriteAttribute @@ -919,7 +374,7 @@ namespace { os << "template " << endl; - AttributeEmitter::pre (a); + AttributeSourceEmitter::pre (a); } virtual void @@ -944,7 +399,7 @@ namespace { os << "template " << endl; - AttributeEmitter::pre (a); + AttributeSourceEmitter::pre (a); } virtual void @@ -967,9 +422,9 @@ namespace << i.scoped_name ().scope_name () << "::CCM_" << i.name () << "_ptr executor," << endl << "::Components::CCMContext_ptr c)" << endl - << ": executor_ (" << i.scoped_name ().scope_name () << "::CCM_" + << " : executor_ ( " << i.scoped_name ().scope_name () << "::CCM_" << i.name () << "::_duplicate (executor))," << endl - << "ctx_ (::Components::CCMContext::_duplicate (c))" << endl + << " ctx_ ( ::Components::CCMContext::_duplicate (c))" << endl << "{" << "}"; @@ -1001,15 +456,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -1018,9 +473,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -1030,32 +485,32 @@ namespace } os << "template " << endl - << "CORBA::Object_ptr" << endl + << "::CORBA::Object_ptr" << endl << i.name () << "_Servant_T::_get_component (" << endl << STRS[ENV_SNGL_SRC] << ")" << endl - << "ACE_THROW_SPEC ((CORBA::SystemException))" << endl + << STRS[EXCP_SNGL] << endl << "{" << STRS[COMP_SC] << "_var sc =" << endl - << STRS[COMP_SC] << "::_narrow (" << endl - << "this->ctx_.in ()" << endl - << STRS[ENV_ARG] << ");" - << STRS[ACE_CR] << " (CORBA::Object::_nil ());" << endl - << "if (! CORBA::is_nil (sc.in ()))" << endl + << " " << STRS[COMP_SC] << "::_narrow (" << endl + << " this->ctx_.in ()" << endl + << " " << STRS[ENV_ARG] << ");" + << STRS[ACE_CR] << " ( ::CORBA::Object::_nil ());" << endl + << "if (! ::CORBA::is_nil (sc.in ()))" << endl << "{" << "return sc->get_CCM_object (" << endl - << STRS[ENV_SNGL_ARG] << ");" << endl + << STRS[ENV_SNGL_ARG] << ");" << "}" << "::Components::EntityContext_var ec =" << endl << "::Components::EntityContext::_narrow (" << endl << "this->ctx_.in ()" << endl << STRS[ENV_ARG] << ");" - << STRS[ACE_CR] << " (CORBA::Object::_nil ());" << endl - << "if (! CORBA::is_nil (ec.in ()))" << endl + << STRS[ACE_CR] << " ( ::CORBA::Object::_nil ());" << endl + << "if (! ::CORBA::is_nil (ec.in ()))" << endl << "{" << "return ec->get_CCM_object (" << endl - << STRS[ENV_SNGL_ARG] << ");" << endl + << STRS[ENV_SNGL_ARG] << ");" << "}" - << STRS[ACE_TR] << " (CORBA::INTERNAL (), 0);" << endl + << STRS[ACE_TR] << " ( ::CORBA::INTERNAL (), 0);" << endl << "}" << endl; i.context ().set ("facet_src_gen", true); @@ -1078,8 +533,8 @@ namespace { ContextPortsEmitter (Context& c, SemanticGraph::Component& scope) : EmitterBase (c), - type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), + type_name_emitter_ (c), + simple_type_name_emitter_ (c), scope_ (scope) { belongs_.node_traverser (type_name_emitter_); @@ -1114,21 +569,22 @@ namespace os << "_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_AC] << "," << endl << STRS[EXCP_IC] << "))" << endl << "{" - << "if (!CORBA::is_nil (this->ciao_uses_" + << "if (! ::CORBA::is_nil (this->ciao_uses_" << u.name () << "_.in ()))" << endl << "{" - << "ACE_THROW (" << STRS[EXCP_AC] << " ());" << endl + << "ACE_THROW ( " << STRS[EXCP_AC] << " ());" << "}" - << "if (CORBA::is_nil (c))" << endl + << "if ( ::CORBA::is_nil (c))" << endl << "{" - << "ACE_THROW (" << STRS[EXCP_IC] << " ());" << endl + << "ACE_THROW ( " << STRS[EXCP_IC] << " ());" << "}" - << "this->ciao_uses_" << u.name () << "_ =" << endl; + << "this->ciao_uses_" << u.name () << "_ =" << endl + << " "; Traversal::SingleUserData::belongs (u, belongs_); @@ -1141,14 +597,14 @@ namespace << scope_.name () << "_Context::disconnect_" << u.name () << " (" << endl << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_NC] << "))" << endl << "{" - << "if (CORBA::is_nil (this->ciao_uses_" + << "if ( ::CORBA::is_nil (this->ciao_uses_" << u.name () << "_.in ()))" << endl << "{" - << STRS[ACE_TR] << " (" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_NC] << " ()," << endl; Traversal::SingleUserData::belongs (u, belongs_); @@ -1170,27 +626,29 @@ namespace << STRS[EXCP_SNGL] << endl << "{" << u.scoped_name () << "Connections *tmp_retv = 0;" - << "ACE_NEW_THROW_EX (" << endl + << "ACE_NEW_THROW_EX (" << "tmp_retv," << endl << u.scoped_name () << "Connections (" << endl << "this->ciao_uses_" << u.name () << "_.current_size ())," << endl - << "CORBA::NO_MEMORY ());" << endl << endl + << "::CORBA::NO_MEMORY ());" << endl << u.scoped_name () << "Connections_var retv" << " = tmp_retv;" << endl << "retv->length (this->ciao_uses_" << u.name () << "_.current_size ());" << endl; - os << "CORBA::ULong i = 0;" << endl; + os << "::CORBA::ULong i = 0;" << endl; - os << "for (ACE_Active_Map_Manager< " << endl; + os << "for (ACE_Active_Map_Manager< " << endl + << " "; Traversal::MultiUserData::belongs (u, belongs_); os << "_var>::iterator iter =" << endl - << " this->ciao_uses_" << u.name () << "_.begin ();" - << " iter != this->ciao_uses_" << u.name () << "_.end ();" - << " ++iter)" << endl + << " this->ciao_uses_" << u.name () << "_.begin ();" << endl + << "iter != this->ciao_uses_" << u.name () << "_.end ();" + << endl + << "++iter)" << endl << "{" << "ACE_Active_Map_Manager< " << endl; @@ -1206,10 +664,10 @@ namespace << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (0);" << endl; - os << "ACE_NEW_THROW_EX (" << endl - << "retv[i].ck," << endl - << "CIAO::Map_Key_Cookie (entry.ext_id_)," << endl - << "CORBA::NO_MEMORY ());" << endl + os << "ACE_NEW_THROW_EX (" + << "retv[i].ck.inout ()," << endl + << "::CIAO::Map_Key_Cookie (entry.ext_id_)," << endl + << "::CORBA::NO_MEMORY ());" << endl << "++i;" << endl << "}"; @@ -1224,14 +682,15 @@ namespace os << "_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "," << endl << STRS[EXCP_IC] << "))" << endl << "{" - << "if (CORBA::is_nil (c))" << endl + << "if ( ::CORBA::is_nil (c))" << endl << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IC] << " (), 0);" << endl + << STRS[ACE_TR] << " ( " + << STRS[EXCP_IC] << " (), 0);" << endl << "}"; Traversal::MultiUserData::belongs (u, belongs_); @@ -1246,16 +705,17 @@ namespace os << "if (this->ciao_uses_" << u.name () << "_.bind (conn.in (), key) == -1)" << endl << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IC] << " (), 0);" << endl + << STRS[ACE_TR] << " ( " + << STRS[EXCP_IC] << " (), 0);" << endl << "}"; os << "conn._retn ();" << endl; os << STRS[COMP_CK] << " * ck = 0;" - << "ACE_NEW_THROW_EX (" << endl + << "ACE_NEW_THROW_EX (" << "ck," << endl - << "CIAO::Map_Key_Cookie (key)," << endl - << "CORBA::NO_MEMORY ());" << endl; + << "::CIAO::Map_Key_Cookie (key)," << endl + << "::CORBA::NO_MEMORY ());" << endl; os << "return ck;" << endl @@ -1268,7 +728,7 @@ namespace << u.name () << " (" << endl << STRS[COMP_CK] << " * ck" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IC] << "))" << endl << "{"; @@ -1278,10 +738,10 @@ namespace os << "_var retv;" << "ACE_Active_Map_Manager_Key key;" << endl; - os << "if (ck == 0 || ! CIAO::Map_Key_Cookie::extract (ck, key))" + os << "if (! CIAO::Map_Key_Cookie::extract (ck, key))" << endl << "{" - << STRS[ACE_TR] << " (" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " ()," << endl; Traversal::MultiUserData::belongs (u, belongs_); @@ -1292,7 +752,7 @@ namespace os << "if (this->ciao_uses_" << u.name () << "_.unbind (key, retv) != 0)" << endl << "{" - << STRS[ACE_TR] << " (" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " ()," << endl; Traversal::MultiUserData::belongs (u, belongs_); @@ -1317,15 +777,16 @@ namespace << STRS[ENV_SRC] << ")" << endl << STRS[EXCP_SNGL] << endl << "{" - << "for (ACE_Active_Map_Manager< " << endl; //@@ gcc bug + << "for (ACE_Active_Map_Manager< " << endl + << " "; Traversal::PublisherData::belongs (p, belongs_); os << "Consumer_var>::iterator iter =" << endl - << "this->ciao_publishes_" << p.name () - << "_map_.begin ();" + << " this->ciao_publishes_" << p.name () + << "_map_.begin ();" << endl << "iter != this->ciao_publishes_" << p.name () - << "_map_.end ();" + << "_map_.end ();" << endl << "++iter)" << endl << "{" << "(*iter).int_id_->push_"; @@ -1339,11 +800,11 @@ namespace << "}"; os << "for (ACE_Active_Map_Manager< " << endl - << STRS[COMP_ECB] << "_var>::iterator giter =" << endl - << "this->ciao_publishes_" << p.name () - << "_generic_map_.begin ();" + << " " << STRS[COMP_ECB] << "_var>::iterator giter =" << endl + << " this->ciao_publishes_" << p.name () + << "_generic_map_.begin ();" << endl << "giter != this->ciao_publishes_" << p.name () - << "_generic_map_.end ();" + << "_generic_map_.end ();" << endl << "++giter)" << endl << "{" << "(*giter).int_id_->push_event" << " (" << endl @@ -1361,18 +822,19 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "))" << endl << "{" - << "if (CORBA::is_nil (c))" << endl + << "if ( ::CORBA::is_nil (c))" << endl << "{" - << STRS[ACE_TR] << " (CORBA::BAD_PARAM (), 0);" << endl + << STRS[ACE_TR] << " ( ::CORBA::BAD_PARAM (), 0);" << endl << "}"; Traversal::PublisherData::belongs (p, belongs_); - os<< "Consumer_var sub =" << endl; + os << "Consumer_var sub =" << endl + << " "; Traversal::PublisherData::belongs (p, belongs_); @@ -1382,10 +844,10 @@ namespace << "_map_.bind (sub.in (), key);" << "sub._retn ();" << endl << STRS[COMP_CK] << " * retv = 0;" - << "ACE_NEW_THROW_EX (" << endl + << "ACE_NEW_THROW_EX (" << "retv," << endl << "::CIAO::Map_Key_Cookie (key)," << endl - << "CORBA::NO_MEMORY ());" << endl + << "::CORBA::NO_MEMORY ());" << endl << "return retv;" << endl << "}"; @@ -1394,26 +856,26 @@ namespace << p.name () << "_generic (" << endl << STRS[COMP_ECB] << "_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "))" << endl << "{" - << "if (CORBA::is_nil (c))" << endl + << "if ( ::CORBA::is_nil (c))" << endl << "{" - << STRS[ACE_TR] << " (CORBA::BAD_PARAM (), 0);" << endl + << STRS[ACE_TR] << " ( ::CORBA::BAD_PARAM (), 0);" << endl << "}"; os << STRS[COMP_ECB] << "_var sub =" << endl - << STRS[COMP_ECB] << "::_duplicate (c);" << endl + << " " << STRS[COMP_ECB] << "::_duplicate (c);" << endl << "ACE_Active_Map_Manager_Key key;" << "this->ciao_publishes_" << p.name () << "_generic_map_.bind (sub.in (), key);" << "sub._retn ();" << endl << STRS[COMP_CK] << " * retv = 0;" - << "ACE_NEW_THROW_EX (" << endl + << "ACE_NEW_THROW_EX (" << "retv," << endl << "::CIAO::Map_Key_Cookie (key)," << endl - << "CORBA::NO_MEMORY ());" << endl + << "::CORBA::NO_MEMORY ());" << endl << "return retv;" << endl << "}"; @@ -1424,7 +886,7 @@ namespace << p.name () << " (" << endl << STRS[COMP_CK] << " *ck" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IC] << "))" << endl << "{" @@ -1432,7 +894,7 @@ namespace << "if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == false)" << endl << "{" - << STRS[ACE_TR] << " (" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " ()," << endl; Traversal::PublisherData::belongs (p, belongs_); @@ -1454,7 +916,7 @@ namespace os << "if (this->ciao_publishes_" << p.name () << "_generic_map_.unbind (key, ecb) != 0)" << endl << "{" - << STRS[ACE_TR] << " (" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " ()," << endl; Traversal::PublisherData::belongs (p, belongs_); @@ -1500,19 +962,19 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_AC] << "))" << endl << "{" - << "if (CORBA::is_nil (c))" << endl + << "if ( ::CORBA::is_nil (c))" << endl << "{" - << "ACE_THROW (CORBA::BAD_PARAM ());" << endl - << "}" << endl - << "if (! CORBA::is_nil (this->ciao_emits_" << e.name () + << "ACE_THROW ( ::CORBA::BAD_PARAM ());" << endl + << "}" + << "if (! ::CORBA::is_nil (this->ciao_emits_" << e.name () << "_consumer_.in ()))" << endl << "{" - << "ACE_THROW (" << STRS[EXCP_AC] << " ());" << endl - << "}" << endl + << "ACE_THROW ( " << STRS[EXCP_AC] << " ());" << endl + << "}" << "this->ciao_emits_" << e.name () << "_consumer_ = " << endl; @@ -1527,27 +989,27 @@ namespace << scope_.name () << "_Context::disconnect_" << e.name () << " (" << endl << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_NC] << "))" << endl << "{" - << "if (CORBA::is_nil (this->ciao_emits_" << e.name () + << "if ( ::CORBA::is_nil (this->ciao_emits_" << e.name () << "_consumer_.in ()))" << endl << "{" - << STRS[ACE_TR] << " (" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_NC] << " ()," << endl; Traversal::EmitterData::belongs (e, belongs_); os << "Consumer::_nil ());" << endl - << "}" << endl + << "}" << "return this->ciao_emits_" << e.name () << "_consumer_._retn ();" << endl << "}"; } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; Traversal::Belongs belongs_; Traversal::Belongs simple_belongs_; @@ -1560,7 +1022,7 @@ namespace { SwappableGetConsumersEmitter (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -1573,10 +1035,10 @@ namespace << "{" << "_ciao_size = this->ciao_publishes_" << p.name () << "_map_.current_size ();" << endl - << "ACE_NEW_THROW_EX (" << endl + << "ACE_NEW_THROW_EX (" << "tmp," << endl << STRS[COMP_CD] << " (_ciao_size)," << endl - << "CORBA::NO_MEMORY ());" << endl + << "::CORBA::NO_MEMORY ());" << endl << "retval = tmp;" << "retval->length (_ciao_size);" << endl << "ACE_Active_Map_Manager<" << endl; @@ -1586,12 +1048,13 @@ namespace os << "Consumer_var>::iterator end =" << endl << " this->ciao_publishes_" << p.name () << "_map_.end ();" << endl - << "for (ACE_Active_Map_Manager<" << endl; + << "for (ACE_Active_Map_Manager<" << endl + << " "; Traversal::PublisherData::belongs (p, belongs_); os << "Consumer_var>::iterator iter =" << endl - << " this->ciao_publishes_" << p.name () + << " this->ciao_publishes_" << p.name () << "_map_.begin ();" << "iter != end;" << "++iter)" << endl @@ -1612,15 +1075,15 @@ namespace << "e.int_id_.in ()" << endl << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (0);" << endl - << "if (CORBA::is_nil (c.in ()))" + << "if ( ::CORBA::is_nil (c.in ()))" << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IC] << " (), 0);" + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " (), 0);" << "}" << "::Components::ConsumerDescription *cd = 0;" - << "ACE_NEW_THROW_EX (" << endl + << "ACE_NEW_THROW_EX (" << "cd," << endl << "OBV_Components::ConsumerDescription ()," << endl - << "CORBA::NO_MEMORY ());" << endl + << "::CORBA::NO_MEMORY ());" << endl << "::Components::ConsumerDescription_var safe = cd;" << "safe->name (\"\");" << "safe->type_id (\"\");" @@ -1638,7 +1101,7 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; }; @@ -1726,6 +1189,35 @@ namespace // Extra *_Context methods for swapping container. if (swapping) + { + os << "// Operations defined in " << t.scoped_name ().scope_name () + << "::CCM_" << t.name () << "_Context" << endl + << "// that enable component swapping in the container" + << endl << endl; + + os << STRS[COMP_CD] << " *" << endl + << t.name () << "_Context::get_registered_consumers (" << endl + << "const char *publisher_name" << endl + << STRS[ENV_SRC] << ")" << endl + << STRS[EXCP_START] << " " + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_IN] << "," << endl + << STRS[EXCP_IC] << "))" << endl + << "{" + << "if (publisher_name == 0)" << endl + << "{" + << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " (), 0);" + << "}" + << STRS[COMP_CD] << " *tmp = 0;" + << STRS[COMP_CD] << "_var retval;" + << "CORBA::ULong _ciao_index = 0;" + << "CORBA::ULong _ciao_size = 0;" + << STRS[ACE_UA] << " (tmp);" + << STRS[ACE_UA] << " (retval);" + << STRS[ACE_UA] << " (_ciao_index);" + << STRS[ACE_UA] << " (_ciao_size);" << endl; + + // Generate IF block for each event sources. { os << "// Operations defined in " << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_Context" << endl @@ -1775,6 +1267,10 @@ namespace << "}"; } + os << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " (), 0);" + << "}"; + } + os << "// CIAO-specific." << endl << endl; os << t.name () << "_Context *" << endl @@ -1796,12 +1292,13 @@ namespace // Nested classes used by ServantEmitter. private: - struct NavigationEmitsEmitter : Traversal::EmitterData, - EmitterBase + + struct EmitsConnectEmitter : Traversal::EmitterData, + EmitterBase { - NavigationEmitsEmitter (Context& c) + EmitsConnectEmitter (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -1815,17 +1312,18 @@ namespace Traversal::EmitterData::belongs (t, belongs_); - os << "Consumer_var _ciao_consumer =" << endl; + os << "Consumer_var _ciao_consumer =" << endl + << " "; Traversal::EmitterData::belongs (t, belongs_); os << "Consumer::_narrow (" << endl - << "consumer" << endl - << STRS[ENV_ARG] << ");" + << " consumer" << endl + << " " << STRS[ENV_ARG] << ");" << "ACE_CHECK;" << endl - << "if (::CORBA::is_nil (_ciao_consumer.in ()))" << endl + << "if ( ::CORBA::is_nil (_ciao_consumer.in ()))" << endl << "{" - << "ACE_THROW (" << STRS[EXCP_IC] << " ());" + << "ACE_THROW ( " << STRS[EXCP_IC] << " ());" << endl << "}" << "this->connect_" << t.name () @@ -1837,10 +1335,30 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; }; + struct EmitsDisconnectEmitter : Traversal::EmitterData, + EmitterBase + { + EmitsDisconnectEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + traverse (Type& t) + { + os << "if (ACE_OS::strcmp (source_name, \"" + << t.name () << "\") == 0)" << endl + << "{" + << "return this->disconnect_" << t.name () + << " (" << STRS[ENV_SNGL_ARG] << ");" << endl + << "}"; + } + }; + struct NavigationGetFacetExecEmitter : Traversal::ProviderData, EmitterBase { @@ -1866,7 +1384,7 @@ namespace PublishesEmitter (Context& c, SemanticGraph::Component& scope) : EmitterBase (c), - type_name_emitter_ (c.os ()), + type_name_emitter_ (c), scope_ (scope) { belongs_.node_traverser (type_name_emitter_); @@ -1883,7 +1401,7 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "))" << endl << "{"; @@ -1908,7 +1426,7 @@ namespace << "_Servant::subscribe_" << p.name () << "_generic (" << endl << STRS[COMP_ECB] << "_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "))" << endl << "{"; @@ -1932,15 +1450,15 @@ namespace << "_Servant::unsubscribe_" << p.name () << " (" << endl << STRS[COMP_CK] << " *ck" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IC] << "))" << endl << "{"; if (swapping) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" - << STRS[ACE_CR] << " ("; + { + os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CR] << " ( "; Traversal::PublisherData::belongs (p, belongs_); @@ -1955,7 +1473,7 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; SemanticGraph::Component& scope_; }; @@ -1966,7 +1484,7 @@ namespace { UsesConnectEmitter (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -1988,9 +1506,9 @@ namespace << "connection" << endl << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (0);" << endl - << "if (::CORBA::is_nil (_ciao_conn.in ()))" << endl + << "if ( ::CORBA::is_nil (_ciao_conn.in ()))" << endl << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IC] << " (), 0);" + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " (), 0);" << endl << "}" << "// Simplex connect." << endl @@ -2019,9 +1537,9 @@ namespace << "connection" << endl << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (0);" << endl - << "if (::CORBA::is_nil (_ciao_conn.in ()))" << endl + << "if ( ::CORBA::is_nil (_ciao_conn.in ()))" << endl << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IC] << " (), 0);" + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " (), 0);" << endl << "}" << "// Multiplex connect." << endl @@ -2032,7 +1550,7 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; }; @@ -2064,6 +1582,12 @@ namespace << u.name () << "\") == 0)" << endl << "{" << "// Multiplex disconnect." << endl + << "if (ck == 0)" << endl + << "{" + << STRS[ACE_TR] << " ( " + << STRS[EXCP_CR] << " ()," << endl + << "::CORBA::Object::_nil ());" << endl + << "}" << "return this->disconnect_" << u.name () << " (" << endl << "ck" << endl << STRS[ENV_ARG] << ");" << endl @@ -2077,7 +1601,7 @@ namespace { UsesEmitter (Context& c, SemanticGraph::Component& scope) : EmitterBase (c), - type_name_emitter_ (c.os ()), + type_name_emitter_ (c), scope_ (scope) { belongs_.node_traverser (type_name_emitter_); @@ -2094,7 +1618,7 @@ namespace os << "_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_AC] << "," << endl << STRS[EXCP_IC] << "))" << endl @@ -2113,7 +1637,7 @@ namespace << scope_.name () << "_Servant::disconnect_" << u.name () << " (" << endl << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_NC] << "))" << endl << "{" @@ -2148,7 +1672,7 @@ namespace os << "_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_ECL] << "," << endl << STRS[EXCP_IC] << "))" << endl @@ -2170,7 +1694,7 @@ namespace << u.name () << " (" << endl << STRS[COMP_CK] << " * ck" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IC] << "))" << endl << "{" @@ -2194,7 +1718,7 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; SemanticGraph::Component& scope_; }; @@ -2204,7 +1728,7 @@ namespace { PublishesSubscribeEmitter (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()) + type_name_emitter_ (c) { belongs_.node_traverser (type_name_emitter_); } @@ -2218,7 +1742,8 @@ namespace Traversal::PublisherData::belongs (p, belongs_); - os << "Consumer_var sub =" << endl; + os << "Consumer_var sub =" << endl + << " "; Traversal::PublisherData::belongs (p, belongs_); @@ -2227,15 +1752,16 @@ namespace << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (0);" << endl; - os << "if (CORBA::is_nil (sub.in ()))" << endl + os << "if ( ::CORBA::is_nil (sub.in ()))" << endl << "{" - << "CORBA::Boolean substitutable =" << endl - << "subscribe->ciao_is_substitutable (" << endl; + << "::CORBA::Boolean substitutable =" << endl + << " subscribe->ciao_is_substitutable (" << endl + << " "; Traversal::PublisherData::belongs (p, belongs_); os << "::_tao_obv_static_repository_id ()" << endl - << STRS[ENV_ARG] << ");" + << " " << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (0);" << endl; os << "if (substitutable)" << endl @@ -2246,7 +1772,7 @@ namespace << "}" << "else" << endl << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IC] << " (), 0);" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_IC] << " (), 0);" << endl << "}" << "}" << "else" << endl @@ -2259,7 +1785,7 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; }; @@ -2289,7 +1815,7 @@ namespace { EmitsEmitter (Context& c, SemanticGraph::Component& scope) : EmitterBase (c), - type_name_emitter_ (c.os ()), + type_name_emitter_ (c), scope_ (scope) { belongs_.node_traverser (type_name_emitter_); @@ -2306,7 +1832,7 @@ namespace os << "Consumer_ptr c" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_AC] << "))" << endl << "{" @@ -2322,7 +1848,7 @@ namespace << scope_.name () << "_Servant::disconnect_" << e.name () << " (" << endl << STRS[ENV_SNGL_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_NC] << "))" << endl << "{" @@ -2333,25 +1859,24 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Belongs belongs_; SemanticGraph::Component& scope_; }; - struct ServantTypeNameEmitter : Traversal::Type + struct ServantTypeNameEmitter : Traversal::Type, + EmitterBase { - ServantTypeNameEmitter (std::ostream& os_) - : os (os_) - {} + ServantTypeNameEmitter (Context& c) + : EmitterBase (c) + { + } virtual void traverse (SemanticGraph::Type& t) { os << t.name () << "_Servant"; } - - private: - std::ostream& os; }; struct FacetProvidesEmitter : Traversal::ProviderData, @@ -2360,11 +1885,11 @@ namespace FacetProvidesEmitter (Context& c, SemanticGraph::Component& scope) : EmitterBase (c), - type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - servant_type_name_emitter_ (c.os ()), - enclosing_type_name_emitter_ (c.os ()), - repo_id_emitter_ (c.os ()), + type_name_emitter_ (c), + simple_type_name_emitter_ (c), + servant_type_name_emitter_ (c), + enclosing_type_name_emitter_ (c), + repo_id_emitter_ (c), scope_ (scope) { belongs_.node_traverser (type_name_emitter_); @@ -2390,9 +1915,10 @@ namespace bool swapping = (swap_option == "upgradeable"); if (swapping) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" - << STRS[ACE_CR] << " ("; + + { + os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CR] << " ( "; Traversal::ProviderData::belongs (p, belongs_); @@ -2410,9 +1936,9 @@ namespace << "}"; os << "::CORBA::Object_var obj =" << endl - << "this->provide_" << p.name () << "_i (" + << " this->provide_" << p.name () << "_i (" << STRS[ENV_SNGL_ARG] << ");" - << STRS[ACE_CR] << " ("; + << STRS[ACE_CR] << " ( "; Traversal::ProviderData::belongs (p, belongs_); @@ -2423,14 +1949,15 @@ namespace Traversal::ProviderData::belongs (p, belongs_); - os << "_var fo =" << endl; + os << "_var fo =" << endl + << " "; Traversal::ProviderData::belongs (p, belongs_); - os << "::_narrow (" << endl + os << "::_narrow (" << "obj.in ()" << endl << STRS[ENV_ARG] << ");" - << STRS[ACE_CR] << " ("; + << STRS[ACE_CR] << " ( "; Traversal::ProviderData::belongs (p, belongs_); @@ -2453,7 +1980,7 @@ namespace << STRS[EXCP_SNGL] << endl << "{" << "::CORBA::Object_ptr ret =" << endl - << "this->lookup_facet (\"" << p.name () << "\");" << endl; + << " this->lookup_facet (\"" << p.name () << "\");" << endl; os << "if (! ::CORBA::is_nil (ret))" << endl << "{" @@ -2501,18 +2028,18 @@ namespace os << "ACE_CString obj_id (this->ins_name_);" << "obj_id += \"_" << p.name () << "\";" << endl; - os << "ACE_NEW_THROW_EX ( " << endl - << " tmp," << endl - << " MACRO_MADNESS_TYPEDEF (" << endl - << " obj_id.c_str ()," << endl - << " \"" << p.name () << "\"," << endl - << " CIAO::Port_Activator::Facet," << endl - << " 0," << endl - << " this->context_," << endl - << " this)," << endl - << " CORBA::NO_MEMORY ());" << endl; - - os << "CIAO::Servant_Activator *sa = " << endl + os << "ACE_NEW_THROW_EX (" + << "tmp," << endl + << "MACRO_MADNESS_TYPEDEF (" << endl + << "obj_id.c_str ()," << endl + << "\"" << p.name () << "\"," << endl + << "::CIAO::Port_Activator::Facet," << endl + << "0," << endl + << "this->context_," << endl + << "this)," << endl + << "::CORBA::NO_MEMORY ());" << endl; + + os << "::CIAO::Servant_Activator *sa = " << endl << "this->container_->ports_servant_activator ();" << endl << "if (!sa->register_port_activator (tmp))" << endl << "{" @@ -2525,29 +2052,34 @@ namespace os << "::CORBA::Object_var obj =" << endl << " this->container_->generate_reference (" << endl - << " obj_id.c_str ()," << endl - << " "; + << " obj_id.c_str ()," << endl + << " "; Traversal::ProviderData::belongs (p, repo_id_belongs_); os << "," << endl - << " CIAO::Container::Facet_Consumer" << endl - << " " << STRS[ENV_ARG] << ");" - << STRS[ACE_CR] << " ("; + << " ::CIAO::Container::Facet_Consumer" << endl + << " " << STRS[ENV_ARG] << ");" + << STRS[ACE_CR] << " ( "; Traversal::ProviderData::belongs (p, belongs_); os << "::_nil ());" << endl - << "this->add_facet (" << endl - << "\"" << p.name () << "\"," << endl - << "obj.in ());" << endl; + << "this->add_facet (\"" << p.name () << "\"," << endl + << "obj.in ()" << endl + << STRS[ENV_ARG] << ");" + << STRS[ACE_CR] << " ( "; + + Traversal::ProviderData::belongs (p, belongs_); + + os << "::_nil ());" << endl; os << "return obj._retn ();" << endl << "}"; } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; ServantTypeNameEmitter servant_type_name_emitter_; EnclosingTypeNameEmitter enclosing_type_name_emitter_; @@ -2565,9 +2097,9 @@ namespace { ConsumesEmitter (Context& c, SemanticGraph::Component& scope) : EmitterBase (c), - type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - repo_id_emitter_ (c.os ()), + type_name_emitter_ (c), + simple_type_name_emitter_ (c), + repo_id_emitter_ (c), scope_ (scope) { belongs_.node_traverser (type_name_emitter_); @@ -2596,10 +2128,10 @@ namespace << c.scoped_name ().scope_name ().scope_name () << "::CCM_" << c.scoped_name ().scope_name ().simple_name () << "_Context_ptr c)" << endl - << ": executor_ (" << c.scoped_name ().scope_name ().scope_name () + << " : executor_ ( " << c.scoped_name ().scope_name ().scope_name () << "::CCM_" << c.scoped_name ().scope_name ().simple_name () << "::_duplicate (executor))," << endl - << "ctx_ (" << c.scoped_name ().scope_name ().scope_name () + << " ctx_ ( " << c.scoped_name ().scope_name ().scope_name () << "::CCM_" << c.scoped_name ().scope_name ().simple_name () << "_Context::_duplicate (c))" << endl << "{" @@ -2619,7 +2151,7 @@ namespace << "{" << "}"; - os << "CORBA::Object_ptr" << endl + os << "::CORBA::Object_ptr" << endl << scope_.name () << "_Servant::"; Traversal::ConsumerData::belongs (c, simple_belongs_); @@ -2667,14 +2199,15 @@ namespace << "_Servant::push_event (" << endl << "::Components::EventBase *ev" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_BET] << "))" << endl << "{"; Traversal::ConsumerData::belongs (c, belongs_); - os << "_var ev_type =" << endl; + os << "_var ev_type =" << endl + << " "; Traversal::ConsumerData::belongs (c, belongs_); @@ -2690,7 +2223,7 @@ namespace << STRS[ENV_ARG] << ");" << endl << "return;" << endl << "}" - << "ACE_THROW (" << STRS[EXCP_BET] << " ());" << endl + << "ACE_THROW ( " << STRS[EXCP_BET] << " ());" << endl << "}"; os << "CORBA::Boolean" << endl @@ -2706,21 +2239,21 @@ namespace << "{" << "if (event_repo_id == 0)" << endl << "{" - << STRS[ACE_TR] << " (CORBA::BAD_PARAM (), false);" << endl + << STRS[ACE_TR] << " ( ::CORBA::BAD_PARAM (), false);" << endl << "}" << scope_.name () << "_Context *ctx =" << endl - << scope_.name () << "_Context::_narrow (" << endl - << "this->ctx_.in ()" << endl - << STRS[ENV_ARG] << ");" + << " " << scope_.name () << "_Context::_narrow (" << endl + << " this->ctx_.in ()" << endl + << " " << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (false);" << endl; os << "CORBA::ORB_ptr orb = ctx->_ciao_the_Container ()->the_ORB ();" << endl; os << "CORBA::ValueFactory f =" << endl - << "orb->lookup_value_factory (" << endl - << "event_repo_id" << endl - << STRS[ENV_ARG] << ");" + << " orb->lookup_value_factory (" << endl + << " event_repo_id" << endl + << " " << STRS[ENV_ARG] << ");" << STRS[ACE_CR] << " (false);" << endl; os << "if (f == 0)" << endl @@ -2728,7 +2261,7 @@ namespace << "return false;" << endl << "}" << "CORBA::ValueBase_var v =" << endl - << "f->create_for_unmarshal (" << STRS[ENV_SNGL_ARG] << ");" + << " f->create_for_unmarshal (" << STRS[ENV_SNGL_ARG] << ");" << STRS[ACE_CR] << " (false);" << endl; os << "f->_remove_ref ();" << endl; @@ -2765,9 +2298,9 @@ namespace << "}"; os << "::Components::EventConsumerBase_var obj =" << endl - << "this->get_consumer_" << c.name () << "_i (" << endl - << STRS[ENV_SNGL_ARG] << ");" - << STRS[ACE_CR] << " ("; + << " this->get_consumer_" << c.name () << "_i (" << endl + << " " << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CR] << " ( "; Traversal::ConsumerData::belongs (c, belongs_); @@ -2775,14 +2308,15 @@ namespace Traversal::ConsumerData::belongs (c, belongs_); - os << "Consumer_var eco =" << endl; + os << "Consumer_var eco =" << endl + << " "; Traversal::ConsumerData::belongs (c, belongs_); os << "Consumer::_narrow (" << endl - << "obj.in ()" << endl - << STRS[ENV_ARG] << ");" - << STRS[ACE_CR] << " ("; + << " obj.in ()" << endl + << " " << STRS[ENV_ARG] << ");" + << STRS[ACE_CR] << " ( "; Traversal::ConsumerData::belongs (c, belongs_); @@ -2805,14 +2339,14 @@ namespace << STRS[EXCP_SNGL] << endl << "{" << "::Components::EventConsumerBase_ptr ret =" << endl - << "this->lookup_consumer (\"" << c.name () << "\");" << endl; + << " this->lookup_consumer (\"" << c.name () << "\");" << endl; os << "if (! ::CORBA::is_nil (ret))" << endl << "{" << "return ret;" << "}"; - os << "CIAO::Port_Activator_T<" << endl; + os << "::CIAO::Port_Activator_T<" << endl; os << scope_.name () << "_Servant::"; @@ -2851,19 +2385,19 @@ namespace os << "ACE_CString obj_id (this->ins_name_);" << "obj_id += \"_" << c.name () << "\";" << endl; - os << "ACE_NEW_THROW_EX ( " << endl - << " tmp," << endl - << " MACRO_MADNESS_TYPEDEF (" << endl - << " obj_id.c_str ()," << endl - << " \"" << c.name () << "\"," << endl - << " CIAO::Port_Activator::Sink," << endl - << " this->executor_.in ()," << endl - << " this->context_," << endl - << " this)," << endl - << " CORBA::NO_MEMORY ());" << endl; - - os << "CIAO::Servant_Activator *sa = " << endl - << "this->container_->ports_servant_activator ();" <executor_.in ()," << endl + << "this->context_," << endl + << "this)," << endl + << "::CORBA::NO_MEMORY ());" << endl; + + os << "::CIAO::Servant_Activator *sa =" << endl + << " this->container_->ports_servant_activator ();" << endl << "if (!sa->register_port_activator (tmp))" << endl << "{" << "return "; @@ -2875,40 +2409,45 @@ namespace os << "::CORBA::Object_var obj =" << endl << " this->container_->generate_reference (" << endl - << " obj_id.c_str ()," << endl - << " "; + << " obj_id.c_str ()," << endl + << " "; Traversal::ConsumerData::belongs (c, repo_id_belongs_); os << "," << endl - << " CIAO::Container::Facet_Consumer" << endl - << " " << STRS[ENV_ARG] << ");" - << STRS[ACE_CR] << " ("; + << " ::CIAO::Container::Facet_Consumer" << endl + << " " << STRS[ENV_ARG] << ");" + << STRS[ACE_CR] << " ( "; Traversal::ConsumerData::belongs (c, belongs_); os << "Consumer::_nil ());" << endl; os << "::Components::EventConsumerBase_var ecb =" << endl - << "::Components::EventConsumerBase::_narrow (" << endl - << "obj.in ()" << endl - << STRS[ENV_ARG] << ");" - << STRS[ACE_CR] << " ("; + << " ::Components::EventConsumerBase::_narrow (" << endl + << " obj.in ()" << endl + << " " << STRS[ENV_ARG] << ");" + << STRS[ACE_CR] << " ( "; Traversal::ConsumerData::belongs (c, belongs_); os << "Consumer::_nil ());" << endl; - os << "this->add_consumer (" << endl - << "\"" << c.name () << "\"," << endl - << "ecb.in ());" << endl; + os << "this->add_consumer (\"" << c.name () << "\"," << endl + << "ecb.in ()" << endl + << STRS[ENV_ARG] << ");" + << STRS[ACE_CR] << " ( "; + + Traversal::ConsumerData::belongs (c, belongs_); + + os << "Consumer::_nil ());" << endl; os << "return ecb._retn ();" << endl << "}"; } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; ConsumerRepoIdEmitter repo_id_emitter_; Traversal::Belongs belongs_; @@ -2924,8 +2463,9 @@ namespace { RegisterValueFactoryEmitter (Context& c) : EmitterBase (c), - type_name_emitter_ (c.os ()), - cerr_type_name_emitter_ (cerr), + c_ (cerr, c.export_macro (), c.cl ()), + type_name_emitter_ (c), + cerr_type_name_emitter_ (c_), gen_factory_ (true) { belongs_.node_traverser (type_name_emitter_); @@ -3008,8 +2548,9 @@ namespace } private: - TypeNameEmitter type_name_emitter_; - TypeNameEmitter cerr_type_name_emitter_; + Context c_; + FullTypeNameEmitter type_name_emitter_; + FullTypeNameEmitter cerr_type_name_emitter_; Traversal::Belongs belongs_; Traversal::Belongs cerr_belongs_; bool gen_factory_; @@ -3085,63 +2626,281 @@ namespace Traversal::ConsumerData, EmitterBase { - PortTablePopulator (Context& c) - : EmitterBase (c) + PortTablePopulator (Context& c) + : EmitterBase (c) + { + } + + virtual void + traverse (SemanticGraph::Provider& p) + { + os << "obj_var =" << endl + << " this->provide_" << p.name () << "_i (" << endl + << " " << STRS[ENV_SNGL_ARG] << ");" + << "ACE_CHECK;" << endl; + } + + virtual void + traverse (SemanticGraph::User&) + { + } + + virtual void + traverse (SemanticGraph::Publisher&) + { + } + + virtual void + traverse (SemanticGraph::Emitter&) + { + } + + virtual void + traverse (SemanticGraph::Consumer& p) + { + os << "ecb_var =" << endl + << " this->get_consumer_" << p.name () << "_i (" << endl + << " " << STRS[ENV_SNGL_ARG] << ");" + << "ACE_CHECK;" << endl; + } + }; + + struct SetAttributesEmitter : Traversal::ReadWriteAttribute, + EmitterBase + { + SetAttributesEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + pre (SemanticGraph::ReadWriteAttribute& a) + { + Traversal::Belongs delegate_belongs; + + SetAttributeDelegationEmitter delegater (ctx, a); + delegate_belongs.node_traverser (delegater); + + Traversal::ReadWriteAttribute::belongs (a, delegate_belongs); + } + }; + + struct UsesSizeCalculator : Traversal::SingleUserData, + Traversal::MultiUserData, + EmitterBase + { + UsesSizeCalculator (Context& c, unsigned long& size) + : EmitterBase (c), + size_ (size) + { + } + + virtual void + traverse (SemanticGraph::SingleUser&) + { + ++size_; + } + + virtual void + traverse (SemanticGraph::MultiUser&) + { + ++size_; + } + + private: + unsigned long& size_; + }; + + struct UsesGetAllEmitter : Traversal::SingleUserData, + Traversal::MultiUserData, + EmitterBase + { + UsesGetAllEmitter (Context& c) + : EmitterBase (c), + type_name_emitter_ (c), + repo_id_emitter_ (c), + slot_ (0UL) + { + belongs_.node_traverser (type_name_emitter_); + repo_id_belongs_.node_traverser (repo_id_emitter_); + } + + virtual void + traverse (SemanticGraph::SingleUser& u) + { + os << "::CIAO::Servant_Impl_Base::describe_simplex_receptacle<" + << endl + << " "; + + Traversal::SingleUserData::belongs (u, belongs_); + + os << "_var" << endl + << " > (\"" << u.name () << "\"," << endl; + + Traversal::SingleUserData::belongs (u, repo_id_belongs_); + + os << "," << endl + << "this->context_->ciao_uses_" << u.name () << "_," << endl + << "safe_retval," << endl + << slot_ << "UL);" << endl; + + ++slot_; + } + + virtual void + traverse (SemanticGraph::MultiUser& u) + { + os << "::CIAO::Servant_Impl_Base::describe_multiplex_receptacle<" + << endl + << " "; + + Traversal::MultiUserData::belongs (u, belongs_); + + os << "_var" << endl + << " > (\"" << u.name () << "\"," << endl; + + Traversal::MultiUserData::belongs (u, repo_id_belongs_); + + os << "," << endl + << "this->context_->ciao_uses_" << u.name () << "_," << endl + << "safe_retval," << endl + << slot_ << "UL);" << endl; + + ++slot_; + } + + private: + FullTypeNameEmitter type_name_emitter_; + RepoIdEmitter repo_id_emitter_; + Traversal::Belongs belongs_; + Traversal::Belongs repo_id_belongs_; + unsigned long slot_; + }; + + struct PublishesSizeCalculator : Traversal::PublisherData, + EmitterBase + { + PublishesSizeCalculator (Context& c, unsigned long& size) + : EmitterBase (c), + size_ (size) { } virtual void - traverse (SemanticGraph::Provider& p) + traverse (SemanticGraph::Publisher&) { - os << "obj_var =" << endl - << "this->provide_" << p.name () << "_i (" << endl - << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK;" << endl; + ++size_; } - virtual void - traverse (SemanticGraph::User&) + private: + unsigned long& size_; + }; + + struct PublishesGetAllEmitter : Traversal::PublisherData, + EmitterBase + { + PublishesGetAllEmitter (Context& c) + : EmitterBase (c), + type_name_emitter_ (c), + repo_id_emitter_ (c), + slot_ (0UL) { + belongs_.node_traverser (type_name_emitter_); + repo_id_belongs_.node_traverser (repo_id_emitter_); } virtual void - traverse (SemanticGraph::Publisher&) + traverse (SemanticGraph::Publisher& p) { + os << "::CIAO::Servant_Impl_Base::describe_pub_event_source<" + << endl + << " "; + + Traversal::PublisherData::belongs (p, belongs_); + + os << "Consumer_var" << endl + << " > (\"" << p.name () << "\"," << endl; + + Traversal::PublisherData::belongs (p, repo_id_belongs_); + + os << "," << endl + << "this->context_->ciao_publishes_" << p.name () + << "_map_," << endl + << "safe_retval," << endl + << slot_ << "UL);" << endl; + + ++slot_; } - virtual void - traverse (SemanticGraph::Emitter&) + private: + FullTypeNameEmitter type_name_emitter_; + RepoIdEmitter repo_id_emitter_; + Traversal::Belongs belongs_; + Traversal::Belongs repo_id_belongs_; + unsigned long slot_; + }; + + struct EmitsSizeCalculator : Traversal::EmitterData, + EmitterBase + { + EmitsSizeCalculator (Context& c, unsigned long& size) + : EmitterBase (c), + size_ (size) { } virtual void - traverse (SemanticGraph::Consumer& p) + traverse (SemanticGraph::Emitter&) { - os << "ecb_var =" << endl - << "this->get_consumer_" << p.name () << "_i (" << endl - << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK;" << endl; + ++size_; } + + private: + unsigned long& size_; }; - struct SetAttributesEmitter : Traversal::ReadWriteAttribute, - EmitterBase + struct EmitsGetAllEmitter : Traversal::EmitterData, + EmitterBase { - SetAttributesEmitter (Context& c) - : EmitterBase (c) + EmitsGetAllEmitter (Context& c) + : EmitterBase (c), + type_name_emitter_ (c), + repo_id_emitter_ (c), + slot_ (0UL) { + belongs_.node_traverser (type_name_emitter_); + repo_id_belongs_.node_traverser (repo_id_emitter_); } virtual void - pre (SemanticGraph::ReadWriteAttribute& a) + traverse (SemanticGraph::Emitter& e) { - Traversal::Belongs delegate_belongs; + os << "::CIAO::Servant_Impl_Base::describe_emit_event_source<" + << endl + << " "; - SetAttributeDelegationEmitter delegater (ctx.os (), a); - delegate_belongs.node_traverser (delegater); + Traversal::EmitterData::belongs (e, belongs_); - Traversal::ReadWriteAttribute::belongs (a, delegate_belongs); + os << "Consumer_var" << endl + << " > (\"" << e.name () << "\"," << endl; + + Traversal::EmitterData::belongs (e, repo_id_belongs_); + + os << "," << endl + << "this->context_->ciao_emits_" << e.name () + << "_consumer_," << endl + << "safe_retval," << endl + << slot_ << "UL);" << endl; + + ++slot_; } + + private: + FullTypeNameEmitter type_name_emitter_; + RepoIdEmitter repo_id_emitter_; + Traversal::Belongs belongs_; + Traversal::Belongs repo_id_belongs_; + unsigned long slot_; }; public: @@ -3165,7 +2924,7 @@ namespace << " comp_svnt_base (exe, h, hs, c)," << endl << " ins_name_ (ins_name)" << endl << "{" - << "ACE_NEW (" << endl + << "ACE_NEW (" << "this->context_," << endl << t.name () << "_Context (h, c, this));" << endl; @@ -3196,9 +2955,9 @@ namespace os << "ACE_TRY_NEW_ENV" << endl << "{" << "::Components::SessionComponent_var scom =" << endl - << "::Components::SessionComponent::_narrow (" << endl - << "exe" << endl - << STRS[ENV_ARG] << ");" + << " ::Components::SessionComponent::_narrow (" << endl + << " exe" << endl + << " " << STRS[ENV_ARG] << ");" << "ACE_TRY_CHECK;" << endl << "if (! ::CORBA::is_nil (scom.in ()))" << endl << "{" @@ -3240,7 +2999,7 @@ namespace << "ACE_CHECK;" << endl; } - os << "for (CORBA::ULong i = 0; i < descr.length (); ++i)" << endl + os << "for ( ::CORBA::ULong i = 0; i < descr.length (); ++i)" << endl << "{" << "const char *descr_name = descr[i]->name ();" << "::CORBA::Any &descr_value = descr[i]->value ();" << endl; @@ -3325,7 +3084,7 @@ namespace << "const char *name," << endl << "::CORBA::Object_ptr connection" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_IC] << "," << endl @@ -3344,7 +3103,7 @@ namespace << STRS[ACE_UA] << " (connection);" << endl << "if (name == 0)" << endl << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IN] << " (), 0);" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " (), 0);" << endl << "}"; // Generate IF block in connect operation for each receptacle. @@ -3364,15 +3123,15 @@ namespace component_emitter.traverse (t); } - os << STRS[ACE_TR] << " (" << STRS[EXCP_IN] << " (), 0);" << endl + os << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " (), 0);" << endl << "}"; - os << "CORBA::Object_ptr" << endl + os << "::CORBA::Object_ptr" << endl << t.name () << "_Servant::disconnect (" << endl << "const char *name," << endl << STRS[COMP_CK] << " * ck" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_IC] << "," << endl @@ -3382,15 +3141,15 @@ namespace << STRS[ACE_UA] << " (ck);" << endl; if (swapping) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" - << STRS[ACE_CR] << " (CORBA::Object::_nil ());" << endl; - } + { + os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CR] << " ( ::CORBA::Object::_nil ());" << endl; + } os << "if (name == 0)" << endl << "{" - << STRS[ACE_TR] << " (" << endl - << STRS[EXCP_IN] << " ()," << endl + << STRS[ACE_TR] << " ( " + << STRS[EXCP_BP] << "," << endl << "::CORBA::Object::_nil ());" << endl << "}"; @@ -3411,9 +3170,61 @@ namespace component_emitter.traverse (t); } - os << STRS[ACE_TR] << " (" << endl + os << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " ()," << endl - << "::CORBA::Object::_nil ());" << endl + << "::CORBA::Object::_nil ());" + << "}"; + + os << STRS[COMP_RD] << " *" << endl + << t.name () << "_Servant::get_all_receptacles (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_SNGL] << endl + << "{" + << STRS[COMP_RD] << " *retval = 0;" + << "ACE_NEW_RETURN (retval," << endl + << STRS[COMP_RD] << "," << endl + << "0);" + << STRS[COMP_RD] << "_var safe_retval = retval;"; + + unsigned long size = 0; + + // Calculate the number of uses ports. + { + Traversal::Component component_emitter; + + Traversal::Inherits inherits; + inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (inherits); + + UsesSizeCalculator size_calculator (ctx, size); + defines.node_traverser (size_calculator); + + component_emitter.traverse (t); + } + + os << "safe_retval->length (" << size << "UL);" << endl; + + // Generate a sequence element assignment for each uses port. + { + Traversal::Component component_emitter; + + Traversal::Inherits inherits; + inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (inherits); + + UsesGetAllEmitter get_all_emitter (ctx); + defines.node_traverser (get_all_emitter); + + component_emitter.traverse (t); + } + + os << "return safe_retval._retn ();" << "}"; // Generate generic operations for receptacles. @@ -3439,7 +3250,7 @@ namespace << "const char * emitter_name," << endl << STRS[COMP_ECB] << "_ptr consumer" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_AC] << "," << endl @@ -3447,14 +3258,14 @@ namespace << "{"; if (swapping) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK;" << endl; - } + { + os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CK] << ";" << endl; + } os << "if (emitter_name == 0)" << endl << "{" - << "ACE_THROW (::CORBA::BAD_PARAM ());" << endl + << STRS[ACE_TH] << " ( " << STRS[EXCP_BP] << ");" << endl << "}"; // Generate an IF block for each 'emits' declaration. @@ -3468,23 +3279,168 @@ namespace component_emitter.edge_traverser (defines); component_emitter.edge_traverser (inherits); - NavigationEmitsEmitter navigation_emits_emitter (ctx); - defines.node_traverser (navigation_emits_emitter); + EmitsConnectEmitter emits_connect_emitter (ctx); + defines.node_traverser (emits_connect_emitter); component_emitter.traverse (t); } os << STRS[ACE_UA] << " (consumer);" - << "ACE_THROW (" + << STRS[ACE_TH] << " ( " << STRS[EXCP_IN] << " ());" << endl << "}"; + os << STRS[COMP_ECB] << "_ptr" << endl + << t.name () << "_Servant::disconnect_consumer (" << endl + << "const char *source_name" << endl + << STRS[ENV_SRC] << ")" << endl + << STRS[EXCP_START] << " " + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_IN] << "," << endl + << STRS[EXCP_NC] << "))" << endl + << "{"; + + if (swapping) + { + os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CR] << " ( " + << STRS[COMP_ECB] << "::_nil ());" << endl; + } + + os << "if (source_name == 0)" << endl + << "{" + << STRS[ACE_TR] << " ( " << STRS[EXCP_BP] << "," << endl + << STRS[COMP_ECB] << "::_nil ());" << endl + << "}"; + + // Generate an IF block for each 'emits' declaration. + { + Traversal::Component component_emitter; + + Traversal::Inherits inherits; + inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (inherits); + + EmitsDisconnectEmitter emits_disconnect_emitter (ctx); + defines.node_traverser (emits_disconnect_emitter); + + component_emitter.traverse (t); + } + + os << STRS[ACE_TR] << " ( " + << STRS[EXCP_IN] << " ()," << endl + << STRS[COMP_ECB] << "::_nil ());" << endl + << "}"; + + os << STRS[COMP_PD] << " *" << endl + << t.name () << "_Servant::get_all_publishers (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_SNGL] << endl + << "{" + << STRS[COMP_PD] << " *retval = 0;" + << "ACE_NEW_RETURN (retval," << endl + << STRS[COMP_PD] << "," << endl + << "0);" + << STRS[COMP_PD] << "_var safe_retval = retval;"; + + size = 0UL; + + { + Traversal::Component component_emitter; + + Traversal::Inherits inherits; + inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (inherits); + + PublishesSizeCalculator publishes_size_calculator (ctx, size); + defines.node_traverser (publishes_size_calculator); + + component_emitter.traverse (t); + } + + os << "safe_retval->length (" << size << "UL);" << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits inherits; + inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (inherits); + + PublishesGetAllEmitter publishes_get_all_emitter (ctx); + defines.node_traverser (publishes_get_all_emitter); + + component_emitter.traverse (t); + } + + os << "return safe_retval._retn ();" + << "}"; + + os << STRS[COMP_ED] << " *" << endl + << t.name () << "_Servant::get_all_emitters (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_SNGL] << endl + << "{" + << STRS[COMP_ED] << " *retval = 0;" + << "ACE_NEW_RETURN (retval," << endl + << STRS[COMP_ED] << "," << endl + << "0);" + << STRS[COMP_ED] << "_var safe_retval = retval;"; + + size = 0UL; + + { + Traversal::Component component_emitter; + + Traversal::Inherits inherits; + inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (inherits); + + EmitsSizeCalculator emits_size_calculator (ctx, size); + defines.node_traverser (emits_size_calculator); + + component_emitter.traverse (t); + } + + os << "safe_retval->length (" << size << "UL);" << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits inherits; + inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (inherits); + + EmitsGetAllEmitter emits_get_all_emitter (ctx); + defines.node_traverser (emits_get_all_emitter); + + component_emitter.traverse (t); + } + + os << "return safe_retval._retn ();" + << "}"; + os << STRS[COMP_CK] << " *" << endl << t.name () << "_Servant::subscribe (" << endl << "const char *publisher_name," << endl << STRS[COMP_ECB] << "_ptr subscribe" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_IC] << "," << endl @@ -3501,7 +3457,7 @@ namespace << STRS[ACE_UA] << " (subscribe);" << endl << "if (publisher_name == 0)" << endl << "{" - << STRS[ACE_TR] << " (" << STRS[EXCP_IN] << " (), 0);" + << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " (), 0);" << endl << "}"; @@ -3522,7 +3478,7 @@ namespace component_emitter.traverse (t); } - os << STRS[ACE_TR] << " (" << STRS[EXCP_IN] << " (), 0);" << endl + os << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " (), 0);" << endl << "}"; os << STRS[COMP_ECB] << "_ptr" << endl @@ -3531,24 +3487,24 @@ namespace << "const char *publisher_name," << endl << STRS[COMP_CK] << " *ck" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "," << endl << STRS[EXCP_IC] << "))" << endl << "{"; if (swapping) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" - << STRS[ACE_CR] << " (" << STRS[COMP_ECB] - << "::_nil ());" << endl; - } + { + os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CR] << " ( " << STRS[COMP_ECB] + << "::_nil ());" << endl; + } os << "// Just in case there are no if blocks" << endl << STRS[ACE_UA] << " (ck);" << endl << "if (publisher_name == 0)" << endl << "{" - << STRS[ACE_TR] << " (" << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " ()," << endl << STRS[COMP_ECB] << "::_nil ());" << endl << "}"; @@ -3570,7 +3526,7 @@ namespace component_emitter.traverse (t); } - os << STRS[ACE_TR] << " (" << endl + os << STRS[ACE_TR] << " ( " << STRS[EXCP_IN] << " ()," << endl << STRS[COMP_ECB] << "::_nil ());" << endl << "}"; @@ -3592,25 +3548,24 @@ namespace component_emitter.traverse (t); } - os << "CORBA::Object_ptr" << endl + os << "::CORBA::Object_ptr" << endl << t.name () << "_Servant::get_facet_executor (" << endl << "const char *name" << endl << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_START] << endl + << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "))" << endl << "{"; if (swapping) - { - os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" - << STRS[ACE_CR] << " (CORBA::Object::_nil ());" << endl; - } + { + os << "this->activate_component (" << STRS[ENV_SNGL_ARG] << ");" + << STRS[ACE_CR] << " ( ::CORBA::Object::_nil ());" << endl; + } os << "if (name == 0)" << endl << "{" - << STRS[ACE_TR] << " (" << endl - << "::CORBA::BAD_PARAM ()," << endl + << STRS[ACE_TR] << " ( " << STRS[EXCP_BP] << "," << endl << "::CORBA::Object::_nil ());" << endl << "}"; @@ -3632,7 +3587,7 @@ namespace component_emitter.traverse (t); } - os << " return CORBA::Object::_nil ();" + os << "return ::CORBA::Object::_nil ();" << "}"; os << "// Supported operations." << endl << endl; @@ -3656,7 +3611,7 @@ namespace interface_emitter.edge_traverser (defines); interface_emitter.edge_traverser (interface_inherits); - AttributeEmitter attribute_emitter (ctx, t); + AttributeSourceEmitter attribute_emitter (ctx, t); defines.node_traverser (attribute_emitter); OperationEmitter operation_emitter (ctx, t); @@ -3670,15 +3625,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -3687,9 +3642,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -3710,7 +3665,7 @@ namespace Traversal::Defines defines; component_emitter.edge_traverser (defines); - AttributeEmitter attribute_emitter (ctx, t); + AttributeSourceEmitter attribute_emitter (ctx, t); defines.node_traverser (attribute_emitter); component_emitter.traverse (t); @@ -3752,8 +3707,8 @@ namespace { HomeEmitter (Context& c) : EmitterBase (c), - repo_id_emitter_ (c.os ()), - flat_name_emitter_ (c.os ()) + repo_id_emitter_ (c), + flat_name_emitter_ (c) { repo_id_manages_.node_traverser (repo_id_emitter_); flat_name_manages_.node_traverser (flat_name_emitter_); @@ -3817,10 +3772,10 @@ namespace { FactoryOperationEmitter (Context& c, SemanticGraph::Home& home) : EmitterBase (c), - return_type_name_emitter_ (c.os ()), - enclosing_type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), - type_name_emitter_ (c.os ()), + return_type_name_emitter_ (c), + enclosing_type_name_emitter_ (c), + simple_type_name_emitter_ (c), + type_name_emitter_ (c), scope_ (home) { returns_.node_traverser (return_type_name_emitter_); @@ -3871,7 +3826,7 @@ namespace virtual void raises_pre (SemanticGraph::HomeFactory&) { - os << STRS[EXCP_START] << endl + os << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl; } @@ -3907,7 +3862,7 @@ namespace operation_emitter.traverse (hf); } - os << STRS[ACE_CR] << " ("; + os << STRS[ACE_CR] << " ( "; Traversal::Home::manages (scope_, manages_); @@ -3931,7 +3886,7 @@ namespace << "_ciao_ec.in ()" << endl << STRS[ENV_ARG] << ");" << endl; - os << STRS[ACE_CR] << " ("; + os << STRS[ACE_CR] << " ( "; Traversal::Home::manages (scope_, manages_); @@ -3954,7 +3909,7 @@ namespace ReturnTypeNameEmitter return_type_name_emitter_; EnclosingTypeNameEmitter enclosing_type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; Traversal::Returns returns_; Traversal::Manages enclosing_manages_; Traversal::Manages simple_manages_; @@ -3968,10 +3923,10 @@ namespace { FinderOperationEmitter (Context& c, SemanticGraph::Home& home) : EmitterBase (c), - type_name_emitter_ (c.os ()), - return_type_name_emitter_ (c.os ()), - enclosing_type_name_emitter_ (c.os ()), - simple_type_name_emitter_ (c.os ()), + type_name_emitter_ (c), + return_type_name_emitter_ (c), + enclosing_type_name_emitter_ (c), + simple_type_name_emitter_ (c), scope_ (home) { returns_.node_traverser (return_type_name_emitter_); @@ -4022,7 +3977,7 @@ namespace virtual void raises_pre (SemanticGraph::HomeFinder&) { - os << STRS[EXCP_START] << endl + os << STRS[EXCP_START] << " " << STRS[EXCP_SYS] << "," << endl; } @@ -4036,8 +3991,7 @@ namespace post (SemanticGraph::HomeFinder& hf) { os << "{" - << STRS[ACE_TR] << " (" << endl - << "::CORBA::NO_IMPLEMENT ()," << endl; + << STRS[ACE_TR] << " ( ::CORBA::NO_IMPLEMENT ()," << endl; Traversal::HomeFinder::returns (hf, simple_returns_); @@ -4052,7 +4006,7 @@ namespace } private: - TypeNameEmitter type_name_emitter_; + FullTypeNameEmitter type_name_emitter_; ReturnTypeNameEmitter return_type_name_emitter_; EnclosingTypeNameEmitter enclosing_type_name_emitter_; SimpleTypeNameEmitter simple_type_name_emitter_; @@ -4121,15 +4075,15 @@ namespace home_operation_emitter.edge_traverser (returns); home_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -4138,9 +4092,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -4168,7 +4122,7 @@ namespace interface_emitter.edge_traverser (defines); interface_emitter.edge_traverser (interface_inherits); - AttributeEmitter attribute_emitter (ctx, t); + AttributeSourceEmitter attribute_emitter (ctx, t); defines.node_traverser (attribute_emitter); OperationEmitter operation_emitter (ctx, t); @@ -4182,15 +4136,15 @@ namespace operation_emitter.edge_traverser (returns); operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -4199,9 +4153,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -4236,15 +4190,15 @@ namespace finder_operation_emitter.edge_traverser (returns); finder_operation_emitter.edge_traverser (raises); - ParameterEmitter in_param (os); - ParameterEmitter inout_param (os); - ParameterEmitter out_param (os); + ParameterEmitter in_param (ctx); + ParameterEmitter inout_param (ctx); + ParameterEmitter out_param (ctx); receives.node_traverser (in_param); receives.node_traverser (inout_param); receives.node_traverser (out_param); - ReturnTypeNameEmitter return_type_emitter (os); - TypeNameEmitter type_name_emitter (os); + ReturnTypeNameEmitter return_type_emitter (ctx); + FullTypeNameEmitter type_name_emitter (ctx); returns.node_traverser (return_type_emitter); raises.node_traverser (type_name_emitter); @@ -4253,9 +4207,9 @@ namespace inout_param.edge_traverser (inout_belongs); out_param.edge_traverser (out_belongs); - INArgTypeNameEmitter in_arg_emitter (os); - INOUTArgTypeNameEmitter inout_arg_emitter (os); - OUTArgTypeNameEmitter out_arg_emitter (os); + INArgTypeNameEmitter in_arg_emitter (ctx); + INOUTArgTypeNameEmitter inout_arg_emitter (ctx); + OUTArgTypeNameEmitter out_arg_emitter (ctx); in_belongs.node_traverser (in_arg_emitter); inout_belongs.node_traverser (inout_arg_emitter); out_belongs.node_traverser (out_arg_emitter); @@ -4276,7 +4230,7 @@ namespace Traversal::Defines defines; home_emitter.edge_traverser (defines); - AttributeEmitter attribute_emitter (ctx, t); + AttributeSourceEmitter attribute_emitter (ctx, t); defines.node_traverser (attribute_emitter); home_emitter.traverse (t); @@ -4293,7 +4247,7 @@ namespace << regex::perl_s (t.scoped_name ().str (), "/::/_/") << "_Servant (" << endl << "::Components::HomeExecutorBase_ptr p," << endl - << "CIAO::Session_Container *c," << endl + << "::CIAO::Session_Container *c," << endl << "const char *ins_name" << endl << STRS[ENV_SRC] << ")" << endl << "{" @@ -4327,30 +4281,6 @@ namespace Traversal::Manages repo_id_manages_; Traversal::Manages flat_name_manages_; }; - - //@@ There is exactly the same code in header generator. - // - struct CompositionEmitter : Traversal::Composition, EmitterBase - { - CompositionEmitter (Context& c) - : EmitterBase (c) - { - } - - virtual void - pre (Type& t) - { - ctx.composition_name (t.name ().str ()); - - os << STRS[CIDL_NS] << t.name () << "{"; - } - - virtual void - post (Type&) - { - os << "}"; - } - }; } ServantSourceEmitter::ServantSourceEmitter (std::ostream& os_, @@ -4466,9 +4396,3 @@ ServantSourceEmitter::generate (TranslationUnit& u) unit.traverse (u); } -/* - * Local Variables: - * mode: C++ - * c-basic-offset: 2 - * End: - */ diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.h b/TAO/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.h index bd3b09b51f9..f4b828b3f20 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.h +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.h @@ -23,7 +23,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "DeploymentC.h" +#include "ciao/NodeManagerC.h" #include "DomainApplicationManager/DomainApplicationManager_Export.h" #include "ace/SString.h" #include "tao/Valuetype/ValueBase.h" diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp index 26b4776290a..0ba9b6d4644 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp @@ -1,10 +1,12 @@ // $Id$ #include "DomainApplicationManager_Impl.h" -//#include "NodeManager/NodeManagerC.h" +#include "ExecutionManager/Execution_Manager_Impl.h" +#include "ciao/NodeApplicationManagerC.h" #include "ace/Null_Mutex.h" #include "ace/OS_NS_string.h" #include "ace/SString.h" +#include "ace/Assert.h" #if !defined (__ACE_INLINE__) # include "DomainApplicationManager_Impl.inl" @@ -35,7 +37,8 @@ DomainApplicationManager_Impl (CORBA::ORB_ptr orb, // deployment_file_ (CORBA::string_dup (deployment_file)), deployment_config_ (orb), - is_redeployment_ (false) + is_redeployment_ (false), + esd_ (0) { ACE_DECLARE_NEW_CORBA_ENV; ACE_NEW_THROW_EX (this->all_connections_, @@ -46,6 +49,21 @@ DomainApplicationManager_Impl (CORBA::ORB_ptr orb, Deployment::ComponentPlans (), CORBA::NO_MEMORY ()); ACE_CHECK; + + ACE_NEW_THROW_EX (this->esd_, + CIAO::DAnCE::EventServiceDeploymentDescriptions (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + for (CORBA::ULong i = 0; i < this->plan_.infoProperty.length (); ++i) + { + if (ACE_OS::strcmp (this->plan_.infoProperty[i].name.in (), + "CIAOEvents") != 0) + continue; + + this->plan_.infoProperty[0].value >>= this->esd_; + break; + } } CIAO::DomainApplicationManager_Impl::~DomainApplicationManager_Impl () @@ -164,9 +182,6 @@ init (ACE_ENV_SINGLE_ARG_DECL) Chained_Artifacts & artifacts = entry->int_id_; - // The dump() function is broken. - //Deployment::DnC_Dump::dump (artifacts.child_plan_); - // Call preparePlan() method on the NodeManager with the // corresponding child plan as input, which returns a // NodeApplicationManager object reference. @@ -574,9 +589,16 @@ startLaunch (const ::Deployment::Properties & configProperty, } else { + //============================================================= + // Add New Components Logic + //============================================================= + // Let's add new components only now, the to-be-removed + // components should be removed AFTER the connections + // are removed. temp_application = my_nam->perform_redeployment (configProperty, retn_connections.out (), + true, // add new components only now 0); } @@ -635,10 +657,105 @@ startLaunch (const ::Deployment::Properties & configProperty, ACE_CHECK; } + +void +CIAO::DomainApplicationManager_Impl:: +install_all_es (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)) +{ + ACE_TRY + { + for (CORBA::ULong j = 0; j < this->esd_->length (); ++j) + { + // Construct the ESInstallationInfos data + Deployment::ESInstallationInfos_var es_infos; + ACE_NEW (es_infos, + Deployment::ESInstallationInfos); + + es_infos->length (1); + (*es_infos)[0].id = this->esd_[j].name.in (); + (*es_infos)[0].type = CIAO::RTEC; //only RTEC is supported so far + (*es_infos)[0].svcconf = this->esd_[j].svc_cfg_file.in (); + + // Find NA, and then invoke operation on it + ACE_Hash_Map_Entry *entry = 0; + + if (this->artifact_map_.find (this->esd_[j].node.in (), + entry) != 0) + { + ACE_ERROR ((LM_ERROR, + "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" + "CIAO::DomainApplicationManager_Impl::install_all_es -" + "ERROR while finding the node specific plan " + "for the node [%s] \n", + this->esd_[j].node.in ())); + + ACE_CString error + ("Unable to resolve a reference to NodeManager: "); + error += this->esd_[j].node.in (); + + ACE_TRY_THROW + (Deployment::StartError + ("DomainApplicationManager_Impl::install_all_es", + error.c_str ())); + } + + // Invoke install_es () operation on each cached NodeApplication object. + ::Deployment::NodeApplication_ptr my_na = + (entry->int_id_).node_application_.in (); + + ::Deployment::CIAO_Event_Services_var event_services = + my_na->install_es (es_infos); + + // Add these returned ES objects into the cached map + this->add_es_to_map (es_infos, event_services); + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "DomainApplicationManager_Impl::post_finishLaunch.\n"); + ACE_RE_THROW; + } + ACE_ENDTRY; + + ACE_CHECK; +} + +void +CIAO::DomainApplicationManager_Impl:: +add_es_to_map (Deployment::ESInstallationInfos * es_infos, + Deployment::CIAO_Event_Services * event_services) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)) +{ + ACE_TRY + { + CORBA::ULong es_length = event_services->length (); + + for (CORBA::ULong i = 0; i < es_length; ++i) + { + this->es_map_.bind ( + (*es_infos)[i].id.in (), + CIAO::CIAO_Event_Service::_duplicate ((*event_services)[i])); + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "DomainApplicationManager_Impl::add_es_to_map.\n"); + ACE_RE_THROW; + } + ACE_ENDTRY; + + ACE_CHECK; +} + void CIAO::DomainApplicationManager_Impl:: finishLaunch (CORBA::Boolean start, - CORBA::Boolean is_ReDAC + CORBA::Boolean is_ReDaC ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Deployment::StartError)) @@ -646,10 +763,13 @@ finishLaunch (CORBA::Boolean start, CIAO_TRACE("CIAO::DomainApplicationManager_Impl::finishLaunch"); ACE_TRY { + // Install all the CIAO_Event_Services within the Deployment Plan + this->install_all_es (); + // Invoke finishLaunch() operation on each cached NodeApplication object. // This will establish bindings for only those internal components, but // NOT for those external/shared components, which requires special - // handle, since these components are outside the control of this + // handling, since these components are outside the control of this // DomainApplicationManager. for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) { @@ -690,13 +810,13 @@ finishLaunch (CORBA::Boolean start, "==============================================\n")); } - // Get the Connections variable, if ReDAC is true, then we get + // Get the Connections variable, if ReDaC is true, then we get // those new connections only. NOTE: get_outgoing_connections // by default will get *all* connections. Deployment::Connections * my_connections = this->get_outgoing_connections ( (entry->int_id_).child_plan_.in (), - !is_ReDAC, + !is_ReDaC, true, // we search *new* plan DomainApplicationManager_Impl::Internal_Connections ACE_ENV_ARG_PARAMETER); @@ -741,7 +861,11 @@ finishLaunch (CORBA::Boolean start, ACE_TRY_CHECK; } - if (is_ReDAC) // We should also remove unnecessary connections + //============================================================= + // Remove Old Connections Logic + //============================================================= + + if (is_ReDaC) // We should also *REMOVE* unnecessary connections { // If this is a brand new child plan, then continue. if ((entry->int_id_).old_child_plan_ == 0) @@ -791,13 +915,31 @@ finishLaunch (CORBA::Boolean start, // Invoke finishLaunch() operation on NodeApplication. if (unnecessary_connections->length () != 0) { + ACE_ASSERT (!CORBA::is_nil (entry->int_id_.node_application_.in ())); entry->int_id_.node_application_->finishLaunch (*unnecessary_connections, - start, - false // false ==> remove unnecessary connections - ACE_ENV_ARG_PARAMETER); + start, + false // false ==> remove unnecessary connections + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } + + //============================================================= + // Remove Old Components + //============================================================= + // Finally we need to remove those to-be-removed components + ::Deployment::Properties_var configProperty; + ACE_NEW (configProperty, + Deployment::Properties); + + ::Deployment::Connections_var retn_connections; + + Deployment::Application_var temp_application = + entry->int_id_.node_application_manager_-> + perform_redeployment (configProperty, + retn_connections.out (), + false, // remove old components only + false);// do not "start" } } @@ -1015,7 +1157,7 @@ get_outgoing_connections (const Deployment::DeploymentPlan &plan, bool is_getting_all_connections, bool is_search_new_plan, Connection_Search_Type t - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { CIAO_TRACE("CIAO::DomainApplicationManager_Impl::get_outgoing_connections"); Deployment::Connections_var connections; @@ -1024,7 +1166,8 @@ get_outgoing_connections (const Deployment::DeploymentPlan &plan, 0); // For each component instance in the child plan ... - for (CORBA::ULong i = 0; i < plan.instance.length (); ++i) + CORBA::ULong number = plan.instance.length (); + for (CORBA::ULong i = 0; i < number; ++i) { if (t == Internal_Connections && @@ -1036,19 +1179,21 @@ get_outgoing_connections (const Deployment::DeploymentPlan &plan, connections.inout (), is_getting_all_connections, is_search_new_plan - ACE_ENV_ARG_PARAMETER)) + ACE_ENV_ARG_PARAMETER)) return 0; } return connections._retn (); } + +// Get outgoing connections for particular instance bool CIAO::DomainApplicationManager_Impl:: get_outgoing_connections_i (const char * instname, Deployment::Connections & retv, bool is_getting_all_connections, bool is_search_new_plan - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((Deployment::StartError)) { CIAO_TRACE("CIAO::DomainApplicationManager_Impl::get_outoing_connections_i"); @@ -1059,41 +1204,228 @@ get_outgoing_connections_i (const char * instname, else tmp_plan = this->old_plan_; - // Search for all the connections in the plan. + // Search for all the bindings in the plan. const CORBA::ULong total_length = tmp_plan.connection.length(); for (CORBA::ULong i = 0; i < total_length; ++i) - { - CORBA::ULong len = retv.length (); + { + // Current binding that we are looking at. + const Deployment::PlanConnectionDescription & binding = + tmp_plan.connection[i]; + + // If this is a ReDaC case, then we ignore the connection if it + // already exists in the old_plan + if (already_exists (binding) && + !is_getting_all_connections) + continue; + + this->populate_connection_for_binding (instname, + binding, + tmp_plan, + retv); + } + return true; +} - // Current connection that we are looking at. - const Deployment::PlanConnectionDescription & curr_conn = - tmp_plan.connection[i]; +// Search the current binding to see whether a connection of this +// component needs to be populated +bool +CIAO::DomainApplicationManager_Impl:: +populate_connection_for_binding ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)) +{ + const CORBA::ULong binding_len = binding.internalEndpoint.length (); - if (already_exists (curr_conn) && - !is_getting_all_connections) // ignore existing connections - continue; + if (binding_len == 1) + { + switch (binding.internalEndpoint[0].kind) + { + case Deployment::rtecEventPublisher: + case Deployment::rtecEventConsumer: + return + this->handle_es_connection (instname, + binding, + plan, + retv); + default: + ACE_ERROR ((LM_ERROR, + "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" + "CIAO::DomainApplicationManager_Impl::" + "populate_connection_for_binding -" + "invalid connection specified in deployment plan\n")); + return false; + } + } + else if (binding_len == 2) + { + return this->handle_direct_connection (instname, + binding, + plan, + retv); + } + else // invalid binding encounted... + return false; +} + +bool +CIAO::DomainApplicationManager_Impl:: +handle_es_connection ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)) +{ + // The initial retv might have something inside + CORBA::ULong len = retv.length (); + + const Deployment::PlanSubcomponentPortEndpoint & endpoint = + binding.internalEndpoint[0]; + + // If the instance name does NOT match one of the names in the binding + // Then thsi binding has nothing related to myself (an instance) + if (ACE_OS::strcmp (instname, + plan.instance[endpoint.instanceRef].name.in ()) != 0) + return false; + + if (binding.externalReference.length () != 1) + { + ACE_ERROR ((LM_ERROR, + "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" + "CIAO::DomainApplicationManager_Impl::" + "handle_publisher_es_connection -" + "externalReference must have length of 1.\n")); + return false; + } + + retv.length (len+1); + retv[len].instanceName = instname; + retv[len].portName = endpoint.portName.in (); + retv[len].kind = endpoint.kind; + + ACE_CString es_id = binding.externalReference[0].location.in (); + + retv[len].endpointInstanceName = es_id.c_str (); + retv[len].endpointPortName = "CIAO_ES"; + + // We need to populate the actual filter and store it into + // the field + if (binding.deployRequirement.length () != 0) + { + retv[len].config = + this->get_connection_QoS_configuration (binding.deployRequirement[0]); + } + + // If we didnt find the objref of the connection ... + CIAO::CIAO_Event_Service_var es; + + if (this->es_map_.find (es_id.c_str (), es) != 0) + { + ACE_CString error ("Creating connections for "); + error += instname; + error += ": unable to find object reference for connection "; + error += binding.name.in (); + ACE_THROW_RETURN (Deployment::StartError + ("DomainApplicationManager_Impl::create_connections_i", + error.c_str ()), + false); + } + + retv[len].event_service = es._retn (); + + // One more thing needs to be done if this is a es_consumer connection + if (endpoint.kind == Deployment::rtecEventConsumer) + { + // Now we search in the received connections to get the objRef of event sink + bool found = false; + const CORBA::ULong all_conn_len = this->all_connections_->length (); + for (CORBA::ULong j = 0; j < all_conn_len; ++j) + { + const Deployment::Connection & curr_recv_conn = + this->all_connections_[j]; + + // We need to look at the instance name and the port name to confirm. + if (ACE_OS::strcmp (curr_recv_conn.instanceName.in (), + instname) == 0 && + ACE_OS::strcmp (curr_recv_conn.portName.in (), + endpoint.portName.in ()) == 0) + { + retv[len].endpoint = + CORBA::Object::_duplicate(curr_recv_conn.endpoint.in ()); + found = true; + } + } // End of searching received connections + + if (!found) + { + ACE_CString error ("Creating connections for "); + error += instname; + error += ": unable to find object reference for connection "; + error += binding.name.in (); + ACE_THROW_RETURN (Deployment::StartError + ("DomainApplicationManager_Impl::handle_es_connection", + error.c_str ()), + false); + } + } + + return true; +} + +bool +CIAO::DomainApplicationManager_Impl:: +handle_direct_connection ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)) +{ + // The initial retv might have something inside + CORBA::ULong len = retv.length (); - //The modeling tool should make sure there are always 2 endpoints - //in a connection. - const CORBA::ULong curr_conn_len = curr_conn.internalEndpoint.length (); - for (CORBA::ULong p_index = 0; - p_index < curr_conn_len; - ++p_index) + const CORBA::ULong binding_len = binding.internalEndpoint.length (); + for (CORBA::ULong i = 0; i < binding_len; ++i) { const Deployment::PlanSubcomponentPortEndpoint & endpoint = - curr_conn.internalEndpoint[p_index]; + binding.internalEndpoint[i]; + + // If the instance name does NOT match one of the names in the binding + if (ACE_OS::strcmp (instname, + plan.instance[endpoint.instanceRef].name.in ()) != 0) + continue; + + // We are only interested when we are the "client" of the endpoint objref + if (endpoint.kind == Deployment::EventPublisher || + endpoint.kind == Deployment::EventEmitter || + endpoint.kind == Deployment::SimplexReceptacle || + endpoint.kind == Deployment::MultiplexReceptacle ) + { + // Obtain the index of the "real" endpoint which has an objref. It + // is the opposite side of myself. + CORBA::ULong e_index = (i + 1) % 2; - // If the component name matches the name of one of the - // endpoints in the connection. - if (ACE_OS::strcmp (tmp_plan.instance[endpoint.instanceRef].name.in (), - instname) == 0 ) - { - //Look at the port kind to make sure it's what we are interested in. - if (endpoint.kind != Deployment::Facet && - endpoint.kind != Deployment::EventConsumer) - { - // The other endpoints in this connection is what we want. - CORBA::ULong index = (p_index +1)%2; + ACE_CString source_port = + binding.internalEndpoint[i].portName.in (); + + ACE_CString endpoint_inst = + plan.instance[binding.internalEndpoint[e_index] + .instanceRef].name.in (); + + ACE_CString endpoint_port = + binding.internalEndpoint[e_index].portName.in (); + + bool found = false; + + // Now we search in the received connections to get the objRef. + const CORBA::ULong all_conn_len = this->all_connections_->length (); + for (CORBA::ULong j = 0; j < all_conn_len; ++j) + { + const Deployment::Connection & curr_conn = + this->all_connections_[j]; //Cache the name of the other component for later usage (search). ACE_CString name = @@ -1111,7 +1443,8 @@ get_outgoing_connections_i (const char * instname, name.c_str (), port_name.c_str ())); } - + + bool found = false; // Now we have to search in the received // connections to get the objRef. @@ -1146,25 +1479,22 @@ get_outgoing_connections_i (const char * instname, } } - // We didnt find the counter part connection even - // we are sure there must be 1. - if (!found) - { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += curr_conn.name.in (); - ACE_THROW_RETURN (Deployment::StartError - ("DomainApplicationManager_Impl::create_connections_i", - error.c_str ()), - false); - } - - break; - } - } + // We didnt find the objref of the connection ... + if (!found) + { + ACE_CString error ("Creating connections for "); + error += instname; + error += ": unable to find object reference for connection "; + error += binding.name.in (); + ACE_THROW_RETURN (Deployment::StartError + ("DomainApplicationManager_Impl::create_connections_i", + error.c_str ()), + false); + } + break; + } + } - } return true; } @@ -1328,13 +1658,9 @@ destroyApplication (ACE_ENV_SINGLE_ARG_DECL) my_na->ciao_passivate (); } - // Remove all connections associated with the plan for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) { - ACE_DEBUG ((LM_DEBUG, "DAM:DA Second for loop %s\n", - this->node_manager_names_[i].c_str ())); - ACE_Hash_Map_Entry *entry = 0; this->artifact_map_.find (this->node_manager_names_[i], entry); @@ -1345,7 +1671,7 @@ destroyApplication (ACE_ENV_SINGLE_ARG_DECL) true, // yes, get *all* the connections true, // yes, we search the current plan DomainApplicationManager_Impl::External_Connections - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Invoke finishLaunch() on NodeApplication to remove bindings. @@ -1387,16 +1713,16 @@ destroyApplication (ACE_ENV_SINGLE_ARG_DECL) ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } + } + // After all the connections are removed, we actually destroy for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) { ACE_Hash_Map_Entry *entry = 0; this->artifact_map_.find (this->node_manager_names_[i], entry); - // To invoke operations on NodeManagers is the way to go. - // Invoke destroyPlan() operation on the NodeManager Deployment::NodeManager_var my_node_manager = (entry->int_id_).node_manager_; @@ -1406,7 +1732,8 @@ destroyApplication (ACE_ENV_SINGLE_ARG_DECL) ACE_TRY_CHECK; } - // Invoke destroyManager () operation on the NodeManager, since we need + // ?? + // Shall we invoke destroyManager () operation on the NodeManager, since we need // to clean up all the NodeApplicationManagers associated with this deployment // plan (one NodeApplicationManager per Node per plan). @@ -1505,13 +1832,15 @@ perform_redeployment ( this->startLaunch (properties.in (), false); - // finishLaunch() will not only establish new connections, but also - // should get rid of those non-existing connections. As we know, in the + // finishLaunch will (1) establish new connections, and (2) + // get rid of those non-existing connections. As we know, in the // node level, the connections are cached within the NodeApplication *and* // Container, then we should modify the implementation of the // on the NodeApplication to accomplish this. this->finishLaunch (true, true); // true means start activation also. - // ture means "ReDAC" is desired + // ture means "ReDaC" is desired + + this->start (); } ACE_CATCHANY { @@ -1589,10 +1918,28 @@ dump_connections (const ::Deployment::Connections & connections) ACE_DEBUG ((LM_DEBUG, "EventConsumer\n")); break; + case Deployment::rtecEventPublisher: + + ACE_DEBUG ((LM_DEBUG, "rtecEventPublisher\n")); + break; + + case Deployment::rtecEventConsumer: + + ACE_DEBUG ((LM_DEBUG, "rtecEventConsumer\n")); + break; + default: ACE_DEBUG ((LM_DEBUG, "Unknown port kind.\n")); - } + + ACE_DEBUG ((LM_DEBUG, + "endpointInstanceName: %s\n", + connections[i].endpointInstanceName.in ())); + + ACE_DEBUG ((LM_DEBUG, + "endpointPortName: %s\n", + connections[i].endpointPortName.in ())); + ACE_DEBUG ((LM_DEBUG, "---------------------\n")); } } @@ -1650,36 +1997,6 @@ subtract_connections (const Deployment::Connections & left, return retv._retn (); } -void -CIAO::DomainApplicationManager_Impl:: -purge_connections (Deployment::Connections_var & connections, - const char * inst) -{ - CORBA::ULong total_len = connections->length (); - - for (CORBA::ULong i = 0; i < total_len; ++i) - { - bool found = false; - - // Remove all the connections whose "source" component - // name is - if (ACE_OS::strcmp (connections[i].instanceName.in (), - inst) == 0) - { - found = true; - - for (CORBA::ULong j = i; j < total_len - 1; ++j) - { - connections[j] = connections[j + 1]; - } - connections->length (total_len - 1); - } - - if (found) - this->purge_connections (connections, inst); - } -} - void CIAO::DomainApplicationManager_Impl:: passivate_shared_components (void) @@ -1751,3 +2068,81 @@ activate_shared_components (void) ACE_CHECK; } + +void +CIAO::DomainApplicationManager_Impl:: +purge_connections (Deployment::Connections_var & connections, + const char * inst) +{ + CORBA::ULong total_len = connections->length (); + + for (CORBA::ULong i = 0; i < total_len; ++i) + { + bool found = false; + + // Remove all the connections whose "source" component + // name is + if (ACE_OS::strcmp (connections[i].instanceName.in (), + inst) == 0) + { + found = true; + + for (CORBA::ULong j = i; j < total_len - 1; ++j) + { + connections[j] = connections[j + 1]; + } + connections->length (total_len - 1); + } + + if (found) + this->purge_connections (connections, inst); + } +} + +const Deployment::Properties & +CIAO::DomainApplicationManager_Impl:: +get_connection_QoS_configuration (const Deployment::Requirement & requirement) +{ + // Get the name/identifier of the filter associated with + // this connection + Deployment::Properties_var retv; + ACE_NEW_NORETURN (retv, Deployment::Properties); + + CORBA::ULong len = retv->length (); + + for (CORBA::ULong i = 0; + i < requirement.property.length (); + ++i) + { + const char *filter_name; + if (ACE_OS::strcmp ("EventFilter", + requirement.property[i].name) == 0) + { + + if ((requirement.property[i].value >>= filter_name) == false) + ACE_ERROR ((LM_ERROR, + "ERROR: DomainApplicationManager_Impl::" + "get_connection_QoS_configuration unable to " + "extract event filter information\n")); + } + + // Search for the desired filter + for (CORBA::ULong j = 0; j < this->esd_->length (); ++j) + { + // Populate the "filters" info, in case this CIAO_Event_Service has + // one or more filters specified through descriptors + for (CORBA::ULong k = 0; k < this->esd_[j].filters.length (); ++k) + { + if (ACE_OS::strcmp (this->esd_[j].filters[k].name.in (), + filter_name) == 0) + { + retv->length (len + 1); + retv[len].name = CORBA::string_dup ("EventFilter"); + retv[len].value <<= this->esd_[j].filters[k]; + break; + } + } + } + } + return retv.inout (); +} diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h index f18e5b6206e..49e52ee7d37 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h @@ -28,18 +28,24 @@ #include "ace/Vector_T.h" #include "ace/Functor.h" #include "ace/OS_NS_string.h" -#include "DeploymentS.h" +#include "ciao/DomainApplicationManagerS.h" +#include "ciao/Deployment_common.h" #include "tao/Valuetype/ValueBase.h" #include "tao/Valuetype/Valuetype_Adapter_Impl.h" #include "Deployment_Configuration.h" #include "DomainApplicationManager_Export.h" -#include "ExecutionManager/Execution_Manager_Impl.h" #include "ciao/CIAO_common.h" +#include "ciao/Deployment_EventsC.h" namespace CIAO { + namespace Execution_Manager + { + class Execution_Manager_Impl; + } + /** * @class DomainApplicationManager_Impl * @@ -316,6 +322,11 @@ namespace CIAO * of the "providedReference" for the component instances in the * child deployment plan as Receiver side. * By default, we search in the new plan. + * + * If is false, then we only + * search for "new connections" (valid for ReDaC case only). + * Otherwise, we will search for both new connections and those + * already existing connections. */ Deployment::Connections * get_outgoing_connections (const Deployment::DeploymentPlan &plan, @@ -333,6 +344,30 @@ namespace CIAO ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((Deployment::StartError)); + bool + populate_connection_for_binding ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)); + + bool + handle_es_connection ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)); + + bool + handle_direct_connection ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)); + /// Dump connections, a static method void dump_connections (const ::Deployment::Connections & connections); @@ -347,6 +382,35 @@ namespace CIAO void purge_connections (Deployment::Connections_var & connections, const char * inst); + + /** + * The first step in finish_launching an application in the + * domain-level. We install all the CIAO_Event_Service objects + * as specified in the DeploymentPlan. + * Internally, this operation will invoke an operation on each cached + * NodeApplication object. + */ + virtual void install_all_es (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + /** + * Add all CIAO_Event_Service objects into the cached map. + */ + virtual void + add_es_to_map (Deployment::ESInstallationInfos * es_infos, + Deployment::CIAO_Event_Services * event_services) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + /** + * Get the actual event connection QoS properties based on the + * deployment requirement. The deployment requirement only specifies + * an identifier/reference to the EventServiceDeploymentDescriptions. + */ + virtual const Deployment::Properties & + get_connection_QoS_configuration ( + const Deployment::Requirement & requirement); protected: /// location of the Domainapplication @@ -402,6 +466,18 @@ namespace CIAO Chained_Artifacts_Table artifact_map_; + /// Cached information of all the CIAO_Event_Service objects within + /// the deployment plan + /// Key: the string identifier of the CIAO_Event_Service + /// Value: the object reference of the CIAO_Event_Service + typedef ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex> Event_Service_Table; + + Event_Service_Table es_map_; + /// The deployment information data file. const char * deployment_file_; @@ -419,6 +495,9 @@ namespace CIAO /// member function implementations. The reason is because we want /// to avoid unnecessary code duplicate. The default value is "false". bool is_redeployment_; + + /// Cache the CIAO_Event_Service deployment description + CIAO::DAnCE::EventServiceDeploymentDescriptions_var esd_; }; } diff --git a/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h b/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h index 841bd1a437e..1e6914db7f3 100644 --- a/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h +++ b/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h @@ -13,17 +13,16 @@ #define CIAO_DAM_MAP_H #include /**/ "ace/pre.h" -#include "ace/Null_Mutex.h" +#include "ciao/DomainApplicationManagerC.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Null_Mutex.h" #include "ace/Hash_Map_Manager.h" -#include "ciao/DeploymentC.h" #include "ace/SString.h" - namespace CIAO { namespace Execution_Manager diff --git a/TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc b/TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc index f522c314700..7e5ffea6540 100644 --- a/TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc +++ b/TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc @@ -1,18 +1,17 @@ // -*- MPC -*- // $Id$ -project(ExecutionManager): ciao_component_dnc, dance_extension_stub { - +project(ExecutionManager): ciao_server_dnc, dance_extension_stub, ciao_domainapplicationmanager_dnc { exename = Execution_Manager - after += DomainApplicationManager ExecutionManager_stub - libs += DomainApplicationManager ExecutionManager_stub + after += ExecutionManager_stub + libs += ExecutionManager_stub IDL_Files { } Source_Files { - ../Interfaces/ExecutionManagerS.cpp + ../Interfaces/ExecutionManagerDaemonS.cpp Execution_Manager.cpp Execution_Manager_Impl.cpp DAM_Map.cpp diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp index cfb3b55fc70..12ccb365fbe 100644 --- a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp +++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp @@ -200,7 +200,7 @@ namespace CIAO ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } - + if (write_to_ior_) { retval = diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp index 06ba9fb8276..658b4196565 100644 --- a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp +++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp @@ -1,4 +1,5 @@ // $Id$ + #include "Execution_Manager_Impl.h" #include "ciao/CIAO_common.h" #include "DomainApplicationManager/DomainApplicationManager_Impl.h" diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h index a64fb545f33..174fc793c99 100644 --- a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h +++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h @@ -16,7 +16,7 @@ #define CIAO_EXECUTION_MANAGER_IMPL_H #include /**/ "ace/pre.h" -#include "Interfaces/ExecutionManagerS.h" +#include "Interfaces/ExecutionManagerDaemonS.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/TAO/CIAO/DAnCE/Interfaces/Interfaces.mpc b/TAO/CIAO/DAnCE/Interfaces/Interfaces.mpc index 8f8933283a2..00f5b5192d9 100644 --- a/TAO/CIAO/DAnCE/Interfaces/Interfaces.mpc +++ b/TAO/CIAO/DAnCE/Interfaces/Interfaces.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project (ExecutionManager_stub): ciao_component_dnc { +project (ExecutionManager_stub): ciao_deployment_stub { sharedname = ExecutionManager_stub @@ -11,15 +11,15 @@ project (ExecutionManager_stub): ciao_component_dnc { dynamicflags = EXECUTIONMANAGER_STUB_BUILD_DLL IDL_Files { - ExecutionManager.idl + ExecutionManagerDaemon.idl } Source_Files { - ExecutionManagerC.cpp + ExecutionManagerDaemonC.cpp } } -project (NodeManager_stub): ciao_component_dnc { +project (NodeManager_stub): ciao_deployment_stub { sharedname = NodeManager_stub idlflags += -Wb,stub_export_macro=NodeManager_stub_Export @@ -30,10 +30,10 @@ project (NodeManager_stub): ciao_component_dnc { dynamicflags = NODEMANAGER_STUB_BUILD_DLL IDL_Files { - NodeManager.idl + NodeManagerDaemon.idl } Source_Files { - NodeManagerC.cpp + NodeManagerDaemonC.cpp } } diff --git a/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.cpp b/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.cpp index 3facc261b5a..e87684ad8ad 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.cpp +++ b/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.cpp @@ -8,7 +8,7 @@ int -CIAO::NodeApplication_Options::parse_args (int argc, char *argv[]) +CIAO::NodeApplication_Options::parse_args (int &argc, char *argv[]) { // ACE_Get_Opt get_opts (argc, argv, "nrk:o:"); ACE_Arg_Shifter shifter (argc, argv); @@ -33,9 +33,14 @@ CIAO::NodeApplication_Options::parse_args (int argc, char *argv[]) // Ignore ORB parameter shifter.ignore_arg (); } - else if ((parm = shifter.get_the_parameter ("-o")) !=0) + else if (shifter.cur_arg_strncasecmp ("-o") == 0) { - this->ior_output_filename_ = parm; + // This double checking is necessary to avoid the Arg_Shifter from + // mistaking any -ORBxxx flag as -o flag. + if ((parm = shifter.get_the_parameter ("-o")) !=0) + { + this->ior_output_filename_ = parm; + } shifter.consume_arg (); } else if ((parm = shifter.get_the_parameter ("-k")) !=0) diff --git a/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.h b/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.h index ed843d19247..e3302eb9182 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.h +++ b/TAO/CIAO/DAnCE/NodeApplication/Configurator_Factory.h @@ -56,7 +56,7 @@ namespace CIAO NodeApplication_Options () : use_callback_ (1), rt_support_ (0) {} // extracting commandline arguments - int parse_args (int argc, char *argv[]); + int parse_args (int &argc, char *argv[]); NodeApp_Configurator *create_nodeapp_configurator (void); diff --git a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp index 7b459a75bdc..7497654143a 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp @@ -1,4 +1,5 @@ // $Id$ + #include "Container_Impl.h" #include "ciao/CCM_ComponentC.h" // for calling StandardConfigurator interface @@ -193,6 +194,22 @@ CIAO::Container_Impl::install ( ACE_DEBUG ((LM_DEBUG, "Failed to register with naming service.\n")); } + else + { + if (this->naming_map_.bind + (impl_infos[i].component_instance_name.in (), + ACE_CString (naming_context))) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) Container_Impl.cpp -" + "CIAO::Container_Impl::install -" + "error in binding component " + "instance name [%s] into the naming map \n", + impl_infos[i].component_instance_name.in ())); + ACE_TRY_THROW (Deployment::InstallationFailure ()); + } + } + } @@ -462,6 +479,8 @@ CIAO::Container_Impl::remove_component (const char * comp_ins_name Components::CCMObject_var comp; Components::CCMHome_ptr home; + ACE_CString naming_context; + ACE_CString str (comp_ins_name); if (CIAO::debug_level () > 5) @@ -491,6 +510,28 @@ CIAO::Container_Impl::remove_component (const char * comp_ins_name if (this->component_map_.unbind (str) == -1) ACE_THROW (::Components::RemoveFailure ()); + if (this->naming_map_.find (str, naming_context) == 0) + { + + bool result = + unregister_with_ns ( + naming_context.c_str (), + this->orb_.in () + ACE_ENV_ARG_PARAMETER + ); + ACE_TRY_CHECK; + + if (!result) + { + ACE_DEBUG ((LM_DEBUG, + "Failed to unregister with naming service.\n")); + } + else + { + if (this->naming_map_.unbind (str) == -1) + ACE_THROW (::Components::RemoveFailure ()); + } + } } bool @@ -530,10 +571,10 @@ CIAO::Container_Impl::register_with_ns (const char * s, char * naming_string = tmp.rep (); char seps[] = "/:"; - char *token, *lastToken = NULL; + char *token, *lastToken = 0; token = ACE_OS::strtok (naming_string, seps); - for (CORBA::ULong i = 0; token != NULL; ++i) + for (CORBA::ULong i = 0; token != 0; ++i) { // While there still are tokens in the "naming_string" name.length (name.length () + 1); @@ -541,7 +582,7 @@ CIAO::Container_Impl::register_with_ns (const char * s, // Get next naming context lastToken = token; - token = ACE_OS::strtok ( NULL, seps ); + token = ACE_OS::strtok ( 0, seps ); } if (name.length() > 1) @@ -596,13 +637,32 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name, ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - // Create a Naming Sequence - CosNaming::Name name (1); - name.length (1); - name[0].id = CORBA::string_dup (obj_name); - name[0].kind = CORBA::string_dup (""); + CosNaming::Name name (0); + name.length (0); + + // Get the multicomponent naming context from the . + // The convention of this input string is that + // different naming context is separated by character '/', such as + // "create a naming context A/B/C/D". + ACE_CString tmp (obj_name); + char * naming_string = tmp.rep (); + char seps[] = "/:"; + + char *token, *lastToken = 0; + token = ACE_OS::strtok (naming_string, seps); + + for (CORBA::ULong i = 0; token != 0; ++i) + { + // While there still are tokens in the "naming_string" + name.length (name.length () + 1); + name[i].id = CORBA::string_dup (token); + + // Get next naming context + lastToken = token; + token = ACE_OS::strtok ( 0, seps ); + } - // Register with the Name Server + // Unregister with the Name Server ACE_DEBUG ((LM_DEBUG, "Unregister component with the name server : %s!\n", obj_name)); diff --git a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.h b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.h index b877587758f..0549841ce53 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.h +++ b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.h @@ -29,7 +29,7 @@ #include "ciao/Container_Base.h" //#include "ciao/Swapping_Container.h" #include "ace/SString.h" -#include "ciao/Server_init.h" // write_IOR function +#include "ciao/Server_init.h" // write_IOR function & NameUtility #include "ciao/CIAO_common.h" // CIAO::debug_level namespace CIAO @@ -209,6 +209,13 @@ protected: typedef CCMComponent_Map::iterator Component_Iterator; CCMComponent_Map component_map_; + typedef ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex> CCMNaming_Map; + CCMNaming_Map naming_map_; + const Static_Config_EntryPoints_Maps* static_entrypts_maps_; }; } diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp index 27379d47950..f3e0ba866ae 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp @@ -5,6 +5,12 @@ #include "ciao/CIAO_common.h" +void print_arg (int argc, char *argv[]) +{ + for (int i = 0; i < argc; ++i) + ACE_DEBUG ((LM_DEBUG, "NodeApplication ARGV[%d] = %s\n", i, argv [i])); +} + int main (int argc, char *argv[]) { @@ -32,6 +38,9 @@ main (int argc, char *argv[]) CIAO::NodeApplication_Options nodeapp_options; + if (CIAO::debug_level () > 9) + print_arg (argc, argv); + if (nodeapp_options.parse_args (argc, argv) != 0) return -1; diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.mpc b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.mpc index b2769803d9f..b87578e5a4e 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.mpc +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(NodeApplication): ciao_component_dnc { +project(NodeApplication): ciao_server_dnc, ciao_events_dnc { after += NoOp_Configurator libs += CIAO_NoOp_Configurator exename = NodeApplication @@ -15,7 +15,7 @@ project(NodeApplication): ciao_component_dnc { } } -project(NoOp_Configurator): ciao_component_dnc { +project(NoOp_Configurator): ciao_deployment_stub { sharedname = CIAO_NoOp_Configurator dynamicflags = NOOP_CONFIGURATOR_BUILD_DLL @@ -24,7 +24,7 @@ project(NoOp_Configurator): ciao_component_dnc { } } -project(RTNA_Configurator): ciao_component_dnc, rt_server { +project(RTNA_Configurator): ciao_deployment_stub, rt_server { sharedname = CIAO_RTNA_Configurator dynamicflags = CIAO_RTNA_CONFIGURATOR_BUILD_DLL diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp index 7c4de13585f..97a3918d263 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp @@ -3,6 +3,7 @@ #include "NodeApplication_Impl.h" #include "ace/SString.h" #include "Container_Impl.h" +#include "Deployment_EventsC.h" #if !defined (__ACE_INLINE__) # include "NodeApplication_Impl.inl" @@ -42,8 +43,8 @@ CIAO::NodeApplication_Impl::create_all_containers ( // Build the Component_Container_Map for (CORBA::ULong j = 0; - j < container_infos[i].impl_infos.length (); - ++j) + j < container_infos[i].impl_infos.length (); + ++j) { this->component_container_map_.bind ( container_infos[i].impl_infos[j].component_instance_name.in (), @@ -71,10 +72,9 @@ CIAO::NodeApplication_Impl::finishLaunch ( this->finishLaunch_i (providedReference, start, add_connection); } -// if , then we shall remove connections. void CIAO::NodeApplication_Impl::finishLaunch_i ( - const Deployment::Connections & providedReference, + const Deployment::Connections & connections, CORBA::Boolean start, CORBA::Boolean add_connection ACE_ENV_ARG_DECL) @@ -86,7 +86,7 @@ CIAO::NodeApplication_Impl::finishLaunch_i ( ACE_TRY { - const CORBA::ULong length = providedReference.length (); + const CORBA::ULong length = connections.length (); // For every connection struct we finish the connection. for (CORBA::ULong i = 0; i < length; ++i) @@ -95,13 +95,28 @@ CIAO::NodeApplication_Impl::finishLaunch_i ( Components::CCMObject_var comp; - if (this->component_objref_map_.find (name, comp) != 0) + // For ES_to_Consumer connection, we simply call + // handle_es_consumer_connection method. + if (connections[i].kind == Deployment::rtecEventConsumer) + { + this->handle_es_consumer_connection ( + connections[i], + add_connection); + continue; + } + + // For other type of connections, we need to fetch the + // objref of the source component + ACE_CString name = connections[i].instanceName.in (); + Component_State_Info comp_state; + + if (this->component_state_map_.find (name, comp_state) != 0) { ACE_ERROR ((LM_ERROR, "CIAO (%P|%t) - NodeApplication_Impl.cpp, " "CIAO::NodeApplication_Impl::finishLaunch, " "invalid port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), + connections[i].portName.in (), name.c_str ())); ACE_TRY_THROW (Deployment::InvalidConnection ()); } @@ -114,271 +129,51 @@ CIAO::NodeApplication_Impl::finishLaunch_i ( Components::EventConsumerBase_var consumer; - // Since we know CCMObject inherits from - // navigation/event/receptacle, no need - // to narrow here. + Components::CCMObject_var comp = comp_state.objref_; - switch (providedReference[i].kind) + switch (connections[i].kind) { - case Deployment::SimplexReceptacle: - case Deployment::MultiplexReceptacle: - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "working on port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), - name.c_str ())); - } - - if (add_connection) - { - try - { - ::Components::Cookie_var cookie = - comp->connect (providedReference[i].portName.in (), - providedReference[i].endpoint.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_CString key = (*create_connection_key (providedReference[i])); - - if (CIAO::debug_level () > 10) - ACE_DEBUG ((LM_ERROR, "[BINGDING KEY]: %s\n", key.c_str ())); - - this->cookie_map_.rebind (key, cookie); - } - catch (...) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplicationImpl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connection FAILED.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - throw; - } - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - else - { - ACE_CString key = (*create_connection_key (providedReference[i])); - ::Components::Cookie_var cookie; - - if (CIAO::debug_level () > 10) - ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); - - if (this->cookie_map_.find (key, cookie) != 0) - { - ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - comp->disconnect (providedReference[i].portName.in (), - cookie.in ()); - this->cookie_map_.unbind (key); - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - break; - - // @@ (GD) A place holder where the Event Channel connections - // should be set up. - - case Deployment::EventEmitter: - ACE_DEBUG ((LM_DEBUG, "NA_I: EventEmitter\n")); - - consumer = Components::EventConsumerBase:: - _narrow (providedReference[i].endpoint.in () - ACE_ENV_ARG_PARAMETER); - - ACE_DEBUG ((LM_DEBUG, "Narrow compelted\n")); - - if (CORBA::is_nil (consumer.in ())) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "for port name [%s] in instance [%s] ," - "there is an invalid endPoint. \n", - providedReference[i].portName.in (), - name.c_str ())); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "working on port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), - name.c_str ())); - } - - if (add_connection) - { - comp->connect_consumer (providedReference[i].portName.in (), - consumer.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - else - { -// Operation not implemented by the CIDLC. -// comp->disconnect_consumer (providedReference[i].portName.in (), -// 0 -// ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - break; - - case Deployment::EventPublisher: - - ACE_DEBUG ((LM_DEBUG, "NA_I: EventPublisher - %s:%s\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in ())); - ACE_DEBUG ((LM_DEBUG, "NA_I: endPoint instance:port %s:%s\n", - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - consumer = Components::EventConsumerBase:: - _narrow (providedReference[i].endpoint.in () - ACE_ENV_ARG_PARAMETER); - - ACE_DEBUG ((LM_DEBUG, "NA_I: Narrow completed\n")); - - if (CORBA::is_nil (consumer.in ())) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "for port name [%s] in instance [%s] ," - "there is an invalid endPoint. \n", - providedReference[i].portName.in (), - name.c_str ())); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "working on port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), - name.c_str ())); - } - - if (add_connection) - { - ::Components::Cookie_var cookie = - comp->subscribe (providedReference[i].portName.in (), - consumer.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_CString key = (*create_connection_key (providedReference[i])); - this->cookie_map_.rebind (key, cookie); - - if (CIAO::debug_level () > 10) - ACE_DEBUG ((LM_ERROR, "[BINGDING KEY]: %s\n", key.c_str ())); - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - else - { - ACE_CString key = (*create_connection_key (providedReference[i])); - ::Components::Cookie_var cookie; - - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); - - if (this->cookie_map_.find (key, cookie) != 0) - { - ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - comp->unsubscribe (providedReference[i].portName.in (), - cookie.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - this->cookie_map_.unbind (key); - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - break; - - default: - ACE_TRY_THROW (Deployment::InvalidConnection ()); + case Deployment::SimplexReceptacle: + case Deployment::MultiplexReceptacle: + this->handle_facet_receptable_connection ( + comp.in (), + connections[i], + add_connection); + break; + + case Deployment::EventEmitter: + this->handle_emitter_consumer_connection ( + comp.in (), + connections[i], + add_connection); + break; + + case Deployment::EventPublisher: + this->handle_publisher_consumer_connection ( + comp.in (), + connections[i], + add_connection); + break; + + case Deployment::rtecEventPublisher: + this->handle_publisher_es_connection ( + comp.in (), + connections[i], + add_connection); + break; + + case Deployment::rtecEventConsumer: + this->handle_es_consumer_connection ( + connections[i], + add_connection); + break; + + default: + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch_i: " + "Unsupported event port type encounted\n")); + ACE_TRY_THROW (CORBA::NO_IMPLEMENT ()); } } } @@ -397,13 +192,18 @@ CIAO::NodeApplication_Impl::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Deployment::StartError)) { - Component_Iterator end = this->component_objref_map_.end (); - for (Component_Iterator iter (this->component_objref_map_.begin ()); + Component_Iterator end = this->component_state_map_.end (); + for (Component_Iterator iter (this->component_state_map_.begin ()); iter != end; ++iter) { - ((*iter).int_id_)->ciao_preactivate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + if (((*iter).int_id_).state_ == NEW_BORN) + { + ((*iter).int_id_).objref_->ciao_preactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + + ((*iter).int_id_).state_ = PRE_ACTIVE; } } @@ -412,13 +212,18 @@ CIAO::NodeApplication_Impl::start (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Deployment::StartError)) { - Component_Iterator end = this->component_objref_map_.end (); - for (Component_Iterator iter (this->component_objref_map_.begin ()); + Component_Iterator end = this->component_state_map_.end (); + for (Component_Iterator iter (this->component_state_map_.begin ()); iter != end; ++iter) { - ((*iter).int_id_)->ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + if (((*iter).int_id_).state_ == PRE_ACTIVE) + { + ((*iter).int_id_).objref_->ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + + ((*iter).int_id_).state_ = ACTIVE; } } @@ -427,13 +232,18 @@ CIAO::NodeApplication_Impl::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Deployment::StartError)) { - Component_Iterator end = this->component_objref_map_.end (); - for (Component_Iterator iter (this->component_objref_map_.begin ()); + Component_Iterator end = this->component_state_map_.end (); + for (Component_Iterator iter (this->component_state_map_.begin ()); iter != end; ++iter) { - ((*iter).int_id_)->ciao_postactivate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + if (((*iter).int_id_).state_ == ACTIVE) + { + ((*iter).int_id_).objref_->ciao_postactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ((*iter).int_id_).state_ = POST_ACTIVE; + } } } @@ -442,15 +252,15 @@ CIAO::NodeApplication_Impl::ciao_passivate (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Deployment::StopError)) { - Component_Iterator end = this->component_objref_map_.end (); - for (Component_Iterator iter (this->component_objref_map_.begin ()); + Component_Iterator end = this->component_state_map_.end (); + for (Component_Iterator iter (this->component_state_map_.begin ()); iter != end; ++iter) { - ACE_DEBUG ((LM_DEBUG, "passivating %s\n", - (*iter).ext_id_.c_str ())); - ((*iter).int_id_)->ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ((*iter).int_id_).objref_->ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; + + ((*iter).int_id_).state_ = PASSIVE; } ACE_DEBUG ((LM_DEBUG, "exiting passivate\n")); } @@ -485,20 +295,23 @@ CIAO::NodeApplication_Impl::install ( // @@(GD): The "create_all_containers" mechanism needs to be refined, so // we should always try to reuse existing containers as much as possible! // We need not only factory pattern, but also finder pattern here as well. - if (CIAO::debug_level () > 9) + if (CIAO::debug_level () > 15) { ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) NodeApplication_Impl.cpp -" "CIAO::NodeApplication_Impl::install -" "creating all the containers. \n")); } + + CORBA::ULong old_set_size = this->container_set_.size (); + (void) this->create_all_containers (container_infos); if (CIAO::debug_level () > 9) { ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) NodeApplication_Impl.cpp -" "CIAO::NodeApplication_Impl::install -" - "created all the containers. \n")); + "create_all_containers() called.\n")); } // For each container, invoke operation, this will return @@ -509,8 +322,9 @@ CIAO::NodeApplication_Impl::install ( for (CORBA::ULong i = 0; i < num_containers; ++i) { Deployment::ComponentInfos_var comp_infos = - this->container_set_.at(i)->install (container_infos[i] - ACE_ENV_ARG_PARAMETER); + this->container_set_.at(i+old_set_size)-> + install (container_infos[i] + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Append the return sequence to the *big* return sequence @@ -531,11 +345,15 @@ CIAO::NodeApplication_Impl::install ( len < comp_len; ++len) { + Component_State_Info tmp; + + tmp.state_ = NEW_BORN; + tmp.objref_ = + Components::CCMObject::_duplicate (retv[len].component_ref.in ()); + //Since we know the type ahead of time...narrow is omitted here. - if (this->component_objref_map_.bind ( - retv[len].component_instance_name.in(), - Components::CCMObject::_duplicate (retv[len]. - component_ref.in ()))) + if (this->component_state_map_.rebind ( + retv[len].component_instance_name.in(), tmp)) { ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) NodeApplication_Impl.cpp -" @@ -585,7 +403,7 @@ CIAO::NodeApplication_Impl::remove_component (const char * inst_name // Remove this component instance from the node application ACE_CString name (inst_name); this->component_container_map_.unbind (name); - this->component_objref_map_.unbind (name); + this->component_state_map_.unbind (name); container_ref->remove_component (inst_name); } @@ -657,11 +475,10 @@ CIAO::NodeApplication_Impl::remove (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { // If we still have components installed, then do nothing - if (this->component_objref_map_.current_size () != 0) - { - ACE_DEBUG ((LM_DEBUG, "NA: remove: still have components, doing nothing\n")); - return; - } + + if (this->component_state_map_.current_size () != 0) + return; + // For each container, invoke operation to remove home and components. const CORBA::ULong set_size = this->container_set_.size (); for (CORBA::ULong i = 0; i < set_size; ++i) @@ -691,7 +508,7 @@ CIAO::NodeApplication_Impl::remove (ACE_ENV_SINGLE_ARG_DECL) // Create a container interface, which will be hosted in this NodeApplication. ::Deployment::Container_ptr CIAO::NodeApplication_Impl::create_container ( - const ::Deployment::Properties &properties + const ::Deployment::Properties &properties ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::CreateFailure, @@ -801,6 +618,35 @@ CIAO::NodeApplication_Impl::get_containers (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) return 0; } +::Deployment::CIAO_Event_Services * +CIAO::NodeApplication_Impl:: +install_es (const ::Deployment::ESInstallationInfos & es_infos + ACE_ENV_ARG_DECL) +ACE_THROW_SPEC ((::CORBA::SystemException, + ::Deployment::InstallationFailure)) +{ + Deployment::CIAO_Event_Services_var retv; + ACE_NEW_RETURN (retv, + Deployment::CIAO_Event_Services, + 0); + + CORBA::ULong total_lenth = es_infos.length (); + + for (CORBA::ULong i = 0; i < total_lenth; ++i) + { + CIAO_Event_Service_var temp = + es_factory_.create (es_infos[i].type); + + CORBA::ULong curr_len = retv->length (); + retv->length (curr_len + 1); + + retv[curr_len] = + CIAO::CIAO_Event_Service::_duplicate (temp.in ()); + } + return retv._retn (); +} + + ACE_CString * CIAO::NodeApplication_Impl:: create_connection_key (const Deployment::Connection & connection) @@ -818,3 +664,582 @@ create_connection_key (const Deployment::Connection & connection) return retv; } + + +void +CIAO::NodeApplication_Impl:: +handle_facet_receptable_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + if (CIAO::debug_level () > 11) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch, " + "working on port name [%s] in instance [%s] \n", + connection.portName.in (), + connection.instanceName.in ())); + } + + if (add_connection) + { + ::Components::Cookie_var cookie = + comp->connect (connection.portName.in (), + connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_CString key = (*create_connection_key (connection)); + if (CIAO::debug_level () > 10) + { + ACE_DEBUG ((LM_ERROR, "[BINDING KEY]: %s\n", key.c_str ())); + } + this->cookie_map_.rebind (key, cookie); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } + else + { + ACE_CString key = (*create_connection_key (connection)); + ::Components::Cookie_var cookie; + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); + } + if (this->cookie_map_.find (key, cookie) != 0) + { + ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + comp->disconnect (connection.portName.in (), + cookie.in ()); + this->cookie_map_.unbind (key); + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_emitter_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (consumer.in ())) + { + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection, " + "for port name [%s] in instance [%s] ," + "there is an invalid endPoint. \n", + connection.portName.in (), + connection.instanceName.in ())); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + if (CIAO::debug_level () > 11) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection, " + "working on port name [%s] in instance [%s] \n", + connection.portName.in (), + connection.instanceName.in ())); + } + + if (add_connection) + { + comp->connect_consumer (connection.portName.in (), + consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } + else + { +// Operation not implemented by the CIDLC. +// comp->disconnect_consumer (connection.portName.in (), +// 0 +// ACE_ENV_ARG_PARAMETER); +// ACE_TRY_CHECK; + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_publisher_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (consumer.in ())) + { + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection, " + "for port name [%s] in instance [%s] ," + "there is an invalid endPoint. \n", + connection.portName.in (), + connection.instanceName.in ())); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + if (CIAO::debug_level () > 11) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection, " + "working on port name [%s] in instance [%s] \n", + connection.portName.in (), + connection.instanceName.in ())); + } + + if (add_connection) + { + ::Components::Cookie_var cookie = + comp->subscribe (connection.portName.in (), + consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_CString key = (*create_connection_key (connection)); + this->cookie_map_.rebind (key, cookie); + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } + else // remove the connection + { + ACE_CString key = (*create_connection_key (connection)); + ::Components::Cookie_var cookie; + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); + } + if (this->cookie_map_.find (key, cookie) != 0) + { + ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + comp->unsubscribe (connection.portName.in (), + cookie.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + this->cookie_map_.unbind (key); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_publisher_es_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + if (connection.kind != Deployment::rtecEventPublisher) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_es_connection: " + "Unsupported event connection type\n")); + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + const CIAO::CIAO_Event_Service_ptr event_service = + connection.event_service; + + if (CORBA::is_nil (event_service)) + { + ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // supplier ID + ACE_CString sid (connection.instanceName.in ()); + sid += "_"; + sid += connection.portName.in (); + sid += "_publisher"; + + if (add_connection) + { + ::Components::Cookie_var cookie = + comp->subscribe (connection.portName.in (), + event_service); + + ACE_CString key = (*create_connection_key (connection)); + this->cookie_map_.rebind (key, cookie); + + // Create a supplier_config and register it to ES + CIAO::Supplier_Config_var supplier_config = + event_service->create_supplier_config (); + + supplier_config->supplier_id (sid.c_str ()); + event_service->connect_event_supplier (supplier_config.in ()); + supplier_config->destroy (); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_es_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } + else // remove the connection + { + ACE_CString key = (*create_connection_key (connection)); + ::Components::Cookie_var cookie; + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); + } + if (this->cookie_map_.find (key, cookie) != 0) + { + ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + comp->unsubscribe (connection.portName.in (), + cookie.in ()); + this->cookie_map_.unbind (key); + event_service->disconnect_event_supplier (sid.c_str ()); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_es_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_es_consumer_connection ( + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + if (connection.kind != Deployment::rtecEventConsumer) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_es_consumer_connection: " + "Unsupported event connection type\n")); + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Get ES object + const CIAO::CIAO_Event_Service_ptr event_service = + connection.event_service; + + if (CORBA::is_nil (event_service)) + { + ACE_DEBUG ((LM_ERROR, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_es_consumer_connection: " + "NIL event_service\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // Get consumer object + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in ()); + + if (CORBA::is_nil (consumer.in ())) + { + ACE_DEBUG ((LM_ERROR, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_es_consumer_connection: " + "Nil consumer port object reference\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // supplier ID + ACE_CString sid (connection.instanceName.in ()); + sid += "_"; + sid += connection.portName.in (); + sid += "_publisher"; + + // consumer ID + ACE_CString cid (connection.endpointInstanceName.in ()); + cid += "_"; + cid += connection.endpointPortName.in (); + cid += "_consumer"; + + if (add_connection) + { + CIAO::Consumer_Config_var consumer_config = + event_service->create_consumer_config (); + + consumer_config->supplier_id ("Hello-Sender-idd_click_out_publisher"); + //consumer_config->supplier_id (sid.c_str ()); + consumer_config->consumer_id (cid.c_str ()); + consumer_config->consumer (consumer.in ()); + + // Need to setup a filter, if it's specified in the descriptor + for (CORBA::ULong i = 0; i < connection.config.length (); ++i) + { + if (ACE_OS::strcmp (connection.config[i].name.in (), + "EventFilter") != 0) + continue; + + // Extract the filter information + CIAO::DAnCE::EventFilter *filter = 0; + connection.config[i].value >>= filter; + + CORBA::ULong size = (*filter).sources.length (); + consumer_config->start_disjunction_group (size); + + for (CORBA::ULong j = 0; j < size; ++j) + { + consumer_config->insert_source ((*filter).sources[j].in ()); + } + } + + event_service->connect_event_consumer (consumer_config.in ()); + consumer_config->destroy (); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_es_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.endpointInstanceName.in (), + connection.endpointPortName.in (), + connection.instanceName.in (), + connection.portName.in ())); + } + } + else // remove the connection + { + event_service->disconnect_event_consumer (cid.c_str ()); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_es_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.endpointInstanceName.in (), + connection.endpointPortName.in (), + connection.instanceName.in (), + connection.portName.in ())); + } + } +} + +// Below code is not used at this time. +void +CIAO::NodeApplication_Impl::build_event_connection ( + const Deployment::Connection & connection, + bool add_or_remove + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((Deployment::InvalidConnection, + CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, "CIAO::NodeApplication_Impl::build_connection ()!!!\n")); + + ACE_DEBUG ((LM_DEBUG, "instanceName: %s\n", connection.instanceName.in ())); + ACE_DEBUG ((LM_DEBUG, "portName: %s\n", connection.portName.in ())); + + ACE_DEBUG ((LM_DEBUG, "consumer Component Name: %s\n", connection.endpointInstanceName.in ())); + ACE_DEBUG ((LM_DEBUG, "consumer Port Name: %s\n", connection.endpointPortName.in ())); + + ACE_DEBUG ((LM_DEBUG, "portkind: ")); + switch (connection.kind) { + case Deployment::Facet: ACE_DEBUG ((LM_DEBUG, "Facet\n")); break; + case Deployment::SimplexReceptacle: ACE_DEBUG ((LM_DEBUG, "SimplexReceptacle\n")); break; + case Deployment::MultiplexReceptacle: ACE_DEBUG ((LM_DEBUG, "MultiplexReceptacle\n")); break; + case Deployment::EventEmitter: ACE_DEBUG ((LM_DEBUG, "EventEmitter\n")); break; + case Deployment::EventPublisher: ACE_DEBUG ((LM_DEBUG, "EventPublisher\n")); break; + case Deployment::EventConsumer: ACE_DEBUG ((LM_DEBUG, "EventConsumer\n")); break; + default: + ACE_DEBUG ((LM_DEBUG, "Unknow\n")); break; + } + + const CIAO::CIAO_Event_Service_ptr event_service = + connection.event_service; + + + // Get the consumer port object reference and put it into "consumer" + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (consumer.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Nil consumer port object reference\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // Get the supplier component object reference. + ACE_CString supplier_comp_name = connection.instanceName.in (); + + ACE_DEBUG ((LM_DEBUG, "source component name is: %s\n", supplier_comp_name.c_str ())); + Component_State_Info comp_state; + if (this->component_state_map_.find (supplier_comp_name, comp_state) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Nil source component object reference\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // Get the consumer component object reference. + ACE_CString consumer_comp_name = connection.endpointInstanceName.in (); + + ACE_DEBUG ((LM_DEBUG, "consumer component name is: %s\n", consumer_comp_name.c_str ())); + + if (CORBA::is_nil (event_service)) + { + ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // supplier ID + ACE_CString sid (connection.instanceName.in ()); + sid += "_"; + sid += connection.portName.in (); + sid += "_publisher"; + + // consumer ID + ACE_CString cid (connection.endpointInstanceName.in ()); + cid += "_"; + cid += connection.endpointPortName.in (); + cid += "_consumer"; + + //ACE_DEBUG ((LM_DEBUG, "Publisher: %s\n", sid.c_str ())); + ACE_DEBUG ((LM_DEBUG, "Subscriber: %s\n", cid.c_str ())); + + + if (add_or_remove == true) + { + CIAO::Supplier_Config_var supplier_config = + event_service->create_supplier_config (); + + //supplier_config->supplier_id (sid.c_str ()); + event_service->connect_event_supplier (supplier_config.in ()); + supplier_config->destroy (); + + CIAO::Consumer_Config_var consumer_config = + event_service->create_consumer_config (); + + //@@@ + consumer_config->supplier_id ("dummy"); + consumer_config->consumer_id (cid.c_str ()); + consumer_config->consumer (consumer.in ()); + + event_service->connect_event_consumer (consumer_config.in ()); + + consumer_config->destroy (); + } + else + { + event_service->disconnect_event_supplier (sid.c_str ()); + event_service->disconnect_event_consumer (cid.c_str ()); + } + + ACE_DEBUG ((LM_DEBUG, "CIAO::NodeApplication_Impl::build_connection () completed!!!!\n")); +} diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h index bcf5813c474..d1c14c43baa 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h @@ -1,4 +1,5 @@ //$Id$ + /**======================================================== * * @file NodeApplication_Impl.h @@ -20,15 +21,18 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ciao/Deployment_CoreS.h" -#include "ciao/Server_init.h" -#include "ciao/CIAO_common.h" -#include "ciao/Object_Set_T.h" -#include "tao/ORB.h" #include "ace/Synch.h" #include "ace/Synch_Traits.h" #include "ace/SString.h" #include "ace/Hash_Map_Manager_T.h" +#include "tao/ORB.h" +#include "ciao/Deployment_CoreS.h" +#include "ciao/Server_init.h" +#include "ciao/CIAO_common.h" +#include "ciao/Object_Set_T.h" +#include "ciaosvcs/Events/CIAO_EventService_Factory_impl.h" +#include "ciaosvcs/Events/CIAO_Events_Base/CIAO_EventsS.h" + #include "NodeApp_Configurator.h" #include "Container_Base.h" @@ -62,6 +66,17 @@ namespace CIAO : public virtual POA_Deployment::NodeApplication { public: + enum Component_State + { + NEW_BORN, PRE_ACTIVE, ACTIVE, POST_ACTIVE, PASSIVE, DEACTIVATED + }; + + typedef struct _component_state_info + { + Components::CCMObject_var objref_; + Component_State state_; + } Component_State_Info; + NodeApplication_Impl (CORBA::ORB_ptr o, PortableServer::POA_ptr p, NodeApp_Configurator &c, @@ -83,7 +98,7 @@ namespace CIAO * However the name field stores the name of the port on the local component. */ virtual void - finishLaunch (const Deployment::Connections & providedReference, + finishLaunch (const Deployment::Connections & connections, CORBA::Boolean start, CORBA::Boolean add_connection ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -141,6 +156,13 @@ namespace CIAO ::Deployment::InstallationFailure, ::Components::InvalidConfiguration)); + /// Install a number of CIAO_Event_Service objects within the NA + virtual ::Deployment::CIAO_Event_Services * + install_es (const ::Deployment::ESInstallationInfos & es_infos + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((::CORBA::SystemException, + ::Deployment::InstallationFailure)); + /// Get the object reference of the NodeApplicationManager. /// This might come in handy later. virtual ::CORBA::Object_ptr @@ -204,9 +226,28 @@ namespace CIAO ::Deployment::NodeApplication_ptr get_objref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + /*------- CIAO helper functions for pub/sub service ------- + * + *--------------------------------------------------------*/ + + /// Set up a connection using the CIAO_Event_Service, which + /// is available as a field in the + /// struct type. + /// If input parameter is true, then we will + /// add the event connection, otherwise we will remove the + /// event connection. + void build_event_connection ( + const Deployment::Connection & connection, + bool add_or_remove + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((Deployment::InvalidConnection, + CORBA::SystemException)); + protected: + /// If is "false", then we shall "remove" + /// the connections, otherwise we will add these connections. virtual void - finishLaunch_i (const Deployment::Connections & providedReference, + finishLaunch_i (const Deployment::Connections & connections, CORBA::Boolean start, CORBA::Boolean add_connection ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -214,6 +255,49 @@ namespace CIAO Deployment::StartError, Deployment::InvalidConnection)); + virtual void + handle_facet_receptable_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + virtual void + handle_emitter_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + virtual void + handle_publisher_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + /// Register the publisher to the CIAO event service + /// The only fields of struct used in this method + /// are: , , , . + virtual void + handle_publisher_es_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + /// Register the consumer to the CIAO event service + virtual void + handle_es_consumer_connection ( + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + /// Create and initialize all the containers virtual CORBA::Long create_all_containers ( const ::Deployment::ContainerImplementationInfos & container_infos @@ -234,14 +318,15 @@ namespace CIAO Component_Container_Map component_container_map_; - /// To store all created Component object. + /// To store all created Component objects as well as their lifecycle + /// states.. typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> CCMComponent_Map; typedef CCMComponent_Map::iterator Component_Iterator; - CCMComponent_Map component_objref_map_; + CCMComponent_Map component_state_map_; /// A Map which stores all the connection cookies typedef ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex> ES_Installation_Map; + typedef ES_Installation_Map::iterator ES_Installation_Map_Iterator; + ES_Installation_Map es_info_map_; + const Static_Config_EntryPoints_Maps* static_entrypts_maps_; private: /// Default constructor, noop diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl index 49e9881ac54..b041af3b9f1 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl @@ -13,6 +13,7 @@ NodeApplication_Impl (CORBA::ORB_ptr o, : orb_ (CORBA::ORB::_duplicate (o)), poa_ (PortableServer::POA::_duplicate (p)), configurator_ (c), + es_factory_ (o, p), static_entrypts_maps_ (static_entrypts_maps) { } diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp index 24a2349a66c..d0352784e5e 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp @@ -1,4 +1,5 @@ // $Id$ + #include "Containers_Info_Map.h" #include "ciao/CIAO_Config.h" #include "ciao/CIAO_common.h" @@ -127,6 +128,10 @@ namespace CIAO for (j = 0; j < infoProperty_length; ++j) { + if (ACE_OS::strcmp (this->plan_.infoProperty[j].name.in (), + "CIAOServerResources") != 0) + continue; + CIAO::DAnCE::ServerResource *server_resource_def = 0; this->plan_.infoProperty[j].value >>= server_resource_def; diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp index c4f6b37c963..88c6769eee9 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp @@ -7,7 +7,7 @@ CIAO::NodeImplementationInfoHandler:: NodeImplementationInfoHandler (::Deployment::DeploymentPlan & plan, - const Deployment::ComponentPlans & shared_components) : + const Deployment::ComponentPlans & shared_components) : plan_ (plan), node_info_ (0), containers_info_map_ (plan, shared_components) diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h index f0a103fdad5..475802f3d1a 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h @@ -37,8 +37,9 @@ namespace CIAO class CIAO_NAM_Export NodeImplementationInfoHandler { public: - NodeImplementationInfoHandler (::Deployment::DeploymentPlan & plan, - const Deployment::ComponentPlans & shared_components); + NodeImplementationInfoHandler ( + const ::Deployment::DeploymentPlan & plan, + const Deployment::ComponentPlans & shared_components); Deployment::NodeImplementationInfo * node_impl_info (void) const; diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc index 9ceae6ca738..647de59bb17 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(NodeApplicationManager): ciao_component_dnc, ciao_deployment_svnt, dance_extension_stub { +project(NodeApplicationManager): ciao_server_dnc, ciao_deployment_svnt, dance_extension_stub { sharedname = NodeApplicationManager after += NodeManager_stub CIAO_TargetManager_stub diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp index 3c5744cd3e6..53a1484454b 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp @@ -2,9 +2,11 @@ #include "NodeApplicationManager_Impl.h" #include "ace/Process.h" - +#include "ace/Process_Manager.h" +#include "ace/Reactor.h" #include "ace/OS_NS_stdio.h" #include "ace/Sched_Params.h" +#include "ace/Vector_T.h" #include "ciao/Container_Base.h" #include "NodeApplication/NodeApplication_Impl.h" #include "ace/Reactor.h" @@ -75,20 +77,27 @@ create_connections (ACE_ENV_SINGLE_ARG_DECL) // Get all the facets first Components::FacetDescriptions_var facets; - if (is_shared_component (comp_name)) - { - ACE_DEBUG ((LM_DEBUG, "NAMImpl::create_connections: Componsnt %s is shared\n", - comp_name.c_str ())); - facets = this->node_manager_->get_all_facets (comp_name); - } - else - { - ACE_DEBUG ((LM_DEBUG, "NAMImpl::create_connections: Component %s is not shared, getting and setting" - "all facets\n", - comp_name.c_str ())); - facets = ((*iter).int_id_)->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); - this->node_manager_->set_all_facets (comp_name, facets); - } + if (CIAO::debug_level () > 20) + { + ACE_DEBUG ((LM_DEBUG, + "DAnCE (%P|%t) NodeApplicationManager_Impl.cpp -" + "CIAO::NodeApplicationManager_Impl::create_connections -" + "success getting facets for the component " + "instance [%s] \n", + comp_name.c_str ())); + } + + // Get all the event consumers + Components::ConsumerDescriptions_var consumers; + + if (is_shared_component (comp_name)) + consumers = this->node_manager_->get_all_consumers (comp_name); + else + { + consumers = + ((*iter).int_id_)->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + this->node_manager_->set_all_consumers (comp_name, consumers); + } if (CIAO::debug_level () > 9) { @@ -229,10 +238,46 @@ startLaunch (const Deployment::Properties & configProperty, "Unable to get node level infos")); } + CIAO::DAnCE::ServerResource *server_resource = 0; + for (CORBA::ULong k = 0; k < node_info->nodeapp_config.length (); ++k) + { + if (ACE_OS::strcmp (node_info->nodeapp_config[k].name.in (), + "CIAOServerResources") == 0) + { + node_info->nodeapp_config[0].value >>= server_resource; + break; // Ignore the rest of the NodeApp_Config values + } + } + // Now spawn the NodeApplication process. - // @@TODO: we need to pass arguments to the nodeapplication, ie naming service endpoints, if necessary + // @@TODO: we need to pass arguments to the nodeapplication, ie + // naming service endpoints, if necessary // (will) ACE_CString cmd_option (this->nodeapp_command_op_.in ()); + + if (server_resource) + { + // If command line options are specified through RTCCM descriptors, + // then we should honor these command line options as well. + for (CORBA::ULong arg_i = 0; + arg_i < (*server_resource).args.length (); + ++arg_i) + { + cmd_option += " "; // space between command line args + cmd_option += (*server_resource).args[arg_i].in (); + } + + // If service configuration file is specified through RTCCM + // descriptors, then we should honor it as well. + if (ACE_OS::strcmp ((*server_resource).svcconf.in (), + "") != 0) + { + cmd_option += " -ORBSvcConf "; + cmd_option += (*server_resource).svcconf.in (); + } + } + + Deployment::NodeApplication_var tmp = create_node_application (cmd_option.c_str () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -353,6 +398,7 @@ Deployment::Application_ptr CIAO::NodeApplicationManager_Impl_Base:: perform_redeployment (const Deployment::Properties & configProperty, Deployment::Connections_out providedReference, + CORBA::Boolean add_or_remove, // true means "add" only CORBA::Boolean start ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((::CORBA::SystemException, @@ -381,7 +427,7 @@ perform_redeployment (const Deployment::Properties & configProperty, // // // (1) If this is an brand new NAM, then only new installation is needed. - // (2) Then we coudl pretty much clone the "startLaunch" implementation. + // (2) Then we could pretty much replicate the "startLaunch" implementation. // This capability is useful to install a set of new components into // some totally new nodes. @@ -422,14 +468,7 @@ perform_redeployment (const Deployment::Properties & configProperty, if (!node_info) { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) NodeApplicationManager.cpp -" - "CIAO::NodeApplicationManager_Impl::perform_redeployment -" - "Failed to create Node Implementation Infos!\n")); - - ACE_TRY_THROW - (Deployment::PlanError ("NodeApplicationManager_Imp::perform_redeployment", - "Unable to get node level infos")); + this->add_new_components (); } // Install the components @@ -470,12 +509,9 @@ perform_redeployment (const Deployment::Properties & configProperty, { ACE_TRY_THROW (Deployment::InstallationFailure - ("NodeApplicationManager_Impl::startLaunch", - "Error creating connections during startLaunch.")); + ("NodeApplicationManager_Impl::startLaunch", + "Error creating connections during startLaunch.")); } - // @@TODO - // Do an iteration over the , for those components that - // are not in the "new plan", we should remove them. } else // This is a new NodeApplication process, then we need to install // all the components. We should try to reuse much of the above code. @@ -512,10 +548,157 @@ perform_redeployment (const Deployment::Properties & configProperty, } +void +CIAO::NodeApplicationManager_Impl_Base:: +add_new_components () + ACE_THROW_SPEC ((CORBA::SystemException, + ::Deployment::PlanError, + ::Deployment::InstallationFailure, + ::Deployment::UnknownImplId, + ::Deployment::ImplEntryPointNotFound, + ::Deployment::InvalidConnection, + ::Deployment::InvalidProperty)) +{ + ACE_TRY + { + // We ignored those components that are already in the , for + // the rest ones, we pack them into NodeImplementationInfo. + Deployment::DeploymentPlan tmp_plan = this->plan_; + tmp_plan.instance.length (0); + + const CORBA::ULong length = this->plan_.instance.length (); + for (CORBA::ULong i = 0; i < length; ++i) + { + // add the new components into the tmp_plan + if (this->component_map_.find (this->plan_.instance[i].name.in ()) != 0) + { + CORBA::ULong cur_len = tmp_plan.instance.length (); + tmp_plan.instance.length (cur_len + 1); + tmp_plan.instance[cur_len] = this->plan_.instance[i]; + } + } + + // If there are no new components to be installed ... + if (tmp_plan.instance.length () == 0) + return; + + // package the components + NodeImplementationInfoHandler handler (tmp_plan, + this->shared_components_); + Deployment::NodeImplementationInfo * node_info = + handler.node_impl_info (); + + if (!node_info) + { + ACE_ERROR ((LM_ERROR, + "DAnCE (%P|%t) NodeApplicationManager.cpp -" + "CIAO::NodeApplicationManager_Impl::perform_redeployment -" + "Failed to create Node Implementation Infos!\n")); + + ACE_TRY_THROW + (Deployment::PlanError ("NodeApplicationManager_Imp::perform_redeployment", + "Unable to get node level infos")); + } + + // Install the components + // This is what we will get back, a sequence of component object refs. + Deployment::ComponentInfos_var comp_info; + comp_info = this->nodeapp_->install (*node_info ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Now fill in the map we have for the components. + const CORBA::ULong comp_len = comp_info->length (); + for (CORBA::ULong len = 0; + len < comp_len; + ++len) + { + //Since we know the type ahead of time...narrow is omitted here. + if (this->component_map_. + bind (comp_info[len].component_instance_name.in(), + Components::CCMObject::_duplicate + (comp_info[len].component_ref.in()))) + { + ACE_CString error ("Duplicate component instance name "); + error += comp_info[len].component_instance_name.in(); + + ACE_TRY_THROW + (Deployment::PlanError + ("NodeApplicationManager_Impl::startLaunch", + error.c_str ())); + } + } + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_ERROR, "NodeApplicationManager_Impl_Base::" + "add_new_components () exception caught.\n")); + ACE_RE_THROW; + } + ACE_ENDTRY; +} + + +void +CIAO::NodeApplicationManager_Impl_Base:: +remove_existing_components () + ACE_THROW_SPEC ((CORBA::SystemException, + ::Deployment::PlanError, + ::Components::RemoveFailure)) +{ + ACE_TRY + { + ACE_Vector gone_component_list; + + for (Component_Iterator iter (this->component_map_.begin ()); + iter != this->component_map_.end (); + ++iter) + { + ACE_CString comp_name ((*iter).ext_id_.c_str ()); + + // If this component is not in the new deployment plan, then we + // should destroy this component and unbind from the map. + if (this->is_to_be_removed (comp_name.c_str ())) + { + ((*iter).int_id_)->ciao_passivate (); + this->nodeapp_->remove_component (comp_name.c_str ()); + gone_component_list.push_back (comp_name); + } + } + + for (size_t i = 0; i < gone_component_list.size (); ++i) + this->component_map_.unbind (gone_component_list[i]); + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_ERROR, "NodeApplicationManager_Impl_Base::" + "remove_existing_components () exception caught.\n")); + ACE_RE_THROW; + } + ACE_ENDTRY; +} + +bool +CIAO::NodeApplicationManager_Impl_Base:: +is_to_be_removed (const char * name) +{ + const CORBA::ULong length = this->plan_.instance.length (); + for (CORBA::ULong i = 0; i < length; ++i) + { + if (ACE_OS::strcmp (name, + this->plan_.instance[i].name.in ()) == 0) + { + // If we have found it in the new plan, then this component + // needs to be kept, and should not be removed. + return false; + } + } + return true; +} + void CIAO::NodeApplicationManager_Impl_Base:: set_shared_components (const Deployment::ComponentPlans & shared - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((::CORBA::SystemException)) { this->shared_components_ = shared; @@ -558,9 +741,7 @@ destroyApplication (Deployment::Application_ptr app // us even if this is not within this NAM. if (! this->is_external_component (name)) { - ACE_DEBUG ((LM_DEBUG, "NAM: contacting nodeapp\n")); this->nodeapp_->remove_component (name.c_str ()); - ACE_DEBUG ((LM_DEBUG, "NAM: nodeapp contacted\n")); this->component_map_.unbind (name); } } @@ -787,6 +968,9 @@ create_node_application (const ACE_CString & options ACE_CHECK_RETURN (Deployment::NodeApplication::_nil()); ACE_Process_Options p_options; + ACE_Process_Manager process_manager; + + process_manager.open (10, ACE_Reactor::instance ()); ACE_TRY { @@ -836,8 +1020,7 @@ create_node_application (const ACE_CString & options // wait for nodeApp to pass back its object reference. with a // timeout value. using perform_work and stuff. - - int looping = 1; + bool looping = true; ACE_Time_Value timeout (this->spawn_delay_, 0); @@ -850,7 +1033,7 @@ create_node_application (const ACE_CString & options retval = callback_servant->get_nodeapp_ref (); if (timeout == ACE_Time_Value::zero || !CORBA::is_nil (retval.in ())) - looping = 0; + looping = false; } if (CORBA::is_nil (retval.in ())) diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h index d133ed64fb2..498069f0299 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.h @@ -7,6 +7,7 @@ * @file NodeApplicationManager_Impl.h * * @author Tao Lu + * @author Gan Deng * * This file contains implementation for the servant of * Deployment::NodeApplicationManager. @@ -29,7 +30,7 @@ #include "ace/OS_NS_sys_wait.h" #include "ace/Process_Manager.h" #include "ciao/NodeApp_CB_Impl.h" -#include "ciao/DeploymentS.h" +#include "ciao/NodeApplicationManagerS.h" #include "ciao/CIAO_common.h" #include "CIAO_NAM_Export.h" #include "ImplementationInfo.h" @@ -79,6 +80,7 @@ namespace CIAO virtual Deployment::Application_ptr perform_redeployment (const Deployment::Properties & configProperty, Deployment::Connections_out providedReference, + CORBA::Boolean add_or_remove, CORBA::Boolean start ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((::CORBA::SystemException, @@ -156,6 +158,29 @@ namespace CIAO /// Destructor virtual ~NodeApplicationManager_Impl_Base (void); + /// Add new components + virtual void + add_new_components (void) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Deployment::PlanError, + ::Deployment::InstallationFailure, + ::Deployment::UnknownImplId, + ::Deployment::ImplEntryPointNotFound, + ::Deployment::InvalidConnection, + ::Deployment::InvalidProperty)); + + /// Remove existing components + virtual void + remove_existing_components (void) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Deployment::PlanError, + ::Components::RemoveFailure)); + + /// Determine whether a component is absent in the new_plan + /// Return true if absent + virtual bool + is_to_be_removed (const char * name); + /// Internal help function to create new NodeApplicationProcess virtual Deployment::NodeApplication_ptr create_node_application (const ACE_CString & options diff --git a/TAO/CIAO/DAnCE/NodeManager/Monitor.mpc b/TAO/CIAO/DAnCE/NodeManager/Monitor.mpc index d082a5ecd3c..b4f5f55cd31 100644 --- a/TAO/CIAO/DAnCE/NodeManager/Monitor.mpc +++ b/TAO/CIAO/DAnCE/NodeManager/Monitor.mpc @@ -3,7 +3,7 @@ // MPC file for the Monitor -project(*monitorlib): ciao_client_dnc{ +project(*monitorlib): ciao_client_dnc, ciao_events_base_dnc { after += CIAO_TargetManager_stub includes += $(CIAO_ROOT)/DAnCE/TargetManager sharedname = ciaomonlib diff --git a/TAO/CIAO/DAnCE/NodeManager/MonitorController.cpp b/TAO/CIAO/DAnCE/NodeManager/MonitorController.cpp index dd1c987a434..ecf2460915c 100644 --- a/TAO/CIAO/DAnCE/NodeManager/MonitorController.cpp +++ b/TAO/CIAO/DAnCE/NodeManager/MonitorController.cpp @@ -1,4 +1,5 @@ // $Id$ + //---------------------------------------------------------------------------------- /** * @file MonitorController.cpp @@ -81,7 +82,7 @@ int CIAO::MonitorController::svc (void) "dll.symbol"), -1); { - ACE_TRACE ((LM_DEBUG "Inside the init call\n")); + ACE_TRACE ((LM_DEBUG, "Inside the init call\n")); // here creating the monitor object monitor_.reset ((MonitorBase*) factory ()); diff --git a/TAO/CIAO/DAnCE/NodeManager/MonitorController.h b/TAO/CIAO/DAnCE/NodeManager/MonitorController.h index 9a02042022b..83714d682ef 100644 --- a/TAO/CIAO/DAnCE/NodeManager/MonitorController.h +++ b/TAO/CIAO/DAnCE/NodeManager/MonitorController.h @@ -1,4 +1,5 @@ // $Id$ + //--------------------------------------------------------------------------------- /** * @file MonitorController.h diff --git a/TAO/CIAO/DAnCE/NodeManager/NAM_Map.h b/TAO/CIAO/DAnCE/NodeManager/NAM_Map.h index 469a3341045..a3a6a7def5f 100644 --- a/TAO/CIAO/DAnCE/NodeManager/NAM_Map.h +++ b/TAO/CIAO/DAnCE/NodeManager/NAM_Map.h @@ -13,15 +13,16 @@ #include /**/ "ace/pre.h" -#include "ace/Null_Mutex.h" -#include "ace/Hash_Map_Manager.h" -#include "ciao/DeploymentC.h" -#include "ace/SString.h" #include "tao/PortableServer/PortableServer.h" + #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Null_Mutex.h" +#include "ace/Hash_Map_Manager.h" +#include "ace/SString.h" + namespace CIAO { /** diff --git a/TAO/CIAO/DAnCE/NodeManager/NodeManager.mpc b/TAO/CIAO/DAnCE/NodeManager/NodeManager.mpc index 192fe6f31f0..01b11fa563a 100644 --- a/TAO/CIAO/DAnCE/NodeManager/NodeManager.mpc +++ b/TAO/CIAO/DAnCE/NodeManager/NodeManager.mpc @@ -2,7 +2,7 @@ // $Id$ //For static D&C, the NodeManager should be available as a linkable library -project(NodeManager_svnt): ciao_component_dnc, iortable, ifr_client, dance_extension_stub { +project(NodeManager_svnt): ciao_component_dnc, ciao_deployment_svnt, iortable, ifr_client, dance_extension_stub, ciao_server_dnc { sharedname = NodeManager after += NodeApplicationManager NodeManager_stub CIAO_TargetManager_stub NoOp_Configurator libs += NodeManager_stub NodeApplicationManager TargetManager_stub CIAO_NoOp_Configurator @@ -13,7 +13,7 @@ project(NodeManager_svnt): ciao_component_dnc, iortable, ifr_client, dance_exten } Source_Files { - ../Interfaces/NodeManagerS.cpp + ../Interfaces/NodeManagerDaemonS.cpp NodeManager_Impl.cpp NAM_Map.cpp MonitorController.cpp @@ -21,9 +21,9 @@ project(NodeManager_svnt): ciao_component_dnc, iortable, ifr_client, dance_exten } } -project(NodeManager): ciao_component_dnc, iortable, ifr_client, dance_extension_stub { +project(NodeManager): ciao_server_dnc, iortable, ifr_client, dance_extension_stub { after += NodeApplicationManager NodeManager_stub CIAO_TargetManager_stub NodeManager_svnt - libs += NodeManager_stub NodeManager NodeApplicationManager TargetManager_stub + libs += NodeManager_stub NodeManager NodeApplicationManager TargetManager_stub CIAO_NoOp_Configurator includes += $(CIAO_ROOT)/ciao $(CIAO_ROOT)/DAnCE/TargetManager exename = NodeManager diff --git a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp index 052b5bdbfc0..5717357244c 100644 --- a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp @@ -226,9 +226,11 @@ set_all_consumers (ACE_CString &name, this->comp_consumers_map_.rebind (name, consumers); } + Deployment::NodeApplicationManager_ptr -CIAO::NodeManager_Impl_Base::preparePlan (const Deployment::DeploymentPlan &plan - ACE_ENV_ARG_DECL) +CIAO::NodeManager_Impl_Base:: +preparePlan (const Deployment::DeploymentPlan &plan + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Deployment::StartError, Deployment::PlanError)) @@ -261,7 +263,15 @@ CIAO::NodeManager_Impl_Base::preparePlan (const Deployment::DeploymentPlan &plan } else { - // Increase the ref count by 1 + // If the instance is within the same deployment plan, e.g., + // when ReDaC service is used, then just do nothing since it is NOT + // actually a shared component at all. + if (ACE_OS::strcmp (plan.UUID.in (), + entry->int_id_.plan_uuid_.c_str ()) == 0) + continue; + + // Otherwise, it is really a shared component, so let's increase + // the ref count by 1 this->shared_components_.insert (plan.instance[i].name.in ()); ++ entry->int_id_.count_; } @@ -481,13 +491,12 @@ destroyPlan (const Deployment::DeploymentPlan & plan // Reset each NAM about the shared components information Deployment::ComponentPlans_var shared = this->get_shared_components_i (); - ACE_DEBUG ((LM_DEBUG, "contacting the nams - set shared components\n")); - nam->set_shared_components (shared.inout ()); - ACE_DEBUG ((LM_DEBUG, "contacting the nams destroyApplication\n")); - nam->destroyApplication (0); + nam->set_shared_components (shared.in ()); + + nam->destroyApplication (0); - // The problem is that we should NOT actually kill the NA process if + // @@ The problem is that we should NOT actually kill the NA process if // there are some components that are shared by other plans. } diff --git a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h index 1003f18327e..6881a53c1e2 100644 --- a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h +++ b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h @@ -22,7 +22,7 @@ #define CIAO_NODEMANAGER_IMPL_H #include /**/ "ace/pre.h" -#include "Interfaces/NodeManagerS.h" +#include "Interfaces/NodeManagerDaemonS.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -48,11 +48,11 @@ namespace CIAO * @brief Servant implementation CIAO's daemon process control * interface * - * This class implements the CIAO:NodeManager interface. + * This class implements the CIAO:NodeManagerDaemon interface. * */ class NodeManager_svnt_Export NodeManager_Impl_Base - : public virtual POA_CIAO::NodeManager + : public virtual POA_CIAO::NodeManagerDaemon { public: /// A struct that tracks the reference count of a particular diff --git a/TAO/CIAO/DAnCE/NodeManager/Node_Manager.cpp b/TAO/CIAO/DAnCE/NodeManager/Node_Manager.cpp index 4c3684f5d3c..5cad11e47b9 100644 --- a/TAO/CIAO/DAnCE/NodeManager/Node_Manager.cpp +++ b/TAO/CIAO/DAnCE/NodeManager/Node_Manager.cpp @@ -126,7 +126,7 @@ write_pid (void) bool register_with_ns (const char * name_context, CORBA::ORB_ptr orb, - CIAO::NodeManager_ptr obj + CIAO::NodeManagerDaemon_ptr obj ACE_ENV_ARG_DECL) { // Naming Service related operations @@ -223,7 +223,7 @@ main (int argc, char *argv[]) node_manager_servant->init (); // Implicit activation - CIAO::NodeManager_var node_manager = + CIAO::NodeManagerDaemon_var node_manager = node_manager_servant->_this (); CORBA::String_var str = diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp index 5d2978c7ce5..141e1ff7e9a 100644 --- a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp +++ b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp @@ -1,11 +1,12 @@ // $Id$ + #include "Plan_Launcher_Impl.h" #include "ace/OS.h" #include "ace/Get_Opt.h" #include -#include "Interfaces/ExecutionManagerC.h" +#include "DAnCE/Interfaces/ExecutionManagerDaemonC.h" namespace CIAO { diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc index 41a34263764..391912025b4 100644 --- a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc +++ b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(Plan_Launcher_Impl) : ciao_component_dnc, ciao_config_handlers { +project(Plan_Launcher_Impl) : ciao_servant_dnc, ciao_config_handlers { sharedname = Plan_Launcher_Impl after += ExecutionManager_stub libs += ExecutionManager_stub @@ -19,7 +19,7 @@ project(Plan_Launcher_Impl) : ciao_component_dnc, ciao_config_handlers { } } -project(Plan_Launcher) : ciao_component_dnc, taoexe, ciao_config_handlers { +project(Plan_Launcher) : ciao_server_dnc, ciao_config_handlers { exename = plan_launcher after += Plan_Launcher_Impl diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h index 371d7eb2f19..e91711332d4 100644 --- a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h +++ b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h @@ -12,8 +12,8 @@ #include "Plan_Launcher_Impl_Export.h" #include "ciao/DeploymentS.h" #include "ciao/CIAO_common.h" -#include "ExecutionManager/DAM_Map.h" -#include "Interfaces/ExecutionManagerC.h" +#include "DAnCE/ExecutionManager/DAM_Map.h" +#include "DAnCE/Interfaces/ExecutionManagerDaemonC.h" namespace CIAO { diff --git a/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.cpp b/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.cpp index 4cba063e6d4..854a98b7e1a 100644 --- a/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.cpp +++ b/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.cpp @@ -1,12 +1,11 @@ // $Id$ #include "ciao/NodeApplication_CallBackC.h" -#include "NodeApplication_Task.h" -#include "tao/RTPortableServer/RTPortableServer.h" -#include "RTServer_Impl.h" -#include "ace/Null_Mutex.h" #include "ciao/CIAO_common.h" #include "tao/RTPortableServer/RTPortableServer.h" +#include "ace/Null_Mutex.h" +#include "NodeApplication_Task.h" +#include "RTServer_Impl.h" #if !defined (__ACE_INLINE__) # include "NodeApplication_Task.inl" @@ -89,8 +88,8 @@ CIAO::NodeApplication_Task::svc () { ACE_DEBUG ((LM_DEBUG, "NodeApplication Failed on creating and\ initializing the session container!")); - return 1; - } + return 1; + } CORBA::String_var str = this->orb_->object_to_string (nodeapp_obj.in () ACE_ENV_ARG_PARAMETER); diff --git a/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.h b/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.h index 5b14a2b5ab5..521dd9a4806 100644 --- a/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.h +++ b/TAO/CIAO/DAnCE/RTNodeApplication/NodeApplication_Task.h @@ -36,7 +36,7 @@ namespace CIAO * @brief An ACE_Task subclass that manages the RT-ORB therad */ class NodeApplication_Task - : public virtual ACE_Task_Base + : public ACE_Task_Base { public: // We can add a rt-task configuration facility here. diff --git a/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater.h b/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater.h index b9d8a1cb7cf..4396ee22621 100644 --- a/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater.h +++ b/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater.h @@ -1,4 +1,3 @@ - /* -*- C++ -*- */ //======================================================================== diff --git a/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp b/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp index f1b53537735..01fd77a797d 100644 --- a/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp +++ b/TAO/CIAO/DAnCE/RepositoryManager/PC_Updater_T.cpp @@ -1,4 +1,5 @@ // $Id$ + #ifndef PC_UPDATER_T_C #define PC_UPDATER_T_C #include "PC_Updater.h" diff --git a/TAO/CIAO/DAnCE/RepositoryManager/RM_Helper.h b/TAO/CIAO/DAnCE/RepositoryManager/RM_Helper.h index fb2f8a61db0..2314295ee78 100644 --- a/TAO/CIAO/DAnCE/RepositoryManager/RM_Helper.h +++ b/TAO/CIAO/DAnCE/RepositoryManager/RM_Helper.h @@ -1,4 +1,3 @@ - /* -*- C++ -*- */ //============================================================================= diff --git a/TAO/CIAO/DAnCE/RepositoryManager/RMadmin.cpp b/TAO/CIAO/DAnCE/RepositoryManager/RMadmin.cpp index 705af70b8d3..bdd5b9b8b14 100644 --- a/TAO/CIAO/DAnCE/RepositoryManager/RMadmin.cpp +++ b/TAO/CIAO/DAnCE/RepositoryManager/RMadmin.cpp @@ -1,4 +1,3 @@ - /* -*- C++ -*- */ /*** @@ -11,7 +10,7 @@ * author Stoyan Paunov **/ -#include "RepositoryManagerC.h" +#include "RepositoryManagerDaemonC.h" #include "Options.h" #include "ace/OS_NS_fcntl.h" //for open diff --git a/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.cpp b/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.cpp index b8a94492920..813ee79f1cd 100644 --- a/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.cpp +++ b/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.cpp @@ -1,4 +1,3 @@ - /* -*- C++ -*- */ //====================================================================== diff --git a/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc b/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc index d558e6fbb46..159066e31ec 100644 --- a/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc +++ b/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager.mpc @@ -4,7 +4,7 @@ //RepositoryManager project: implementation of a repository manager //compleint with the D&C spec -project (RepositoryManager) : ciao_component_dnc, taoexe, ciao_config_handlers, zzip, zlib { +project (RepositoryManager) : ciao_server_dnc, ciao_config_handlers, zzip, zlib { includes += $(CIAO_ROOT)/tools/Config_Handlers //to circumvent an improper include resolution //in the Package_Handlers/PC_Intf.h @@ -13,12 +13,12 @@ project (RepositoryManager) : ciao_component_dnc, taoexe, ciao_config_handlers, libs += Package_Config_Handlers IDL_Files { - RepositoryManager.idl + RepositoryManagerDaemon.idl } Source_Files { - RepositoryManagerC.cpp - RepositoryManagerS.cpp + RepositoryManagerDaemonC.cpp + RepositoryManagerDaemonS.cpp ZIP_Wrapper.cpp RepositoryManager.cpp RepositoryManager_Impl.cpp @@ -34,17 +34,17 @@ project (RepositoryManager) : ciao_component_dnc, taoexe, ciao_config_handlers, // RMadmin project: a sample client for the RM. -project (RMAdmin) : ciao_component_dnc, ciao_config_handlers { +project (RMAdmin) : ciao_servant_dnc, ciao_config_handlers { exename = RMadmin - after += RepositoryManager + after += RepositoryManager IDL_Files { - RepositoryManager.idl + RepositoryManagerDaemon.idl } Source_Files { RMadmin.cpp - RepositoryManagerC.cpp + RepositoryManagerDaemonC.cpp Options.cpp RM_Helper.cpp } diff --git a/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h b/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h index a3d9557aa35..4f5f2b4efd0 100644 --- a/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h +++ b/TAO/CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h @@ -1,4 +1,3 @@ - /* -*- C++ -*- */ //====================================================================== @@ -31,8 +30,7 @@ //uncomment this line to turn on the code that relates to interface types //#define ASSEMBLY_INTERFACE_SUPPORT 1 - -#include "RepositoryManagerS.h" +#include "RepositoryManagerDaemonS.h" #include "ace/Hash_Map_Manager.h" //for the ACE_Hash_Map_Manager #include "ace/Null_Mutex.h" //for ACE_Null_Mutex diff --git a/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc index 903d754f7fa..6ff77c3e1fa 100644 --- a/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc +++ b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc @@ -1,12 +1,11 @@ // -*- MPC -*- // $Id$ -project(StaticDAnCEParser): ciao_component_dnc, taoexe, ciao_config_handlers { +project(StaticDAnCEParser): ciao_component_dnc, taoexe, ciao_config_handlers, ciao_domainapplicationmanager_dnc, iortable, exceptions, ciao_server_dnc { exename = StaticDAnCEParser - requires += exceptions dummy_label includes += .. - libs += TAO_IORTable NodeApplicationManager DomainApplicationManager - after += TAO_IORTable NodeApplicationManager DomainApplicationManager NodeManager + libs += NodeApplicationManager + after += NodeApplicationManager NodeManager Source_Files { StaticDAnCEParser.cpp diff --git a/TAO/CIAO/DAnCE/TargetManager/Deployment_Configuration.h b/TAO/CIAO/DAnCE/TargetManager/Deployment_Configuration.h index 07fa26df036..effca979a4c 100644 --- a/TAO/CIAO/DAnCE/TargetManager/Deployment_Configuration.h +++ b/TAO/CIAO/DAnCE/TargetManager/Deployment_Configuration.h @@ -23,13 +23,13 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "DeploymentC.h" -#include "DomainApplicationManager/DomainApplicationManager_Export.h" -#include "ace/SString.h" +#include "ciao/NodeManagerC.h" #include "tao/Valuetype/ValueBase.h" #include "tao/Valuetype/Valuetype_Adapter_Impl.h" #include "ace/SString.h" +#include "DomainApplicationManager/DomainApplicationManager_Export.h" + namespace CIAO { /** diff --git a/TAO/CIAO/DAnCE/TargetManager/TargetManager.idl b/TAO/CIAO/DAnCE/TargetManager/TargetManager.idl index 249def3fcb0..21200871e68 100644 --- a/TAO/CIAO/DAnCE/TargetManager/TargetManager.idl +++ b/TAO/CIAO/DAnCE/TargetManager/TargetManager.idl @@ -22,7 +22,6 @@ * @brief TargetManager interface defintion * */ - module CIAO { component TargetManagerImpl diff --git a/TAO/CIAO/DAnCE/TargetManager/TargetManager.mpc b/TAO/CIAO/DAnCE/TargetManager/TargetManager.mpc index ef22db4924f..b5a7aaa5458 100644 --- a/TAO/CIAO/DAnCE/TargetManager/TargetManager.mpc +++ b/TAO/CIAO/DAnCE/TargetManager/TargetManager.mpc @@ -1,6 +1,5 @@ // $Id$ -// generate_component_mpc.pl,v project(CIAO_TargetManager_stub): ciao_client_dnc, ciao_deployment_stub { after += NodeManager_stub sharedname = TargetManager_stub @@ -45,16 +44,10 @@ project(CIAO_TargetManager_svnt) : ciao_servant_dnc { } -project(CIAO_TargetManager_exec) : namingexe, ciao_component_dnc , ciao_config_handlers { - after += CIAO_TargetManager_svnt DomainApplicationManager +project(CIAO_TargetManager_exec) : ciao_servant_dnc, ciao_config_handlers, ciao_domainapplicationmanager_dnc { + after += CIAO_TargetManager_svnt sharedname = TargetManager_exec - libs += TargetManager_stub \ - TargetManager_svnt \ - DomainApplicationManager \ - NodeManager_stub - - - includes += $(CIAO_ROOT)/DomainApplicationManager + libs += TargetManager_stub TargetManager_svnt idlflags += -Wb,export_macro=TARGETMANAGER_EXEC_Export -Wb,export_include=TargetManager_exec_export.h dynamicflags = TARGETMANAGER_EXEC_BUILD_DLL diff --git a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc index 81004d6b00d..2cc04a9a18a 100644 --- a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc +++ b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc @@ -62,7 +62,7 @@ project(NodeAppTest_RoundTrip_svnt) : ciao_servant_dnc { } } -project(NodeAppTest_RoundTrip_exec) : ciao_component_dnc { +project(NodeAppTest_RoundTrip_exec) : ciao_component_dnc, ciao_events_dnc, ciao_server_dnc { after += NodeAppTest_RoundTrip_stub NodeAppTest_RoundTrip_svnt sharedname = NodeAppTest_RoundTrip_exec diff --git a/TAO/CIAO/ciao/CCM_Base.idl b/TAO/CIAO/ciao/CCM_Base.idl index 7e13e525545..63c05a79578 100644 --- a/TAO/CIAO/ciao/CCM_Base.idl +++ b/TAO/CIAO/ciao/CCM_Base.idl @@ -25,9 +25,6 @@ module Components { - /** - * @@ Commented out temporarily for lack of typePrefix support. - */ typeprefix Components "omg.org"; typedef string FeatureName; diff --git a/TAO/CIAO/ciao/CCM_Core.mpc b/TAO/CIAO/ciao/CCM_Core.mpc index d291aaa5f1a..8a3a2f5ef51 100644 --- a/TAO/CIAO/ciao/CCM_Core.mpc +++ b/TAO/CIAO/ciao/CCM_Core.mpc @@ -34,10 +34,8 @@ project (CIAO_DnC_Client) : taolib_with_idl, valuetype, ifr_client { } } -project (CIAO_DnC_Container) : orbsvcslib, portableserver, security, valuetype, ifr_client, codecfactory, pi { - after += CIAO_DnC_Client +project (CIAO_DnC_Container) : orbsvcslib, portableserver, security, valuetype, ifr_client, codecfactory, pi, ciao_client_dnc { sharedname = CIAO_DnC_Container - libs += CIAO_DnC_Client idlflags += -Wb,export_include=CIAO_Container_Export.h idlflags += -Wb,export_macro=CIAO_CONTAINER_Export dynamicflags = CIAO_CONTAINER_BUILD_DLL @@ -52,7 +50,6 @@ project (CIAO_DnC_Container) : orbsvcslib, portableserver, security, valuetype, CCM_Container_Ex.idl SwapExec.idl UpgradeableContext.idl - // ServerResources.idl } Source_Files { @@ -72,14 +69,11 @@ project (CIAO_DnC_Container) : orbsvcslib, portableserver, security, valuetype, // Valuetype library must be linked for this project. // Please don't remove. -project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client { +project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client, ciao_events_base_dnc, ciao_client_dnc { sharedname = CIAO_Deployment_stub - after += CIAO_DnC_Client - - libs += CIAO_DnC_Client // This is necessary for MPC to pull in rules.ciao.GNU - includes += $(CIAO_ROOT)/DAnCE + includes += $(CIAO_ROOT)/DAnCE $(CIAO_ROOT) idlflags += -Wb,stub_export_macro=Deployment_stub_Export idlflags += -Wb,stub_export_include=Deployment_stub_export.h @@ -96,7 +90,13 @@ project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client { Packaging_Data.idl Target_Data.idl Deployment.idl + NodeManager.idl + NodeApplicationManager.idl + DomainApplicationManager.idl + ExecutionManager.idl + RepositoryManager.idl ServerResources.idl + Deployment_Events.idl } Source_Files { @@ -106,25 +106,29 @@ project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client { Packaging_DataC.cpp Target_DataC.cpp DeploymentC.cpp + NodeManagerC.cpp + NodeApplicationManagerC.cpp + DomainApplicationManagerC.cpp + ExecutionManagerC.cpp + RepositoryManagerC.cpp NodeApplication_CallBackC.cpp ServerResourcesC.cpp + Deployment_EventsC.cpp } } // CIAO_DnC_Client library must be linked for this project. // Please don't remove. -project(Deployment_svnt) : taolib_with_idl, portableserver, valuetype, ifr_client { - after += Deployment_stub +project(Deployment_svnt) : taolib_with_idl, portableserver, valuetype, ifr_client, ciao_deployment_stub, ciao_events_dnc, ciao_client_dnc { sharedname = CIAO_Deployment_svnt dynamicflags = DEPLOYMENT_SVNT_BUILD_DLL - libs += CIAO_Deployment_stub CIAO_DnC_Client idlflags += -Wb,stub_export_macro=Deployment_stub_Export idlflags += -Wb,stub_export_include=Deployment_stub_export.h idlflags += -Wb,skel_export_macro=Deployment_svnt_Export idlflags += -Wb,skel_export_include=Deployment_svnt_export.h // This is necessary for MPC to pull in rules.ciao.GNU - includes += $(CIAO_ROOT)/DAnCE + includes += $(CIAO_ROOT)/DAnCE $(CIAO_ROOT) IDL_Files { } @@ -136,19 +140,23 @@ project(Deployment_svnt) : taolib_with_idl, portableserver, valuetype, ifr_clien Packaging_DataS.cpp Target_DataS.cpp DeploymentS.cpp + RepositoryManagerS.cpp + NodeManagerS.cpp + NodeApplicationManagerS.cpp + DomainApplicationManagerS.cpp + ExecutionManagerS.cpp NodeApp_CB_Impl.cpp NodeApplication_CallBackS.cpp ServerResourcesS.cpp + Deployment_EventsS.cpp } } -project (CIAO_DnC_Server) : orbsvcslib, portableserver, valuetype, naming, ifr_client, utils, security { - after += CIAO_DnC_Container Deployment_svnt +project (CIAO_DnC_Server) : orbsvcslib, portableserver, valuetype, naming, ifr_client, utils, security, ciao_container_dnc, ciao_client_dnc, ciao_deployment_svnt { includes += $(CIAO_ROOT)/ciao includes += $(CIAO_ROOT) sharedname = CIAO_DnC_Server - libs += CIAO_DnC_Client CIAO_DnC_Container CIAO_Deployment_svnt CIAO_Deployment_stub idlflags += -Wb,export_include=CIAO_Server_Export.h -Wb,export_macro=CIAO_SERVER_Export dynamicflags = CIAO_SERVER_BUILD_DLL @@ -183,6 +191,7 @@ project (CIAO_DnC_Server) : orbsvcslib, portableserver, valuetype, naming, ifr_c Swapping_Servant_Home_Impl_T.cpp Dynamic_Component_Servant_T.cpp Servant_Impl_T.cpp + Servant_Impl_Utils_T.cpp Servant_Activator_T.cpp } } diff --git a/TAO/CIAO/ciao/Container_Base.cpp b/TAO/CIAO/ciao/Container_Base.cpp index 5917fe94934..f4a9261b36a 100644 --- a/TAO/CIAO/ciao/Container_Base.cpp +++ b/TAO/CIAO/ciao/Container_Base.cpp @@ -6,7 +6,6 @@ #include "tao/Utils/PolicyList_Destroyer.h" #include "ace/OS_NS_stdio.h" #include "Servant_Activator.h" -#include "ace/SString.h" #if !defined (__ACE_INLINE__) # include "Container_Base.inl" @@ -14,7 +13,6 @@ namespace CIAO { - //////////////////////////////////////////////////////////////// Container::Container (CORBA::ORB_ptr o) @@ -60,11 +58,11 @@ namespace CIAO Container_Impl *container_impl, bool static_config_flag, const Static_Config_EntryPoints_Maps* maps) - : Container (o, container_impl), - number_ (0), - static_config_flag_ (static_config_flag), - static_entrypts_maps_ (maps), - sa_ (0) + : Container (o, container_impl), + number_ (0), + static_config_flag_ (static_config_flag), + static_entrypts_maps_ (maps), + sa_ (0) { } @@ -178,15 +176,11 @@ namespace CIAO root->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - CORBA::ULong p_length; + CORBA::ULong p_length = 0; if (p != 0) { p_length = p->length (); } - else - { - p_length = 0; - } TAO::Utils::PolicyList_Destroyer policies (p_length + 3); policies.length (p_length + 3); @@ -335,9 +329,9 @@ namespace CIAO ACE_THROW_RETURN (Deployment::UnknownImplId ( - "Session_Container::ciao_install_home", - exception.c_str ()), - Components::CCMHome::_nil ()); + "Session_Container::ciao_install_home", + exception.c_str ()), + Components::CCMHome::_nil ()); } if (executor_dll.open (exe_dll_name, diff --git a/TAO/CIAO/ciao/Container_Base.h b/TAO/CIAO/ciao/Container_Base.h index 4753c1d6f23..cbde8a4d6c0 100644 --- a/TAO/CIAO/ciao/Container_Base.h +++ b/TAO/CIAO/ciao/Container_Base.h @@ -9,6 +9,7 @@ * Header file for CIAO's container implementations * * @author Nanbor Wang + * @author Gan Deng */ //============================================================================= @@ -29,7 +30,6 @@ #include "ace/Hash_Map_Manager_T.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ @@ -118,6 +118,7 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)) = 0; protected: + /// Reference to the ORB CORBA::ORB_var orb_; /// POA within which all the components in this container will be @@ -131,6 +132,7 @@ namespace CIAO * are distinct from the component. */ PortableServer::POA_var facet_cons_poa_; + PortableServer::POA_var home_servant_poa_; Container_Impl *container_impl_; private: @@ -174,9 +176,6 @@ namespace CIAO class CIAO_SERVER_Export Session_Container : public Container { public: - // @@ (OO) Does the static_config_flag really need to be an int? - // It appears to be a boolean value. Please use bool - // instead. Session_Container (CORBA::ORB_ptr o, Container_Impl *container_impl, bool static_config_flag = false, @@ -215,41 +214,41 @@ namespace CIAO Deployment::ImplEntryPointNotFound, Deployment::InstallationFailure)); - // Uninstall a servant for component or home. + /// Uninstall a servant for component or home. virtual void ciao_uninstall_home (Components::CCMHome_ptr homeref ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Uninstall a servant for component. + /// Uninstall a servant for component. virtual void uninstall_component (::Components::CCMObject_ptr objref, PortableServer::ObjectId_out oid ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Install a servant for component or home. + /// Install a servant for component or home. virtual CORBA::Object_ptr install_servant (PortableServer::Servant p, Container::OA_Type t ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Install a component servant. + /// Install a component servant. CORBA::Object_ptr install_component (PortableServer::Servant p, PortableServer::ObjectId_out oid ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Get an object reference to a component or home from the servant. + /// Get an object reference to a component or home from the servant. virtual CORBA::Object_ptr get_objref (PortableServer::Servant p ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Uninstall a servant for component or home. + /// Uninstall a servant for component or home. void uninstall (CORBA::Object_ptr objref, Container::OA_Type t ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Uninstall a servant for component or home. + /// Uninstall a servant for component or home. void uninstall (PortableServer::Servant svt, Container::OA_Type t ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -283,8 +282,8 @@ namespace CIAO ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - // Analog of the POA method that creates an object reference from - // an object id string. + /// Analog of the POA method that creates an object reference from + /// an object id string. CORBA::Object_ptr generate_reference (const char *obj_id, const char *repo_id, Container::OA_Type t @@ -296,7 +295,7 @@ namespace CIAO private: - /// Create POA for the component. + /// Create POA for the component. /** * This is the POA that is returned to the component applications * if they need one. @@ -316,15 +315,13 @@ namespace CIAO Session_Container (void); protected: - long number_; + unsigned long number_; + /// Static variable to store the highest number we have given out until + /// now static ACE_Atomic_Op serial_number_; - // @@ (OO) Does this really need to be an int? It appears to be a - // boolean value. Please use bool instead. - // - // It looks like it can also be declared const, as well. - bool static_config_flag_; + const bool static_config_flag_; const Static_Config_EntryPoints_Maps* static_entrypts_maps_; /// The servant activator factory used to activate facets and diff --git a/TAO/CIAO/ciao/Deployment.idl b/TAO/CIAO/ciao/Deployment.idl index 032f1e10dd6..e9e34acbcf1 100644 --- a/TAO/CIAO/ciao/Deployment.idl +++ b/TAO/CIAO/ciao/Deployment.idl @@ -1,4 +1,5 @@ // $Id$ + #ifndef DEPLOYMENT_IDL #define DEPLOYMENT_IDL @@ -14,14 +15,6 @@ module Deployment { string reason; }; - exception NameExists { - }; - - exception PackageError { - string source; - string reason; - }; - exception NoSuchName { }; @@ -42,111 +35,6 @@ module Deployment { string name; string plan_uuid; }; - - typedef sequence < ComponentPlan > ComponentPlans; - - interface ApplicationManager { - Application startLaunch (in Properties configProperty, - out Connections providedReference, - in boolean start) - raises (ResourceNotAvailable, StartError, InvalidProperty); - void destroyApplication (in Application app) - raises (StopError); - }; - - typedef sequence < Application > Applications; - - /// CIAO 's DomainApplicationManager interface differs spec-defined interface - /// in the same that it also integrates the spec-defined interface for - /// DomainApplication into itself - interface DomainApplicationManager - { - DeploymentPlan getPlan (); - - /// CIAO specific version of startLaunch implementation, this one - /// differs with spec-defined operation in the sense that it doesn't - /// return DomainApplication object reference. - void startLaunch (in Properties configProperty, in boolean start) - raises (ResourceNotAvailable, StartError, InvalidProperty); - - void finishLaunch (in boolean start, - in boolean is_ReDAC) - raises (StartError, InvalidConnection); - - void start () - raises (StartError); - - /// CIAO specific extention - /// Fetch NodeApplication based on the given node name - NodeApplication get_node_app (in string node_name) - raises (NoSuchName); - - /// CIAO speicifc extension, it differs with the spec defined one - /// for no input parameter. - void destroyApplication () - raises (StopError); - - /// CIAO specific extension to destroy NodeApplicationManager - void destroyManager () - raises (StopError); - - /// CIAO specific extension - /// Perform the actual redeployment and reconfiguration on the dommain level. - void perform_redeployment (in DeploymentPlan new_plan) - raises (PlanError, - InstallationFailure, - UnknownImplId, - ImplEntryPointNotFound, - InvalidConnection, - InvalidProperty, - ::Components::RemoveFailure); - }; - - typedef sequence < DomainApplicationManager > DomainApplicationManagers; - - interface ExecutionManager { - DomainApplicationManager preparePlan (in DeploymentPlan plan, - in boolean commitResources) - raises (ResourceNotAvailable, PlanError, StartError); - - DomainApplicationManagers getManagers (); - - DomainApplicationManager getManager (in string plan_uuid) - raises (PlanNotExist); - - void destroyManager (in DomainApplicationManager manager) - raises (StopError); - - /// CIAO specific extention - /// Destroy ApplicatioManagers by plan_uuid, the unique semantics of this - /// operation lies in the fact that if some components are - /// still up and running, then the ApplicationManagers won't be destroyed. - void destroyManagerByPlan (in string plan_uuid) - raises (StopError); - - /// CIAO specific extention - /// "Get" operation, return the DeploymentPlan - DeploymentPlan getPlan (in string plan_uuid); - - /// CIAO specific operation to handle dynamic system redeployment - /// and reconfiguration - /// This operation could handle dynamic redeployment, and this - /// is the operation exposed to clients directly. Other - /// "perform_redeployment" operation defined on DAM and NA - /// are implementaion details within DAnCE. - void perform_redeployment (in DeploymentPlan new_plan) - raises (PlanError, - InstallationFailure, - UnknownImplId, - ImplEntryPointNotFound, - InvalidConnection, - InvalidProperty, - ::Components::RemoveFailure); - }; - - interface Logger { - }; - /** * @struct Sched_Params * @brief Carries Scheduling Params @@ -162,140 +50,13 @@ module Deployment { long msec_; }; - interface NodeApplicationManager : - ApplicationManager - { - /// CIAO specific operation to handle dynamic system redeployment - /// and reconfiguration - /// This operation could handle dynamic redeployment for - /// a node-level deployment plan within a node - Application perform_redeployment (in Properties configProperty, - out Connections providedReference, - in boolean start) - raises (PlanError, - InstallationFailure, - UnknownImplId, - ImplEntryPointNotFound, - InvalidConnection, - InvalidProperty, - ::Components::RemoveFailure); - - /// CIAO specific operation to reset deployment plan - void reset_plan (in DeploymentPlan plan); - - /// CIAO speicfic operation to set the information of - /// "shared components" (through NodeManager) - void set_shared_components (in ComponentPlans components); - - /// CIAO specific function to set priority - /// o component , required by RACE - - long set_priority (in string cid , in Sched_Params params); - }; - - interface NodeManager { - void joinDomain (in Domain ciao_domain, - in TargetManager manager, - in Logger log); - - void leaveDomain (); - - NodeApplicationManager preparePlan (in DeploymentPlan plan) - raises (StartError, PlanError); - - void destroyManager (in NodeApplicationManager appManager) - raises (StopError, InvalidReference); - - /// CIAO specific extension - /// Destroy the NAM and all the associated NAs with this child_plan - /// We can guarantee that the input DeploymentPlan is valid, since it - /// is fetched from the cached DeploymentPlan of DAM, which has been - /// validated before. - void destroyPlan (in DeploymentPlan plan) - raises (StopError); - - /// CIAO specific extension - /// Get all the shared components installed in this node - ComponentPlans get_shared_components (); - }; - - interface RepositoryManager { - void installPackage (in string installationName, in string location) - raises (NameExists, PackageError); - void createPackage (in string installationName, - in PackageConfiguration package, - in string baseLocation, - in boolean replace) - raises (NameExists, PackageError); - PackageConfiguration findPackageByName (in string name) - raises (NoSuchName); - PackageConfiguration findPackageByUUID (in string UUID) - raises (NoSuchName); - ::CORBA::StringSeq findNamesByType (in string type); - ::CORBA::StringSeq getAllNames (); - ::CORBA::StringSeq getAllTypes (); - void deletePackage (in string installationName) - raises (NoSuchName); - }; - - -//***************************************new_RepositoryManager ONWARDS***************************************** - -typedef sequence Artifact; - typedef sequence Package; - - exception NoPlan { - }; + typedef sequence < ComponentPlan > ComponentPlans; - enum Platform { - Win32, - Unix, - Linux, - Solaris, - Vxworks, - UNDEF - }; + typedef sequence < Application > Applications; - struct Implementation - { - Platform the_platform; - string name; - Artifact the_implementation; + interface Logger { }; - typedef sequence Implementations; - - interface new_RepositoryManager - { - void installPackage (in string installationName, - in Package the_package, - in boolean replace) - raises (NameExists, PackageError); - - DeploymentPlan retrievePlan (in string packageName) - raises (NoPlan); - - Package findPackageByName (in string name) - raises (NoSuchName); - - Implementation findImplementationByName (in string implementation_name, - in string package_name) - raises (NoSuchName); - - Package findPackageByUUID (in string UUID) - raises (NoSuchName); - - Implementation findImplementationByUUID (in string UUID) - raises (NoSuchName); - - //::CORBA::StringSeq findNamesByType (in string type); - //::CORBA::StringSeq getAllTypes (); - - ::CORBA::StringSeq getAllPackageNames (); - - void deletePackage (in string installationName) - raises (NoSuchName); - }; }; #endif /* DEPLOYMENT_IDL */ diff --git a/TAO/CIAO/ciao/Deployment_Base.idl b/TAO/CIAO/ciao/Deployment_Base.idl index 82f97aa4a1f..caadccf2fee 100644 --- a/TAO/CIAO/ciao/Deployment_Base.idl +++ b/TAO/CIAO/ciao/Deployment_Base.idl @@ -1,9 +1,9 @@ //$Id$ + #ifndef DEPLOYMENT_BASE_IDL #define DEPLOYMENT_BASE_IDL #include -#include "tao/ULongSeq.pidl" #include "Deployment_Core.idl" module Deployment { diff --git a/TAO/CIAO/ciao/Deployment_Core.idl b/TAO/CIAO/ciao/Deployment_Core.idl index 6c09f62828d..bfb58b6e2c8 100644 --- a/TAO/CIAO/ciao/Deployment_Core.idl +++ b/TAO/CIAO/ciao/Deployment_Core.idl @@ -4,6 +4,7 @@ #define DEPLOYMENT_CORE_IDL #include "CCM_Component.idl" +#include // *************** Packaging and Deployment *************** module Deployment @@ -97,6 +98,14 @@ module Deployment // the endpoints member is change to endpoint. // Since we will not have more than 1 objref in there. Object endpoint; + + // A wrapper facade interface to provision different event + // communication mechanisms, including RTEC, etc. + CIAO::CIAO_Event_Service event_service; + + // The properties of this connection, particularly useful + // to speicfy QoS properties of pub/sub service connections. + Properties config; }; typedef sequence < Connection > Connections; @@ -205,6 +214,21 @@ module Deployment }; typedef sequence Containers; + typedef sequence CIAO_Event_Services; + + /// CIAO specific extension + /// This struct captures the installation information of a particular + /// CIAO_Event_Service, as defined in + struct ESInstallationInfo + { + string id; + CIAO::EventServiceType type; + string svcconf; + //Properties es_config; + }; + + /// CIAO specific extension + typedef sequence ESInstallationInfos; interface NodeApplication : Application { @@ -227,25 +251,32 @@ module Deployment ::Components::InvalidConfiguration, ::Components::RemoveFailure); + /// CIAO specific extension + /// This operation will create one or more CIAO_Event_Service objects + /// within the NodeApplication, which will be used to mediate the + /// communication of CCM events + CIAO_Event_Services install_es (in ESInstallationInfos es_infos) + raises (InstallationFailure); + /// CIAO specific extensions ///@@ We know that Deployment::NodeApplicationManager will be returned, /// however to avoid the size of the shared object of CIAO_Server. /// we return an Object. Object get_node_application_manager (); - /// CIAO specific extensions + /// CIAO specific extension Container create_container (in ::Deployment::Properties properties) raises (::Components::CreateFailure, ::Components::InvalidConfiguration); - /// CIAO specific extensions + /// CIAO specific extension void remove_container (in Container cref) raises (::Components::RemoveFailure); - /// CIAO specific extensions + /// CIAO specific extension Containers get_containers (); - /// CIAO specific extensions + /// CIAO specific extension /// Remove a component instance from the NodeApplication void remove_component (in string inst_name) raises (::Components::RemoveFailure); @@ -260,22 +291,21 @@ module Deployment void passivate_component (in string inst_name) raises (::Components::RemoveFailure); - /// CIAO specific extensions /// Remove all containers, components and component homes. /// Shuts down the ORB of the NodeApplication to terminate the process. oneway void remove (); - /// CIAO specific extensions. This will enforce the component to + /// CIAO specific extension. This will enforce the component to /// be activated (preactivate, activate, postactivated) before the assembly /// is established void ciao_preactivate () raises (StartError); - /// CIAO specific extensions + /// CIAO specific extension void ciao_postactivate () raises (StartError); - /// CIAO specific extensions + /// CIAO specific extension void ciao_passivate () raises (StopError); }; diff --git a/TAO/CIAO/ciao/Deployment_Data.idl b/TAO/CIAO/ciao/Deployment_Data.idl index d4e0628ebce..7b475947add 100644 --- a/TAO/CIAO/ciao/Deployment_Data.idl +++ b/TAO/CIAO/ciao/Deployment_Data.idl @@ -1,9 +1,9 @@ // $Id$ + #ifndef DEPLOYMENT_DATA_IDL #define DEPLOYMENT_DATA_IDL #include "Deployment_Base.idl" - module Deployment { struct ComponentPortDescription { diff --git a/TAO/CIAO/ciao/Dynamic_Component_Activator.h b/TAO/CIAO/ciao/Dynamic_Component_Activator.h index 1e9a023f38c..d42fa216698 100644 --- a/TAO/CIAO/ciao/Dynamic_Component_Activator.h +++ b/TAO/CIAO/ciao/Dynamic_Component_Activator.h @@ -15,23 +15,24 @@ #define CIAO_DYNAMIC_SWAPPING_ACTIVATOR_H #include /**/ "ace/pre.h" -#include "ace/Array_Base.h" #include "ciao/CIAO_Server_Export.h" -#include "ciao/CCM_ContainerC.h" -#include "ciao/Deployment_CoreC.h" - -#include "tao/PortableServer/Key_Adapters.h" -#include "ace/Hash_Map_Manager_T.h" -#include "Dynamic_Component_Servant_Base.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ciao/CCM_ContainerC.h" +#include "ciao/Deployment_CoreC.h" +#include "ciao/Dynamic_Component_Servant_Base.h" + +#include "tao/PortableServer/Key_Adapters.h" #include "tao/PortableServer/PortableServer.h" #include "tao/LocalObject.h" #include "tao/PortableServer/ServantActivatorC.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Array_Base.h" + #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4250) diff --git a/TAO/CIAO/ciao/NodeApp_CB_Impl.h b/TAO/CIAO/ciao/NodeApp_CB_Impl.h index 94f05cad3c1..824f3605d8f 100644 --- a/TAO/CIAO/ciao/NodeApp_CB_Impl.h +++ b/TAO/CIAO/ciao/NodeApp_CB_Impl.h @@ -24,9 +24,6 @@ namespace CIAO { - // Forward declaration. - // class NodeApplicationManager; - /** * @class NodeApplication_Callback_Impl * @@ -47,14 +44,6 @@ namespace CIAO const Deployment::Properties &properties) ACE_THROW_SPEC ((CORBA::SystemException)); - // @@ (OO) Since this class is reference counted, please make this - // destructor protected to enforce proper memory managment - // through the reference counting mechanism (i.e. to - // disallow calling operator delete() on an instance of - // this class. - /// Destructor. - ~NodeApplication_Callback_Impl (); - /// Get the containing POA. This operation does *not* increase /// the reference count of the POA. virtual PortableServer::POA_ptr _default_POA (void); @@ -71,6 +60,9 @@ namespace CIAO Deployment::NodeApplication_ptr get_nodeapp_ref (void); protected: + /// Destructor. + ~NodeApplication_Callback_Impl (); + CORBA::ORB_var orb_; PortableServer::POA_var poa_; diff --git a/TAO/CIAO/ciao/NodeApplication_CallBack.idl b/TAO/CIAO/ciao/NodeApplication_CallBack.idl index 9c4f1d14775..d0f8daeb42e 100644 --- a/TAO/CIAO/ciao/NodeApplication_CallBack.idl +++ b/TAO/CIAO/ciao/NodeApplication_CallBack.idl @@ -4,12 +4,13 @@ * This IDL file is used to combine the NodeApplication * interface with the NodeApplicationManager interface. * - * NodeApplicationManager will be spwan NodeApplication. + * NodeApplicationManager will be spawn NodeApplication. * The call back object will be used to get the objectref of * NodeApplication. */ #include "Deployment.idl" +#include "NodeApplicationManager.idl" module CIAO { diff --git a/TAO/CIAO/ciao/Port_Activator.h b/TAO/CIAO/ciao/Port_Activator.h index d87d0c2630f..5ab3adb2604 100644 --- a/TAO/CIAO/ciao/Port_Activator.h +++ b/TAO/CIAO/ciao/Port_Activator.h @@ -54,7 +54,7 @@ namespace CIAO /// Return the name of port that this activator encapulates. const char* name (void) const; - /// set the name + /// Set the name void set_name (const char* name); /// Activate the servant reponsible for this port. @@ -79,7 +79,7 @@ namespace CIAO /// Name of the port CORBA::String_var name_; - /// What type of port is it, a conumer or facet. + /// What type of port is it, a consumer or facet. Type t_; }; } diff --git a/TAO/CIAO/ciao/Servant_Impl_Base.cpp b/TAO/CIAO/ciao/Servant_Impl_Base.cpp index 5cefb47882b..6e649f82fc3 100644 --- a/TAO/CIAO/ciao/Servant_Impl_Base.cpp +++ b/TAO/CIAO/ciao/Servant_Impl_Base.cpp @@ -127,9 +127,9 @@ namespace CIAO PortableServer::ObjectId_var oid; - this->container_->uninstall_component ( ccmobjref.in (), - oid.out () - ACE_ENV_ARG_PARAMETER); + this->container_->uninstall_component (ccmobjref.in (), + oid.out () + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; this->home_servant_->update_component_map (oid); @@ -173,11 +173,9 @@ namespace CIAO this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - /* ::Components::ConsumerDescriptions_var consumer_desc = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - */ ::Components::EmitterDescriptions_var emitter_desc = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -189,7 +187,7 @@ namespace CIAO retv->facets (facets_desc.in ()); retv->receptacles (receptacle_desc.in ()); - // retv->consumers (consumer_desc.in ()); + retv->consumers (consumer_desc.in ()); retv->emitters (emitter_desc.in ()); retv->publishers (publisher_desc.in ()); @@ -204,7 +202,7 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException, Components::InvalidName)) { - if (name == 0) + if (0 == name) { ACE_THROW_RETURN (Components::InvalidName (), CORBA::Object::_nil ()); @@ -242,7 +240,7 @@ namespace CIAO { tmp = this->lookup_facet_description (names[i].in ()); - if (tmp == 0) + if (0 == tmp) { ACE_THROW_RETURN (Components::InvalidName (), 0); @@ -267,15 +265,15 @@ namespace CIAO ::Components::FacetDescriptions_var retval = tmp; - retval->length (this->facet_table_.current_size ()); + retval->length (this->facet_table_.size ()); CORBA::ULong i = 0; - for (FacetTable::iterator iter = this->facet_table_.begin (); + for (FacetTable::const_iterator iter = this->facet_table_.begin (); iter != this->facet_table_.end (); ++iter, ++i) { - FacetTable::ENTRY & entry = *iter; - retval[i] = entry.int_id_; + FacetTable::const_reference entry = *iter; + retval[i] = entry.second; } return retval._retn (); @@ -288,25 +286,25 @@ namespace CIAO ) ACE_THROW_SPEC ((CORBA::SystemException)) { - ::Components::ConsumerDescriptions *tmp = 0; ACE_NEW_THROW_EX (tmp, ::Components::ConsumerDescriptions ( - this->consumer_table_.current_size ()), + this->consumer_table_.size ()), CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); ::Components::ConsumerDescriptions_var retval = tmp; - retval->length (this->consumer_table_.current_size ()); + retval->length (this->consumer_table_.size ()); CORBA::ULong i = 0; - for (ConsumerTable::iterator iter = this->consumer_table_.begin (); + for (ConsumerTable::const_iterator iter = this->consumer_table_.begin (); iter != this->consumer_table_.end (); ++iter, ++i) { // ACE_DEBUG ((LM_DEBUG, "EXECUTING \n")); - ConsumerTable::ENTRY & entry = *iter; - retval[i] = entry.int_id_; + ConsumerTable::const_reference entry = *iter; + retval[i] = entry.second; } return retval._retn (); @@ -321,7 +319,7 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException, Components::InvalidName)) { - if (sink_name == 0) + if (0 == sink_name) { ACE_THROW_RETURN (Components::InvalidName (), Components::EventConsumerBase::_nil ()); @@ -339,18 +337,6 @@ namespace CIAO return retval; } - ::Components::EventConsumerBase_ptr - Servant_Impl_Base::disconnect_consumer ( - const char * /* source_name */ - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException, - Components::InvalidName, - Components::NoConnection)) - { - ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); - } - ::Components::ConsumerDescriptions * Servant_Impl_Base::get_named_consumers ( const ::Components::NameList & names @@ -372,7 +358,7 @@ namespace CIAO { tmp = this->lookup_consumer_description (names[i].in ()); - if (tmp == 0) + if (0 == tmp) { ACE_THROW_RETURN (Components::InvalidName (), 0); @@ -384,15 +370,6 @@ namespace CIAO return safe_retval._retn (); } - ::Components::EmitterDescriptions * - Servant_Impl_Base::get_all_emitters ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); - } - ::Components::EmitterDescriptions * Servant_Impl_Base::get_named_emitters ( const ::Components::NameList & /* names */ @@ -449,15 +426,6 @@ namespace CIAO ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); } - ::Components::PublisherDescriptions * - Servant_Impl_Base::get_all_publishers ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); - } - ::Components::PublisherDescriptions * Servant_Impl_Base::get_named_publishers ( const ::Components::NameList & /* names */ @@ -473,46 +441,84 @@ namespace CIAO void Servant_Impl_Base::add_facet (const char *port_name, - CORBA::Object_ptr port_ref) + ::CORBA::Object_ptr port_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( ::CORBA::SystemException)) { + if (0 == port_name || ::CORBA::is_nil (port_ref)) + { + ACE_THROW ( ::CORBA::BAD_PARAM ()); + return; + } + ::Components::FacetDescription *fd = 0; ACE_NEW (fd, - OBV_Components::FacetDescription); + ::OBV_Components::FacetDescription); ::Components::FacetDescription_var safe = fd; fd->name (port_name); fd->type_id (port_ref->_interface_repository_id ()); fd->facet_ref (port_ref); - if (this->facet_table_.bind (port_name, fd) == 0) - { - safe._retn (); - } + FacetTable::value_type entry; + entry.first = port_name; + entry.second = safe._retn (); + + ACE_WRITE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + + (void) this->facet_table_.insert (entry); } CORBA::Object_ptr Servant_Impl_Base::lookup_facet (const char *port_name) { - ::Components::FacetDescription_var fd; + if (0 == port_name) + { + return CORBA::Object::_nil (); + } + + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + CORBA::Object::_nil ()); - if (this->facet_table_.find (port_name, fd) != 0) + FacetTable::const_iterator iter = + this->facet_table_.find (port_name); + + if (iter == this->facet_table_.end ()) { return CORBA::Object::_nil (); } - return CORBA::Object::_duplicate (fd.in ()->facet_ref ()); + return CORBA::Object::_duplicate (iter->second->facet_ref ()); } ::Components::FacetDescription * Servant_Impl_Base::lookup_facet_description (const char *port_name) { - ::Components::FacetDescription_var fd; - - if (this->facet_table_.find (port_name, fd) != 0) + if (0 == port_name) { + /// Calling function will throw InvalidName after getting this. return 0; } + ::Components::FacetDescription_var fd; + FacetTable::const_iterator iter; + + { + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + 0); + + iter = this->facet_table_.find (port_name); + + if (iter != this->facet_table_.end ()) + { + fd = iter->second; + } + } + return fd._retn (); } @@ -587,35 +593,59 @@ namespace CIAO Servant_Impl_Base::add_consumer ( const char *port_name, ::Components::EventConsumerBase_ptr port_ref + ACE_ENV_ARG_DECL ) + ACE_THROW_SPEC (( ::CORBA::SystemException)) { + if (0 == port_name || ::CORBA::is_nil (port_ref)) + { + ACE_THROW ( ::CORBA::BAD_PARAM ()); + return; + } + ::Components::ConsumerDescription *cd = 0; ACE_NEW (cd, - OBV_Components::ConsumerDescription); + ::OBV_Components::ConsumerDescription); ::Components::ConsumerDescription_var safe = cd; cd->name (port_name); cd->type_id (port_ref->_interface_repository_id ()); cd->consumer (port_ref); - if (this->consumer_table_.bind (port_name, cd) == 0) - { - safe._retn (); - } + ConsumerTable::value_type entry; + entry.first = port_name; + entry.second = safe._retn (); + + ACE_WRITE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_); + + (void) this->consumer_table_.insert (entry); } ::Components::EventConsumerBase_ptr Servant_Impl_Base::lookup_consumer (const char *port_name) { - ::Components::ConsumerDescription_var cd; + if (0 == port_name) + { + return ::Components::EventConsumerBase::_nil (); + } + + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + ::Components::EventConsumerBase::_nil ()); - if (this->consumer_table_.find (port_name, cd) != 0) + ConsumerTable::const_iterator iter = + this->consumer_table_.find (port_name); + + if (iter == this->consumer_table_.end ()) { return ::Components::EventConsumerBase::_nil (); } return - ::Components::EventConsumerBase::_duplicate (cd.in ()->consumer ()); + ::Components::EventConsumerBase::_duplicate ( + iter->second->consumer () + ); } ::Components::ConsumerDescription * @@ -623,13 +653,29 @@ namespace CIAO const char *port_name ) { - ::Components::ConsumerDescription_var cd; - - if (this->consumer_table_.find (port_name, cd) != 0) + if (0 == port_name) { + /// Calling function will throw InvalidName after getting this. return 0; } + ::Components::ConsumerDescription_var cd; + ConsumerTable::const_iterator iter; + + { + ACE_READ_GUARD_RETURN (TAO_SYNCH_MUTEX, + mon, + this->lock_, + 0); + + iter = this->consumer_table_.find (port_name); + + if (iter != this->consumer_table_.end ()) + { + cd = iter->second; + } + } + return cd._retn (); } @@ -660,3 +706,4 @@ namespace CIAO PortableServer::POA::_duplicate (container_->the_POA ()); } } + diff --git a/TAO/CIAO/ciao/Servant_Impl_Base.h b/TAO/CIAO/ciao/Servant_Impl_Base.h index 90eac8b8585..a68270392b2 100644 --- a/TAO/CIAO/ciao/Servant_Impl_Base.h +++ b/TAO/CIAO/ciao/Servant_Impl_Base.h @@ -18,13 +18,16 @@ #define CIAO_SERVANT_IMPL_BASE_H #include /**/ "ace/pre.h" - #include "ace/Hash_Map_Manager_T.h" +#include "ace/Array_Map.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Active_Map_Manager_T.h" +#include "ace/Thread_Mutex.h" + #include "CCM_EventC.h" #include "CIAO_Server_Export.h" #include "CCM_ComponentS.h" @@ -117,13 +120,6 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException, Components::InvalidName)); - 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_named_consumers (const ::Components::NameList & names ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -131,27 +127,19 @@ namespace CIAO 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 */ + get_named_emitters (const ::Components::NameList & names 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 */ + get_named_receptacles (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) + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); virtual ::Components::PublisherDescriptions * @@ -178,7 +166,9 @@ namespace CIAO protected: void add_facet (const char *port_name, - CORBA::Object_ptr port_ref); + ::CORBA::Object_ptr port_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( ::CORBA::SystemException)); CORBA::Object_ptr lookup_facet (const char *port_name); @@ -191,7 +181,9 @@ namespace CIAO ::Components::Cookie * cookie); void add_consumer (const char *port_name, - ::Components::EventConsumerBase_ptr port_ref); + ::Components::EventConsumerBase_ptr port_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( ::CORBA::SystemException)); ::Components::EventConsumerBase_ptr lookup_consumer ( const char *port_name @@ -201,19 +193,52 @@ namespace CIAO const char *port_name ); + /// Called from generated servant class to help with + /// get_all_*() methods. + + template + static void describe_simplex_receptacle ( + const char *port_name, + const char *port_type_repo_id, + T_var &connection, + ::Components::ReceptacleDescriptions_var &descriptions, + CORBA::ULong slot + ); + + template + static void describe_multiplex_receptacle ( + const char *port_name, + const char *port_type_repo_id, + ACE_Active_Map_Manager &objrefs, + ::Components::ReceptacleDescriptions_var &descriptions, + CORBA::ULong slot + ); + + template + static void describe_pub_event_source ( + const char *port_name, + const char *port_type_repo_id, + ACE_Active_Map_Manager &consumers, + ::Components::PublisherDescriptions_var &descriptions, + CORBA::ULong slot + ); + + template + static void describe_emit_event_source ( + const char *port_name, + const char *port_type_repo_id, + T_var &consumer_ref, + ::Components::EmitterDescriptions_var &descriptions, + CORBA::ULong slot + ); + protected: - typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> + typedef ACE_Array_Map FacetTable; - typedef ACE_Hash_Map_Manager_Ex, - ACE_Equal_To, - ACE_Null_Mutex> + typedef ACE_Array_Map ConsumerTable; typedef ACE_Hash_Map_Manager_Ex + ACE_Atomic_Op Swapping_Container::serial_number_ (0); Swapping_Container::Swapping_Container (CORBA::ORB_ptr o, diff --git a/TAO/CIAO/ciao/Swapping_Container.h b/TAO/CIAO/ciao/Swapping_Container.h index 9f107cd1b46..99be4aa474f 100644 --- a/TAO/CIAO/ciao/Swapping_Container.h +++ b/TAO/CIAO/ciao/Swapping_Container.h @@ -96,10 +96,11 @@ namespace CIAO void create_connections_POA (PortableServer::POA_ptr root ACE_ENV_ARG_DECL); protected: - long number_; + unsigned long number_; - // @@ Jai, why should this be static? - static ACE_Atomic_Op serial_number_; + /// Static variable to store the highest number we have given out until + /// now + static ACE_Atomic_Op serial_number_; Dynamic_Component_Activator *dsa_; diff --git a/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h b/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h index 874a1c85d01..66258261e7d 100644 --- a/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h +++ b/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_Base.h @@ -21,7 +21,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "CIAO_Server_Export.h" +#include "ciao/CIAO_Server_Export.h" namespace CIAO { diff --git a/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp b/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp index 452aea78035..cf03a6f3c35 100644 --- a/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp +++ b/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.cpp @@ -3,8 +3,8 @@ #ifndef CIAO_SWAPPING_SERVANT_IMPL_T_C #define CIAO_SWAPPING_SERVANT_IMPL_T_C -#include "Swapping_Servant_Home_Impl_T.h" -#include "Dynamic_Component_Servant_T.h" +#include "ciao/Swapping_Servant_Home_Impl_T.h" +#include "ciao/Dynamic_Component_Servant_T.h" namespace CIAO { diff --git a/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.h b/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.h index b454d103815..2b5b64df889 100644 --- a/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.h +++ b/TAO/CIAO/ciao/Swapping_Servant_Home_Impl_T.h @@ -18,7 +18,7 @@ #include /**/ "ace/pre.h" -#include "Home_Servant_Impl_Base.h" +#include "ciao/Home_Servant_Impl_Base.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -26,7 +26,7 @@ #include "tao/PortableServer/Key_Adapters.h" #include "ace/Hash_Map_Manager_T.h" -#include "Dynamic_Component_Servant_Base.h" +#include "ciao/Dynamic_Component_Servant_Base.h" namespace CIAO { diff --git a/TAO/CIAO/ciao/Upgradeable_Context_Impl_T.h b/TAO/CIAO/ciao/Upgradeable_Context_Impl_T.h index 62086b1f0c3..18e5272b205 100644 --- a/TAO/CIAO/ciao/Upgradeable_Context_Impl_T.h +++ b/TAO/CIAO/ciao/Upgradeable_Context_Impl_T.h @@ -15,8 +15,8 @@ #include /**/ "ace/pre.h" -#include "UpgradeableContextC.h" -#include "Context_Impl_T.h" +#include "ciao/UpgradeableContextC.h" +#include "ciao/Context_Impl_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -71,6 +71,9 @@ namespace CIAO SVNT *servant_; COMP_VAR component_; typedef Context_Impl session_context; + private: + /// Not to be used + Upgradeable_Context_Impl (void); }; } diff --git a/TAO/CIAO/ciao/Version.h b/TAO/CIAO/ciao/Version.h index 1dda1a7f0e7..98adcad373a 100644 --- a/TAO/CIAO/ciao/Version.h +++ b/TAO/CIAO/ciao/Version.h @@ -4,6 +4,6 @@ // This is file was automatically generated by $ACE_ROOT/bin/make_release. #define CIAO_MAJOR_VERSION 0 -#define CIAO_MINOR_VERSION 4 -#define CIAO_BETA_VERSION 9 -#define CIAO_VERSION "0.4.9" +#define CIAO_MINOR_VERSION 5 +#define CIAO_BETA_VERSION 0 +#define CIAO_VERSION "0.5" diff --git a/TAO/CIAO/docs/schema/Basic_Deployment_Data.xsd b/TAO/CIAO/docs/schema/Basic_Deployment_Data.xsd index 1d386841ea5..6c468526455 100644 --- a/TAO/CIAO/docs/schema/Basic_Deployment_Data.xsd +++ b/TAO/CIAO/docs/schema/Basic_Deployment_Data.xsd @@ -228,6 +228,8 @@ + + diff --git a/TAO/CIAO/docs/schema/CIAOServerResources.xsd b/TAO/CIAO/docs/schema/CIAOServerResources.xsd index 3d1554c861a..d9fb63da88f 100644 --- a/TAO/CIAO/docs/schema/CIAOServerResources.xsd +++ b/TAO/CIAO/docs/schema/CIAOServerResources.xsd @@ -7,10 +7,10 @@ - Root element for defining all the resources used by a DeploymentPlan. - A CIAO:ServerResources document should reside in a separate file. + Root element for defining all the resources used by a DeploymentPlan. + A CIAO:ServerResources document should reside in a separate file. A DeploymentPlan can refer to one or more CIAO:ServerResources file names - using the "infoProperty" tag. + using the "infoProperty" tag. @@ -73,7 +73,7 @@ - @@ -113,7 +113,7 @@ - @@ -121,7 +121,7 @@ - diff --git a/TAO/CIAO/docs/schema/ccd.xsd b/TAO/CIAO/docs/schema/ccd.xsd index b52996c4bab..fcdac711b5a 100644 --- a/TAO/CIAO/docs/schema/ccd.xsd +++ b/TAO/CIAO/docs/schema/ccd.xsd @@ -5,7 +5,7 @@ targetNamespace="http://www.omg.org/Deployment"> - + diff --git a/TAO/CIAO/docs/schema/cdd.xsd b/TAO/CIAO/docs/schema/cdd.xsd index 18d9760f155..711ec8d4e0a 100644 --- a/TAO/CIAO/docs/schema/cdd.xsd +++ b/TAO/CIAO/docs/schema/cdd.xsd @@ -8,13 +8,13 @@ - + - - - - + + + + @@ -23,7 +23,7 @@ - + @@ -33,17 +33,17 @@ - + - + - + @@ -53,8 +53,8 @@ - + - + \ No newline at end of file diff --git a/TAO/CIAO/docs/schema/cdp.xsd b/TAO/CIAO/docs/schema/cdp.xsd index 36fc24f5fc7..d3641992b34 100644 --- a/TAO/CIAO/docs/schema/cdp.xsd +++ b/TAO/CIAO/docs/schema/cdp.xsd @@ -9,10 +9,15 @@ - - + + + + + @@ -109,7 +109,7 @@ - + @@ -170,7 +170,7 @@ - + @@ -186,7 +186,7 @@ - + @@ -198,8 +198,8 @@ - - + + @@ -215,8 +215,8 @@ - - + + @@ -232,7 +232,7 @@ - + @@ -249,7 +249,7 @@ - + @@ -266,7 +266,7 @@ - + @@ -296,7 +296,7 @@ - + @@ -375,7 +375,7 @@ - + @@ -399,7 +399,7 @@ Represents the Priority Model Policy, ID 40 - + @@ -410,7 +410,7 @@ - + @@ -426,7 +426,7 @@ Represents the ThreadPool policy, ID 41 - + @@ -436,8 +436,8 @@ - - + + @@ -446,7 +446,7 @@ Represents the Server Protocol policy, ID 42 - + @@ -457,8 +457,8 @@ - - + + @@ -466,7 +466,7 @@ Represents the Client Protocol policy, ID 43 - + @@ -477,7 +477,7 @@ - + @@ -487,7 +487,7 @@ - + @@ -507,7 +507,7 @@ - + @@ -528,7 +528,7 @@ - + @@ -551,7 +551,7 @@ - + @@ -568,8 +568,8 @@ - - + + @@ -577,7 +577,7 @@ priorityBandedPolicy extension of policyBase, ID 45 - + @@ -589,7 +589,7 @@ - + @@ -601,7 +601,7 @@ + - - + \ No newline at end of file diff --git a/TAO/CIAO/docs/schema/iad.xsd b/TAO/CIAO/docs/schema/iad.xsd index c44166c7d9d..2f910b5d333 100644 --- a/TAO/CIAO/docs/schema/iad.xsd +++ b/TAO/CIAO/docs/schema/iad.xsd @@ -29,4 +29,4 @@ - + \ No newline at end of file diff --git a/TAO/CIAO/docs/schema/pcd.xsd b/TAO/CIAO/docs/schema/pcd.xsd index 61f32ddcee7..05b10e1bb79 100644 --- a/TAO/CIAO/docs/schema/pcd.xsd +++ b/TAO/CIAO/docs/schema/pcd.xsd @@ -6,7 +6,7 @@ - + @@ -29,4 +29,4 @@ - + \ No newline at end of file diff --git a/TAO/CIAO/docs/schema/toplevel.xsd b/TAO/CIAO/docs/schema/toplevel.xsd index 0c67f5fb7a9..e456a1bc005 100644 --- a/TAO/CIAO/docs/schema/toplevel.xsd +++ b/TAO/CIAO/docs/schema/toplevel.xsd @@ -8,8 +8,8 @@ - + - + \ No newline at end of file diff --git a/TAO/CIAO/docs/schema/unused_elements.xsd b/TAO/CIAO/docs/schema/unused_elements.xsd index 6f5aaddabdb..c1200b088e9 100644 --- a/TAO/CIAO/docs/schema/unused_elements.xsd +++ b/TAO/CIAO/docs/schema/unused_elements.xsd @@ -4,7 +4,7 @@ xmlns:Deployment="http://www.omg.org/Deployment" targetNamespace="http://www.omg.org/Deployment"> -