diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-05 23:03:38 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-08-05 23:03:38 +0000 |
commit | 168d641d320ed7f24c630134304bf979755a1980 (patch) | |
tree | 19a2328cde312c15ef2d8f1437d604f2c055cc6c | |
parent | 88ecf1cdfb572c89e73c397bb5ad54f5aa7d8cba (diff) | |
download | ATCD-168d641d320ed7f24c630134304bf979755a1980.tar.gz |
ChangeLogTag: Thu Aug 5 17:42:56 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
27 files changed, 4480 insertions, 470 deletions
diff --git a/TAO/CIAO/CIDLC/ExecImplGenerator.cpp b/TAO/CIAO/CIDLC/ExecImplGenerator.cpp new file mode 100644 index 00000000000..da965893980 --- /dev/null +++ b/TAO/CIAO/CIDLC/ExecImplGenerator.cpp @@ -0,0 +1,186 @@ +// file : CIDLC/ExecImplGenerator.cpp +// author : Jeff Parsons <j.parsons@vanderbilt.edu> +// cvs-id : $Id$ + +#include "ExecImplGenerator.hpp" +#include "ExecImplHeaderGenerator.hpp" +#include "ExecImplSourceGenerator.hpp" + +#include "CCF/CodeGenerationKit/Regex.hpp" +#include "CCF/CodeGenerationKit/IndentationCxx.hpp" +#include "CCF/CodeGenerationKit/IndentationImplanter.hpp" + +using namespace CCF; +using namespace CIDL; +using namespace SemanticGraph; +using namespace Traversal; + +using std::string; +using std::ostream; + +namespace +{ + // On some platforms toupper can be something else than a + // function. + int + upcase (int c) + { + return toupper (c); + } +} + +ExecImplGenerator::ExecImplGenerator (CommandLine const& cl) + : cl_ (cl), + file_name_ (""), + export_macro_ ("") +{ +} + +void ExecImplGenerator::options (CL::Description& d) +{ + d.add_option (CL::OptionDescription ( + "exec-hdr-file-suffix", + "suffix", + "Use provided suffix instead of default \'_exec.h\' " + "when constructing name of executor implementation file.", + true)); + + d.add_option (CL::OptionDescription ( + "exec-hdr-file-regex", + "regex", + "Use provided regular expression when constructing " + "name of executor implementation file.", + true)); + d.add_option (CL::OptionDescription ( + "exec-src-file-suffix", + "suffix", + "Use provided suffix instead of default \'_exec.cpp\' " + "when constructing name of executor implementation file.", + true)); + + d.add_option (CL::OptionDescription ( + "exec-src-file-regex", + "regex", + "Use provided regular expression when constructing " + "name of executor implementation file.", + true)); + d.add_option (CL::OptionDescription ( + "exec-export-macro", + "macro", + "Replace default executor DLL export macro " + "with provided macro.", + true)); + d.add_option (CL::OptionDescription ( + "exec-export-include", + "file", + "Replace default executor export include file " + "with provided file.", + true)); +} + + +void ExecImplGenerator::generate (SemanticGraph::TranslationUnit& u, + fs::path const& file) +{ + // Generate files + compute_export_macro (file); + + { + fs::ofstream hdr_ofs; + ostream& hdr_os = configure_stream ("exec-hdr-file-suffix", + "_exec.h", + "exec-hdr-file-regex", + hdr_ofs); + + Indentation::Implanter<Indentation::Cxx> header_guard (hdr_os); + + + ExecImplHeaderEmitter hdr_emitter (hdr_os, + cl_, + export_macro_, + file); + hdr_emitter.generate (u); + } + + { + fs::ofstream src_ofs; + ostream& src_os = configure_stream ("exec-src-file-suffix", + "_exec.cpp", + "exec-src-file-regex", + src_ofs); + + Indentation::Implanter<Indentation::Cxx> header_guard (src_os); + + ExecImplSourceEmitter src_emitter (src_os, + cl_, + export_macro_, + file); + src_emitter.generate (u); + } +} + +void +ExecImplGenerator::compute_export_macro (const fs::path& file_path) +{ + if (!file_path.empty ()) + { + file_name_ = file_path.leaf (); + } + + export_macro_ = cl_.get_value ("exec-export-macro", ""); + + if (export_macro_.empty () && !file_name_.empty ()) + { + // Modify a copy of the filename string. + export_macro_ = file_name_; + + // Convert filename string to upper case. + transform (export_macro_.begin (), + export_macro_.end (), + export_macro_.begin (), + upcase); + + // Replace the suffix. + export_macro_ = + regex::perl_s (export_macro_, + "/(\\.(IDL|CIDL))?$/_EXEC_Export/"); + + // Replace any remaining '.' in the string with '_'. + export_macro_ = regex::perl_s (export_macro_, + "/\\./_/"); + } +} + +ostream& +ExecImplGenerator::configure_stream (string const& suffix_option, + string const& default_suffix, + string const& regex_option, + fs::ofstream& ofs) +{ + if (! file_name_.empty ()) + { + string file_suffix = cl_.get_value (suffix_option, + default_suffix); + string file_expr = + cl_.get_value (regex_option, + "/(\\.(idl|cidl))?$/" + file_suffix + "/"); + + string file_name = regex::perl_s (file_name_, file_expr); + + fs::path file_path (file_name); + + ofs.open (file_path, std::ios_base::out); + + if (!ofs.is_open ()) + { + cerr << file_name + << ": error: unable to open file in write mode" + << endl; + } + } + + return ofs.is_open () + ? static_cast<ostream&> (ofs) + : static_cast<ostream&> (std::cout); +} + diff --git a/TAO/CIAO/CIDLC/ExecImplGenerator.hpp b/TAO/CIAO/CIDLC/ExecImplGenerator.hpp new file mode 100644 index 00000000000..17a366172a2 --- /dev/null +++ b/TAO/CIAO/CIDLC/ExecImplGenerator.hpp @@ -0,0 +1,44 @@ +// file : CIDLC/ExecImplGenerator.hpp +// author : Jeff Parsons <j.parsons@vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef EXEC_IMPL_GENERATOR_HPP +#define EXEC_IMPL_GENERATOR_HPP + +#include "CCF/CodeGenerationKit/CommandLine.hpp" +#include "CCF/CodeGenerationKit/CommandLineDescriptor.hpp" + +#include "CCF/CIDL/SemanticGraph.hpp" +#include "CCF/CIDL/Traversal.hpp" + +class ExecImplGenerator +{ +public: + ExecImplGenerator (CommandLine const& cl); + + void + options (CL::Description& d); + + void + generate (CCF::CIDL::SemanticGraph::TranslationUnit&, + fs::path const& file); + +private: + void + compute_export_macro (const fs::path& file_path); + + std::ostream& + configure_stream (std::string const& suffix_option, + std::string const& default_suffix, + std::string const& regex_option, + fs::ofstream& ofs); + +private: + CommandLine const& cl_; + std::string file_name_; + std::string export_macro_; +}; + + +#endif // EXEC_IMPL_GENERATOR_HPP + diff --git a/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp b/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp new file mode 100644 index 00000000000..9c99b88200d --- /dev/null +++ b/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.cpp @@ -0,0 +1,1333 @@ +// file : CIDLC/ExecImplHeaderGenerator.cpp +// author : Jeff Parsons <j.parsons@vanderbilt.edu> +// cvs-id : $Id$ + +#include "ExecImplHeaderGenerator.hpp" +#include "TypeNameEmitter.hpp" +#include "Literals.hpp" + +#include <ostream> + +#include "CCF/CodeGenerationKit/Regex.hpp" + +using std::endl; + +using namespace StringLiterals; +using namespace CCF::CIDL; +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 << endl + << "namespace " << t.name () << "{"; + } + + virtual void + post (Type&) + { + os << "}"; + } + }; + + struct CompositionEmitter : Traversal::Composition, EmitterBase + { + CompositionEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + pre (Type& t) + { + os << endl + << "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; + } + + virtual void + comma (Type&) + { + os << "," << endl; + } + }; + + // For generating parameter names. + template <typename T> + 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<UnconstrainedInterface*> interfaces_; + }; + + struct FacetEmitter : Traversal::UnconstrainedInterface, + EmitterBase + { + FacetEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + traverse (UnconstrainedInterface& i) + { + if (i.context ().count ("facet_impl_hdr_gen")) return; + + os << "class " << ctx.export_macro () << " " + << i.name () << "_exec_i" << endl + << ": public virtual " << i.scoped_name ().scope_name () + << "::CCM_" << i.name () << "," << endl + << "public virtual TAO_Local_RefCounted_Object" << endl + << "{" + << "public:" << endl + << i.name () << "_exec_i (void);" + << "virtual ~" << i.name () << "_exec_i (void);" << endl + << "// Operations from " << i.scoped_name () << endl << endl; + + { + InterfaceEmitter interface_emitter (ctx); + + Traversal::Defines defines_; + Traversal::Inherits inherits_; + interface_emitter.edge_traverser (defines_); + interface_emitter.edge_traverser (inherits_); + + AttributeEmitter attribute_emitter (ctx); + ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + defines_.node_traverser (attribute_emitter); + defines_.node_traverser (read_only_attribute_emitter); + + OperationEmitter operation_emitter (ctx); + defines_.node_traverser (operation_emitter); + inherits_.node_traverser (interface_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + operation_emitter.edge_traverser (receives); + operation_emitter.edge_traverser (returns); + operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + inherits (i, inherits_); + names (i, defines_); + } + + os << "};"; + + i.context ().set ("facet_impl_hdr_gen", true); + } + }; + + struct ExecPortsEmitter : Traversal::ConsumerData, + Traversal::ProviderData, + EmitterBase + { + ExecPortsEmitter (Context& c) + : EmitterBase (c), + enclosing_type_name_emitter_ (c.os ()), + simple_type_name_emitter_ (c.os ()), + type_name_emitter_ (c.os ()) + { + enclosing_belongs_.node_traverser (enclosing_type_name_emitter_); + simple_belongs_.node_traverser (simple_type_name_emitter_); + belongs_.node_traverser (type_name_emitter_); + } + + virtual void + traverse (SemanticGraph::Provider& p) + { + os << "virtual "; + + Traversal::ProviderData::belongs (p, enclosing_belongs_); + + os << "::CCM_"; + + Traversal::ProviderData::belongs (p, simple_belongs_); + + os << "_ptr" << 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; + + Traversal::ConsumerData::belongs (c, belongs_); + + os << " *ev" << endl + << STRS[ENV_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; + } + + private: + EnclosingTypeNameEmitter enclosing_type_name_emitter_; + SimpleTypeNameEmitter simple_type_name_emitter_; + TypeNameEmitter type_name_emitter_; + Traversal::Belongs enclosing_belongs_; + Traversal::Belongs simple_belongs_; + Traversal::Belongs belongs_; + }; + + struct ComponentExecImplEmitter : Traversal::Component, EmitterBase + { + ComponentExecImplEmitter (Context& c, ComponentExecutor& exec) + : EmitterBase (c), + exec_ (exec) + { + } + + virtual void + pre (Type& t) + { + // Generate the facet executor class(es) first. + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (component_inherits); + + Traversal::Provider provider; + defines.node_traverser (provider); + + Traversal::Belongs belongs; + provider.edge_traverser (belongs); + + FacetEmitter facet_emitter (ctx); + belongs.node_traverser (facet_emitter); + + component_emitter.traverse (t); + } + + os << "class " << ctx.export_macro () << " " + << t.name () << "_exec_i" << endl + << ": public virtual " << exec_.name () << "," << endl + << "public virtual TAO_Local_RefCounted_Object" << endl + << "{" + << "public:" << endl + << t.name () << "_exec_i (void);" + << "virtual ~" << t.name () << "_exec_i (void);" << endl; + + os << "// Supported or inherited operations." << endl << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + Traversal::Supports supports_; + component_emitter.edge_traverser (component_inherits); + component_emitter.edge_traverser (supports_); + InterfaceEmitter interface_emitter (ctx); + supports_.node_traverser (interface_emitter); + + Traversal::Defines defines; + Traversal::Inherits interface_inherits; + interface_emitter.edge_traverser (defines); + interface_emitter.edge_traverser (interface_inherits); + + AttributeEmitter attribute_emitter (ctx); + ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + OperationEmitter operation_emitter (ctx); + defines.node_traverser (operation_emitter); + interface_inherits.node_traverser (interface_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + operation_emitter.edge_traverser (receives); + operation_emitter.edge_traverser (returns); + operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + component_emitter.traverse (t); + } + + os << "// Attribute operations." << endl << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + component_emitter.edge_traverser (component_inherits); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + + AttributeEmitter attribute_emitter (ctx); + ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + component_emitter.traverse (t); + } + + os << "// Port operations." << endl << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + component_emitter.edge_traverser (component_inherits); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + + ExecPortsEmitter exec_ports_emitter (ctx); + defines.node_traverser (exec_ports_emitter); + + component_emitter.traverse (t); + } + + os << "// Operations from Components::SessionComponent" << endl << endl; + + os << "virtual void" << endl + << "set_session_context (" << endl + << STRS[COMP_SC] << "_ptr ctx" << endl + << STRS[ENV_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "));" << endl; + + os << "virtual void" << endl + << "ciao_preactivate (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "));" << endl; + + os << "virtual void" << endl + << "ciao_postactivate (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "));" << endl; + + os << "virtual void" << endl + << "ccm_activate (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "));" << endl; + + os << "virtual void" << endl + << "ccm_passivate (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "));" << endl; + + os << "virtual void" << endl + << "ccm_remove (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "));" << endl; + } + + virtual void + post (Type& t) + { + os << "protected:" << endl + << "CIAO_GLUE" + << regex::perl_s (t.scoped_name ().scope_name ().str (), + "/::/_/") + << "::" << t.name () << "_Context *context_;" << endl + << "};"; + } + + private: + ComponentExecutor& exec_; + }; + + struct ComponentExecutorEmitter : Traversal::ComponentExecutor, EmitterBase + { + ComponentExecutorEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + implements (Type& i) + { + Traversal::ComponentExecutor component_executor; + + Traversal::Implements implements; + component_executor.edge_traverser (implements); + + ComponentExecImplEmitter component_exec_impl_emitter (ctx, i); + implements.node_traverser (component_exec_impl_emitter); + + component_executor.traverse (i); + } + }; + + // 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& hf) + { + 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& t) + { + 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) + : EmitterBase (c), + exec_ (exec) + { + } + + virtual void + pre (Type& t) + { + os << "class " << ctx.export_macro () << " " + << t.name () << "_exec_i" << endl + << ": public virtual " << exec_.name () << "," << endl + << "public virtual TAO_Local_RefCounted_Object" << endl + << "{" + << "public:" << endl + << t.name () << "_exec_i (void);" + << "virtual ~" << t.name () << "_exec_i (void);" << endl; + + os << "// Supported or inherited operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits home_inherits; + home_inherits.node_traverser (home_emitter); + + Traversal::Supports supports_; + home_emitter.edge_traverser (home_inherits); + home_emitter.edge_traverser (supports_); + InterfaceEmitter interface_emitter (ctx); + supports_.node_traverser (interface_emitter); + + Traversal::Defines defines; + Traversal::Inherits interface_inherits; + interface_emitter.edge_traverser (defines); + interface_emitter.edge_traverser (interface_inherits); + + AttributeEmitter attribute_emitter (ctx); + ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + OperationEmitter operation_emitter (ctx); + defines.node_traverser (operation_emitter); + interface_inherits.node_traverser (interface_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + operation_emitter.edge_traverser (receives); + operation_emitter.edge_traverser (returns); + operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + home_emitter.traverse (t); + } + + os << "// Home operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits home_inherits; + home_inherits.node_traverser (home_emitter); + + Traversal::Defines defines; + home_emitter.edge_traverser (defines); + home_emitter.edge_traverser (home_inherits); + + HomeOperationEmitter home_operation_emitter (ctx); + defines.node_traverser (home_operation_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + home_operation_emitter.edge_traverser (receives); + home_operation_emitter.edge_traverser (returns); + home_operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + home_emitter.traverse (t); + } + + // Generate home factory operations. This is a separate traversal + // stack because we want to generate the factory operations + // of ancestors with the return type of the base component. + os << "// Factory and finder operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits inherits; + home_emitter.edge_traverser (inherits); + inherits.node_traverser (home_emitter); + + Traversal::Defines defines; + home_emitter.edge_traverser (defines); + + FactoryOperationEmitter factory_operation_emitter (ctx); + FinderOperationEmitter finder_operation_emitter (ctx); + defines.node_traverser (factory_operation_emitter); + defines.node_traverser (finder_operation_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + factory_operation_emitter.edge_traverser (receives); + factory_operation_emitter.edge_traverser (returns); + factory_operation_emitter.edge_traverser (raises); + finder_operation_emitter.edge_traverser (receives); + finder_operation_emitter.edge_traverser (returns); + finder_operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + home_emitter.traverse (t); + } + + os << "// Attribute operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits home_inherits; + home_inherits.node_traverser (home_emitter); + + home_emitter.edge_traverser (home_inherits); + + Traversal::Defines defines; + home_emitter.edge_traverser (defines); + + AttributeEmitter attribute_emitter (ctx); + ReadOnlyAttributeEmitter read_only_attribute_emitter (ctx); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + home_emitter.traverse (t); + } + + os << "// Implicit operations." << endl << endl + << "virtual " << STRS[COMP_EC] << "_ptr" << endl + << "create (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "));" << endl; + } + + virtual void + post (Type& t) + { + os << "};"; + + os << "extern \"C\" " << ctx.export_macro () + << " ::Components::HomeExecutorBase_ptr" << endl + << "create" << t.name () << "_Impl (void);" << endl; + } + + private: + HomeExecutor& exec_; + }; + + struct HomeExecutorEmitter : Traversal::HomeExecutor, EmitterBase + { + HomeExecutorEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + implements (Type& i) + { + Traversal::HomeExecutor home_executor; + + Traversal::Implements implements; + home_executor.edge_traverser (implements); + + HomeExecImplEmitter home_exec_impl_emitter (ctx, i); + implements.node_traverser (home_exec_impl_emitter); + + home_executor.traverse (i); + } + }; +} + +ExecImplHeaderEmitter::ExecImplHeaderEmitter (std::ostream& os_, + CommandLine const& cl, + string export_macro, + fs::path const& file) + : os (os_), + cl_ (cl), + export_macro_ (export_macro), + file_ (file) +{} + +void +ExecImplHeaderEmitter::pre (TranslationUnit& u) +{ + os << COPYRIGHT; + + string file_name (""); + + if (!file_.empty ()) + { + file_name = file_.leaf (); + } + + string uc_file_name = file_name; + + std::transform (uc_file_name.begin (), + uc_file_name.end (), + uc_file_name.begin (), + upcase); + + string uc_file_suffix = cl_.get_value ("exec-hdr-file-suffix", + "_exec.h"); + + std::transform (uc_file_suffix.begin (), + uc_file_suffix.end (), + uc_file_suffix.begin (), + upcase); + + string guard = + "CIAO_" + + regex::perl_s (uc_file_name, + "/(\\.(IDL|CIDL))?$/" + uc_file_suffix + "/"); + + // Replace any remaining '.' with '_'. + guard = regex::perl_s (guard, "/\\./_/"); + + os << "#ifndef " << guard << endl + << "#define " << guard << endl << endl + << "#include /**/ \"ace/pre.h\"" << endl << endl; + + string file_suffix = cl_.get_value ("svnt-hdr-file-suffix", + "_svnt.h"); + + file_name = regex::perl_s (file_name, + "/(\\.(idl|cidl))?$/" + + file_suffix + + "/"); + + os << "#include \"" << file_name << "\"" << endl << endl; + + os << "#if !defined (ACE_LACKS_PRAGMA_ONCE)" << endl + << "# pragma once" << endl + << "#endif /* ACE_LACKS_PRAGMA_ONCE */" << endl << endl; + + string export_include = cl_.get_value ("exec-export-include", ""); + + if (!export_include.empty ()) + { + os << "#include \"" << export_include << "\"" << endl; + } + + os << "#include \"tao/LocalObject.h\"" << endl; +} + +void +ExecImplHeaderEmitter::generate (TranslationUnit& u) +{ + pre (u); + + Context c (os, export_macro_); + + Traversal::TranslationUnit unit; + + // Layer 1 + // + Traversal::ContainsPrincipal contains_principal; + unit.edge_traverser (contains_principal); + + //-- + Traversal::TranslationRegion principal_region; + contains_principal.node_traverser (principal_region); + + // Layer 2 + // + Traversal::ContainsRoot contains_root; + principal_region.edge_traverser (contains_root); + + //-- + Traversal::Root root; + contains_root.node_traverser (root); + + // Layer 3 + // + Traversal::Defines defines; + root.edge_traverser (defines); + + //-- + ModuleEmitter module (c); + CompositionEmitter composition (c); + defines.node_traverser (module); + defines.node_traverser (composition); + + // Layer 4 + // + composition.edge_traverser (defines); + module.edge_traverser (defines); + + //-- + ComponentExecutorEmitter component_executor (c); + HomeExecutorEmitter home_executor (c); + defines.node_traverser (component_executor); + defines.node_traverser (home_executor); + + // Layer 5 + // + Traversal::Implements implements; + component_executor.edge_traverser (implements); + home_executor.edge_traverser (implements); + + unit.traverse (u); + + post (u); +} + +void +ExecImplHeaderEmitter::post (TranslationUnit& u) +{ + if (file_.empty ()) return; + + string uc_file_name = file_.leaf (); + + std::transform (uc_file_name.begin (), + uc_file_name.end (), + uc_file_name.begin (), + upcase); + + string uc_file_suffix = cl_.get_value ("exec-hdr-file-suffix", + "_exec.h"); + + std::transform (uc_file_suffix.begin (), + uc_file_suffix.end (), + uc_file_suffix.begin (), + upcase); + + string guard = + "CIAO_" + + regex::perl_s (uc_file_name, + "/(\\.(IDL|CIDL))?$/" + uc_file_suffix + "/"); + + guard = regex::perl_s (guard, "/\\./_/"); + + os << "#include /**/ \"ace/post.h\"" << endl << endl + << "#endif /* " << guard << " */" + << endl << endl; +} + diff --git a/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.hpp b/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.hpp new file mode 100644 index 00000000000..9ebe0cd300c --- /dev/null +++ b/TAO/CIAO/CIDLC/ExecImplHeaderGenerator.hpp @@ -0,0 +1,43 @@ +// file : CIDLC/ServantHeaderGenerator.hpp +// author : Jeff Parsons <j.parsons@vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef EXEC_IMPL_HEADER_GENERATOR_HPP +#define EXEC_IMPL_HEADER_GENERATOR_HPP + +#include "CCF/CodeGenerationKit/CommandLine.hpp" + +#include "CCF/CIDL/SemanticGraph.hpp" +#include "CCF/CIDL/Traversal.hpp" + +using std::string; + +class ExecImplHeaderEmitter +{ +public: + ExecImplHeaderEmitter (std::ostream& os_, + CommandLine const& cl, + string export_macro, + fs::path const& file); + + virtual ~ExecImplHeaderEmitter () {} + + virtual void + pre (CCF::CIDL::SemanticGraph::TranslationUnit& u); + + virtual void + generate (CCF::CIDL::SemanticGraph::TranslationUnit& u); + + virtual void + post (CCF::CIDL::SemanticGraph::TranslationUnit& u); + +private: + std::ostream& os; + CommandLine const& cl_; + string export_macro_; + fs::path file_; +}; + + +#endif // EXEC_IMPL_HEADER_GENERATOR_HPP + diff --git a/TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp b/TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp new file mode 100644 index 00000000000..2e12a819fad --- /dev/null +++ b/TAO/CIAO/CIDLC/ExecImplSourceGenerator.cpp @@ -0,0 +1,1370 @@ +// file : CIDLC/ExecImplSourceGenerator.cpp +// author : Jeff Parsons <j.parsons@vanderbilt.edu> +// cvs-id : $Id$ + +#include "ExecImplSourceGenerator.hpp" +#include "Literals.hpp" +#include "TypeNameEmitter.hpp" + +#include "CCF/CodeGenerationKit/Regex.hpp" + +#include <ostream> + +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 << endl + << "namespace " << t.name () << "{"; + } + + virtual void + post (Type&) + { + os << "}"; + } + }; + + struct CompositionEmitter : Traversal::Composition, EmitterBase + { + CompositionEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + pre (Type& t) + { + os << endl + << "namespace " << t.name () << "{"; + } + + virtual void + post (Type&) + { + os << "}"; + } + }; + + template <typename T> + struct OperationEmitter : Traversal::Operation, EmitterBase + { + OperationEmitter (Context& c, T& scope) + : EmitterBase (c), + scope_ (scope) + {} + + virtual void + name (Type& o) + { + os << endl + << scope_.name () << "_exec_i::" << o.name (); + } + + virtual void + receives_pre (Type&) + { + os << " (" << endl; + } + + virtual void + receives_none (Type&) + { + os << " (" << endl + << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl; + } + + virtual void + receives_post (Type&) + { + os << endl << STRS[ENV_SRC_NOTUSED] << ")" << 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& o) + { + os << "{" + << STRS[YCH] << endl; + + Traversal::Operation operation_emitter; + + Traversal::Belongs returns; + operation_emitter.edge_traverser (returns); + + NullReturnEmitter return_emitter (os); + returns.node_traverser (return_emitter); + + operation_emitter.traverse (o); + + os << "}"; + } + + virtual void + comma (Type&) + { + os << "," << endl; + } + + protected: + T& scope_; + }; + + // For generating parameter names. + template <typename T> + 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 <typename T> + struct AttributeEmitter : Traversal::ReadWriteAttribute, + EmitterBase + { + AttributeEmitter (Context& c, T& scope) + : EmitterBase (c), + write_type_name_emitter_ (c.os ()), + read_type_name_emitter_ (c.os ()), + return_emitter_ (c.os ()), + scope_ (scope) + { + 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 <typename T> + struct ReadOnlyAttributeEmitter : Traversal::ReadAttribute, + EmitterBase + { + ReadOnlyAttributeEmitter (Context& c, T& scope) + : EmitterBase (c), + read_type_name_emitter_ (c.os ()), + return_emitter_ (c.os ()), + scope_ (scope) + { + 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<UnconstrainedInterface*> interfaces_; + }; + + struct FacetEmitter : Traversal::UnconstrainedInterface, + EmitterBase + { + FacetEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + traverse (UnconstrainedInterface& i) + { + if (i.context ().count ("facet_impl_src_gen")) return; + + os << STRS[SEP] << endl + << "// Facet Executor Implementation Class: " + << i.name () << "_exec_i" << endl + << STRS[SEP] << endl << endl; + + os << i.name () << "_exec_i::" + << i.name () << "_exec_i (void)" << endl + << "{" + << "}" + << i.name () << "_exec_i::~" + << i.name () << "_exec_i (void)" << endl + << "{" + << "}" + << "// Operations from " << i.scoped_name () << endl << endl; + + { + InterfaceEmitter interface_emitter (ctx); + + Traversal::Defines defines_; + Traversal::Inherits inherits_; + interface_emitter.edge_traverser (defines_); + interface_emitter.edge_traverser (inherits_); + + AttributeEmitter<UnconstrainedInterface> attribute_emitter (ctx, i); + ReadOnlyAttributeEmitter<UnconstrainedInterface> read_only_attribute_emitter (ctx, i); + defines_.node_traverser (attribute_emitter); + defines_.node_traverser (read_only_attribute_emitter); + + OperationEmitter<UnconstrainedInterface> operation_emitter (ctx, i); + defines_.node_traverser (operation_emitter); + inherits_.node_traverser (interface_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + operation_emitter.edge_traverser (receives); + operation_emitter.edge_traverser (returns); + operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + inherits (i, inherits_); + names (i, defines_); + } + + i.context ().set ("facet_impl_src_gen", true); + } + }; + + struct ExecPortsEmitter : Traversal::ConsumerData, + Traversal::ProviderData, + EmitterBase + { + 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 ()), + scope_ (scope) + { + enclosing_belongs_.node_traverser (enclosing_type_name_emitter_); + simple_belongs_.node_traverser (simple_type_name_emitter_); + belongs_.node_traverser (type_name_emitter_); + } + + virtual void + traverse (SemanticGraph::Provider& p) + { + Traversal::ProviderData::belongs (p, enclosing_belongs_); + + os << "::CCM_"; + + Traversal::ProviderData::belongs (p, simple_belongs_); + + os << "_ptr" << endl + << scope_.name () << "_exec_i::get_" + << p.name () << " (" << endl + << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl + << STRS[EXCP_SNGL] << endl + << "{" + << STRS[YCH] << endl + << "return "; + + Traversal::ProviderData::belongs (p, enclosing_belongs_); + + os << "::CCM_"; + + Traversal::ProviderData::belongs (p, simple_belongs_); + + os << "::_nil ();" << 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 << "void" << endl + << scope_.name () << "_exec_i::push_" + << c.name () << " (" << endl; + + Traversal::ConsumerData::belongs (c, belongs_); + + os << " * /* ev */" << endl + << STRS[ENV_SRC_NOTUSED] << ")" << endl + << STRS[EXCP_SNGL] << endl + << "{" + << STRS[YCH] << endl + << "}"; + } + + private: + EnclosingTypeNameEmitter enclosing_type_name_emitter_; + SimpleTypeNameEmitter simple_type_name_emitter_; + TypeNameEmitter type_name_emitter_; + Traversal::Belongs enclosing_belongs_; + Traversal::Belongs simple_belongs_; + Traversal::Belongs belongs_; + SemanticGraph::Component& scope_; + }; + + struct ComponentExecImplEmitter : Traversal::Component, EmitterBase + { + ComponentExecImplEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + pre (Type& t) + { + // Generate the facet executor class(es) first. + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + component_emitter.edge_traverser (component_inherits); + + Traversal::Provider provider; + defines.node_traverser (provider); + + Traversal::Belongs belongs; + provider.edge_traverser (belongs); + + FacetEmitter facet_emitter (ctx); + belongs.node_traverser (facet_emitter); + + component_emitter.traverse (t); + } + + os << STRS[SEP] << endl + << "// Component Executor Implementation Class: " + << t.name () << "_exec_i" << endl + << STRS[SEP] << endl << endl; + + os << t.name () << "_exec_i::" + << t.name () << "_exec_i (void)" << endl + << "{" + << "}" + << t.name () << "_exec_i::~" + << t.name () << "_exec_i (void)" << endl + << "{" + << "}"; + + os << "// Supported or inherited operations." << endl << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + Traversal::Supports supports_; + component_emitter.edge_traverser (component_inherits); + component_emitter.edge_traverser (supports_); + InterfaceEmitter interface_emitter (ctx); + supports_.node_traverser (interface_emitter); + + Traversal::Defines defines; + Traversal::Inherits interface_inherits; + interface_emitter.edge_traverser (defines); + interface_emitter.edge_traverser (interface_inherits); + + AttributeEmitter<SemanticGraph::Component> attribute_emitter (ctx, t); + ReadOnlyAttributeEmitter<SemanticGraph::Component> read_only_attribute_emitter (ctx, t); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + OperationEmitter<SemanticGraph::Component> operation_emitter (ctx, t); + defines.node_traverser (operation_emitter); + interface_inherits.node_traverser (interface_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + operation_emitter.edge_traverser (receives); + operation_emitter.edge_traverser (returns); + operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + component_emitter.traverse (t); + } + + os << "// Attribute operations." << endl << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + component_emitter.edge_traverser (component_inherits); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + + AttributeEmitter<SemanticGraph::Component> attribute_emitter (ctx, t); + ReadOnlyAttributeEmitter<SemanticGraph::Component> read_only_attribute_emitter (ctx, t); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + component_emitter.traverse (t); + } + + os << "// Port operations." << endl << endl; + + { + Traversal::Component component_emitter; + + Traversal::Inherits component_inherits; + component_inherits.node_traverser (component_emitter); + + component_emitter.edge_traverser (component_inherits); + + Traversal::Defines defines; + component_emitter.edge_traverser (defines); + + ExecPortsEmitter exec_ports_emitter (ctx, t); + defines.node_traverser (exec_ports_emitter); + + component_emitter.traverse (t); + } + + os << "// Operations from Components::SessionComponent" << endl << endl; + + os << "void" << endl + << t.name () << "_exec_i::set_session_context (" << endl + << STRS[COMP_SC] << "_ptr ctx" << endl + << STRS[ENV_SRC] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "))" << endl + << "{" + << "this->context_ =" << endl + << "CIAO_GLUE" + << regex::perl_s (t.scoped_name ().scope_name ().str (), + "/::/_/") + << "::" << t.name () << "_Context::_narrow (" << endl + << "ctx" << endl + << STRS[ENV_ARG] <<");" + << "ACE_CHECK;" << endl; + + os << "if (this->context_ == 0)" << endl + << "{" + << "ACE_THROW (CORBA::INTERNAL ());" + << "}" + << "}"; + + os << "void" << endl + << t.name () << "_exec_i::ciao_preactivate (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "))" << endl + << "{" + << STRS[YCH] + << "}"; + + os << "void" << endl + << t.name () << "_exec_i::ciao_postactivate (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "))" << endl + << "{" + << STRS[YCH] + << "}"; + + os << "void" << endl + << t.name () << "_exec_i::ccm_activate (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "))" << endl + << "{" + << STRS[YCH] + << "}"; + + os << "void" << endl + << t.name () << "_exec_i::ccm_passivate (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "))" << endl + << "{" + << STRS[YCH] + << "}"; + + os << "void" << endl + << t.name () << "_exec_i::ccm_remove (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "))" << endl + << "{" + << STRS[YCH] + << "}"; + } + + virtual void + post (Type& t) + { + } + }; + + // 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<SemanticGraph::Home>, + Traversal::HomeFactory, + Traversal::HomeFinder + { + HomeOperationEmitter (Context& c, SemanticGraph::Home& scope) + : OperationEmitter<SemanticGraph::Home> (c, scope) + {} + + virtual void + traverse (SemanticGraph::HomeFactory&) + { + } + + virtual void + traverse (SemanticGraph::HomeFinder&) + { + } + }; + + struct FactoryOperationEmitter : Traversal::HomeFactory, + EmitterBase + { + FactoryOperationEmitter (Context& c, SemanticGraph::Home& scope) + : EmitterBase (c), + enclosing_type_name_emitter_ (c.os ()), + simple_type_name_emitter_ (c.os ()), + scope_ (scope) + { + enclosing_returns_.node_traverser (enclosing_type_name_emitter_); + simple_returns_.node_traverser (simple_type_name_emitter_); + } + + virtual void + returns (SemanticGraph::HomeFactory& hf) + { + os << STRS[COMP_EC] << "_ptr" << endl; + } + + virtual void + name (SemanticGraph::HomeFactory& hf) + { + os << scope_.name () << "_exec_i::" << hf.name (); + } + + virtual void + receives_none (SemanticGraph::HomeFactory&) + { + os << " (" << endl + << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl; + } + + virtual void + receives_pre (SemanticGraph::HomeFactory&) + { + os << " (" << endl; + } + + virtual void + receives_post (SemanticGraph::HomeFactory&) + { + os << endl << STRS[ENV_SRC_NOTUSED] << ")" << 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& hf) + { + os << "{" + << STRS[YCH] << endl + << "return "; + + Traversal::HomeFactory::returns (hf, enclosing_returns_); + + os << "::CCM_"; + + Traversal::HomeFactory::returns (hf, simple_returns_); + + os << "::_nil ();" + << "}"; + } + + virtual void + comma (SemanticGraph::HomeFactory&) + { + os << "," << endl; + } + + private: + EnclosingTypeNameEmitter enclosing_type_name_emitter_; + SimpleTypeNameEmitter simple_type_name_emitter_; + Traversal::Returns enclosing_returns_; + Traversal::Returns simple_returns_; + SemanticGraph::Home& scope_; + }; + + struct FinderOperationEmitter : Traversal::HomeFinder, + EmitterBase + { + FinderOperationEmitter (Context& c, SemanticGraph::Home& scope) + : EmitterBase (c), + enclosing_type_name_emitter_ (c.os ()), + simple_type_name_emitter_ (c.os ()), + scope_ (scope) + { + enclosing_returns_.node_traverser (enclosing_type_name_emitter_); + simple_returns_.node_traverser (simple_type_name_emitter_); + } + + virtual void + returns (SemanticGraph::HomeFinder& hf) + { + os << STRS[COMP_EC] << "_ptr" << endl; + } + + virtual void + name (SemanticGraph::HomeFinder& hf) + { + os << scope_.name () << "_exec_i::" << hf.name (); + } + + virtual void + receives_none (SemanticGraph::HomeFinder&) + { + os << " (" << endl + << STRS[ENV_SNGL_SRC_NOTUSED] << ")" << endl; + } + + virtual void + receives_pre (SemanticGraph::HomeFinder&) + { + os << " (" << endl; + } + + virtual void + receives_post (SemanticGraph::HomeFinder&) + { + os << endl << STRS[ENV_SRC_NOTUSED] << ")" << 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& hf) + { + os << "{" + << STRS[YCH] << endl + << "return "; + + Traversal::HomeFinder::returns (hf, enclosing_returns_); + + os << "::CCM_"; + + Traversal::HomeFinder::returns (hf, simple_returns_); + + os << "::_nil ();" + << "}"; + } + + virtual void + comma (SemanticGraph::HomeFinder&) + { + os << "," << endl; + } + + private: + EnclosingTypeNameEmitter enclosing_type_name_emitter_; + SimpleTypeNameEmitter simple_type_name_emitter_; + Traversal::Returns enclosing_returns_; + Traversal::Returns simple_returns_; + SemanticGraph::Home& scope_; + }; + + struct HomeExecImplEmitter : Traversal::Home, EmitterBase + { + HomeExecImplEmitter (Context& c) + : EmitterBase (c) + { + } + + virtual void + pre (Type& t) + { + os << STRS[SEP] << endl + << "// Home Executor Implementation Class: " + << t.name () << "_exec_i" << endl + << STRS[SEP] << endl << endl; + + os << t.name () << "_exec_i::" + << t.name () << "_exec_i (void)" << endl + << "{" + << "}" + << t.name () << "_exec_i::~" + << t.name () << "_exec_i (void)" << endl + << "{" + << "}"; + + os << "// Supported or inherited operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits home_inherits; + home_inherits.node_traverser (home_emitter); + + Traversal::Supports supports_; + home_emitter.edge_traverser (home_inherits); + home_emitter.edge_traverser (supports_); + InterfaceEmitter interface_emitter (ctx); + supports_.node_traverser (interface_emitter); + + Traversal::Defines defines; + Traversal::Inherits interface_inherits; + interface_emitter.edge_traverser (defines); + interface_emitter.edge_traverser (interface_inherits); + + AttributeEmitter<SemanticGraph::Home> attribute_emitter (ctx, t); + ReadOnlyAttributeEmitter<SemanticGraph::Home> read_only_attribute_emitter (ctx, t); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + OperationEmitter<SemanticGraph::Home> operation_emitter (ctx, t); + defines.node_traverser (operation_emitter); + interface_inherits.node_traverser (interface_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + operation_emitter.edge_traverser (receives); + operation_emitter.edge_traverser (returns); + operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + home_emitter.traverse (t); + } + + os << "// Home operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits home_inherits; + home_inherits.node_traverser (home_emitter); + + Traversal::Defines defines; + home_emitter.edge_traverser (defines); + home_emitter.edge_traverser (home_inherits); + + HomeOperationEmitter home_operation_emitter (ctx, t); + defines.node_traverser (home_operation_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + home_operation_emitter.edge_traverser (receives); + home_operation_emitter.edge_traverser (returns); + home_operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + home_emitter.traverse (t); + } + + // Generate home factory operations. This is a separate traversal + // stack because we want to generate the factory operations + // of ancestors with the return type of the base component. + os << "// Factory and finder operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits inherits; + home_emitter.edge_traverser (inherits); + inherits.node_traverser (home_emitter); + + Traversal::Defines defines; + home_emitter.edge_traverser (defines); + + FactoryOperationEmitter factory_operation_emitter (ctx, t); + FinderOperationEmitter finder_operation_emitter (ctx, t); + defines.node_traverser (factory_operation_emitter); + defines.node_traverser (finder_operation_emitter); + + Traversal::Receives receives; + Traversal::Belongs returns; + Traversal::Raises raises; + factory_operation_emitter.edge_traverser (receives); + factory_operation_emitter.edge_traverser (returns); + factory_operation_emitter.edge_traverser (raises); + finder_operation_emitter.edge_traverser (receives); + finder_operation_emitter.edge_traverser (returns); + finder_operation_emitter.edge_traverser (raises); + + ParameterEmitter<Traversal::InParameter> in_param (os); + ParameterEmitter<Traversal::InOutParameter> inout_param (os); + ParameterEmitter<Traversal::OutParameter> out_param (os); + 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); + returns.node_traverser (return_type_emitter); + raises.node_traverser (type_name_emitter); + + Traversal::Belongs in_belongs, inout_belongs, out_belongs; + in_param.edge_traverser (in_belongs); + 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); + in_belongs.node_traverser (in_arg_emitter); + inout_belongs.node_traverser (inout_arg_emitter); + out_belongs.node_traverser (out_arg_emitter); + + home_emitter.traverse (t); + } + + os << "// Attribute operations." << endl << endl; + + { + Traversal::Home home_emitter; + + Traversal::Inherits home_inherits; + home_inherits.node_traverser (home_emitter); + + home_emitter.edge_traverser (home_inherits); + + Traversal::Defines defines; + home_emitter.edge_traverser (defines); + + AttributeEmitter<SemanticGraph::Home> attribute_emitter (ctx, t); + ReadOnlyAttributeEmitter<SemanticGraph::Home> read_only_attribute_emitter (ctx, t); + defines.node_traverser (attribute_emitter); + defines.node_traverser (read_only_attribute_emitter); + + home_emitter.traverse (t); + } + + os << "// Implicit operations." << endl << endl + << STRS[COMP_EC] << "_ptr" << endl + << t.name () << "_exec_i::create (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_CE] << "))" << endl + << "{" + << STRS[COMP_EC] << "_ptr retval =" << endl + << STRS[COMP_EC] << "::_nil ();" << endl + << "ACE_NEW_THROW_EX (" << endl + << "retval," << endl; + + Traversal::Home home_emitter; + + Traversal::Manages manages_; + home_emitter.edge_traverser (manages_); + + SimpleTypeNameEmitter manages_emitter (os); + manages_.node_traverser (manages_emitter); + + home_emitter.traverse (t); + + os << "_exec_i," << endl + << "CORBA::NO_MEMORY ());" + << "ACE_CHECK_RETURN (" << STRS[COMP_EC] + << "::_nil ());" << endl + << "return retval;" + << "}"; + } + + virtual void + post (Type& t) + { + os << "extern \"C\" " << ctx.export_macro () + << " ::Components::HomeExecutorBase_ptr" << endl + << "create" << t.name () << "_Impl (void)" << endl + << "{" + << "::Components::HomeExecutorBase_ptr retval =" << endl + << "::Components::HomeExecutorBase::_nil ();" << endl + << "ACE_NEW_RETURN (" << endl + << "retval," << endl + << t.name () << "_exec_i," << endl + << "::Components::HomeExecutorBase::_nil ());" << endl + << "return retval;" + << "}"; + } + }; +} + +ExecImplSourceEmitter::ExecImplSourceEmitter (std::ostream& os_, + CommandLine const& cl, + string export_macro, + fs::path const& file) + : os (os_), + cl_ (cl), + export_macro_ (export_macro), + file_ (file) +{} + +void +ExecImplSourceEmitter::pre (TranslationUnit& u) +{ + os << COPYRIGHT; + + string file_name (""); + + if (! file_.empty ()) + { + file_name = file_.leaf (); + } + + string file_suffix = cl_.get_value ("exec-hdr-file-suffix", + "_exec.h"); + + file_name = regex::perl_s (file_name, + "/(\\.(idl|cidl))?$/" + + file_suffix + + "/"); + + os << "#include \"" << file_name << "\"" << endl + << "#include \"ciao/CIAO_common.h\"" << endl; +} + +void +ExecImplSourceEmitter::generate (TranslationUnit& u) +{ + pre (u); + + Context c (os, export_macro_); + + Traversal::TranslationUnit unit; + + // Layer 1 + // + Traversal::ContainsPrincipal contains_principal; + unit.edge_traverser (contains_principal); + + //-- + Traversal::TranslationRegion principal_region; + contains_principal.node_traverser (principal_region); + + // Layer 2 + // + Traversal::ContainsRoot contains_root; + principal_region.edge_traverser (contains_root); + + //-- + Traversal::Root root; + contains_root.node_traverser (root); + + // Layer 3 + // + Traversal::Defines defines; + root.edge_traverser (defines); + + //-- + ModuleEmitter module (c); + CompositionEmitter composition (c); + defines.node_traverser (module); + defines.node_traverser (composition); + + // Layer 4 + // + composition.edge_traverser (defines); + module.edge_traverser (defines); + + //-- + Traversal::ComponentExecutor component_executor; + Traversal::HomeExecutor home_executor; + defines.node_traverser (component_executor); + defines.node_traverser (home_executor); + + // Layer 5 + // + Traversal::Implements implements; + component_executor.edge_traverser (implements); + home_executor.edge_traverser (implements); + + //-- + ComponentExecImplEmitter component_exec_impl_emitter (c); + HomeExecImplEmitter home_exec_impl_emitter (c); + implements.node_traverser (component_exec_impl_emitter); + implements.node_traverser (home_exec_impl_emitter); + + unit.traverse (u); + + post (u); +} + +void +ExecImplSourceEmitter::post (TranslationUnit& u) +{ +} + diff --git a/TAO/CIAO/CIDLC/ExecImplSourceGenerator.hpp b/TAO/CIAO/CIDLC/ExecImplSourceGenerator.hpp new file mode 100644 index 00000000000..efac70d2543 --- /dev/null +++ b/TAO/CIAO/CIDLC/ExecImplSourceGenerator.hpp @@ -0,0 +1,43 @@ +// file : CIDLC/ExecImplSourceGenerator.hpp +// author : Jeff Parsons <j.parsons@vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef EXEC_IMPL_SOURCE_GENERATOR_HPP +#define EXEC_IMPL_SOURCE_GENERATOR_HPP + +#include "CCF/CodeGenerationKit/CommandLine.hpp" + +#include "CCF/CIDL/SemanticGraph.hpp" +#include "CCF/CIDL/Traversal.hpp" + +using std::string; + +class ExecImplSourceEmitter +{ +public: + ExecImplSourceEmitter (std::ostream& os_, + CommandLine const& cl, + string export_macro, + fs::path const& file); + + virtual ~ExecImplSourceEmitter () {} + + virtual void + pre (CCF::CIDL::SemanticGraph::TranslationUnit& u); + + virtual void + generate (CCF::CIDL::SemanticGraph::TranslationUnit& u); + + virtual void + post (CCF::CIDL::SemanticGraph::TranslationUnit& u); + +private: + std::ostream& os; + CommandLine const& cl_; + string export_macro_; + fs::path file_; +}; + + +#endif // EXEC_IMPL_SOURCE_GENERATOR_HPP + diff --git a/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp b/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp index 53d856397eb..41856f9d4d6 100644 --- a/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp +++ b/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp @@ -20,6 +20,7 @@ using std::string; using std::ostream; using std::endl; +using namespace StringLiterals; using namespace CCF::CIDL; using namespace CCF::CIDL::SemanticGraph; @@ -457,7 +458,7 @@ namespace virtual void inherits_none (Type&) { - os << " : ::Components::EnterpriseComponent"; + os << " : " << STRS[COMP_EC]; } virtual void @@ -751,7 +752,7 @@ namespace inherits_none (Type&) { //@@ should be os << " : ::Components::CCMContext"; - os << " : ::Components::SessionContext"; + os << " : " << STRS[COMP_SC]; } virtual void @@ -870,7 +871,7 @@ namespace virtual void returns (SemanticGraph::HomeFactory&) { - os << "::Components::EnterpriseComponent "; + os << STRS[COMP_EC] << " "; } virtual void @@ -927,7 +928,7 @@ namespace virtual void returns (SemanticGraph::HomeFinder&) { - os << "::Components::EnterpriseComponent "; + os << STRS[COMP_EC] << " "; } virtual void @@ -1120,10 +1121,10 @@ namespace virtual void names (Type& h) { - os<< "{" - << "::Components::EnterpriseComponent " - << "create () raises (::Components::CCMException);" - << "}"; + os << "{" + << STRS[COMP_EC] << " " + << "create () raises (" << STRS[EXCP_CE] << ");" + << "}"; } virtual void @@ -1470,7 +1471,7 @@ namespace // Traversal::ComponentExecutor::implements (i, implements_traverser_); // os << ", " - // << "::Components::SessionContext"; + // << STRS[COMP_SC]; } virtual void @@ -1661,7 +1662,7 @@ generate (CommandLine const& cl, // Dump file header. // - os << StringLiterals::COPYRIGHT; + os << COPYRIGHT; // Set auto-indentation for os. // diff --git a/TAO/CIAO/CIDLC/Literals.cpp b/TAO/CIAO/CIDLC/Literals.cpp index 6e9cc6782a8..221ac34925b 100644 --- a/TAO/CIAO/CIDLC/Literals.cpp +++ b/TAO/CIAO/CIDLC/Literals.cpp @@ -25,7 +25,7 @@ namespace StringLiterals "// http://www.isis.vanderbilt.edu/\n" "//\n" "// Information about CIAO is available at:\n" - "// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html" + "// http://www.dre.vanderbilt.edu/CIAO" "\n\n"; char const* const STRS[SIZE] = @@ -56,11 +56,14 @@ namespace StringLiterals "::Components::InvalidConfiguration", // EXCP_ICF "::Components::CookieRequired", // EXCP_CR "::Components::BadEventType", // EXCP_BET + "::Components::CCMException", // EXCP_CE // Commonly used Components module members. "::Components::Cookie", // COMP_CK "::Components::NameList & /* names */", // COMP_NAMES "::Components::EventConsumerBase", // COMP_ECB + "::Components::EnterpriseComponent", // COMP_EC + "::Components::SessionContext", // COMP_SC // This could change - don't want it scattered all over. "namespace CIAO_GLUE", // GLUE_NS @@ -73,6 +76,9 @@ namespace StringLiterals "CIDLC::RepositoryIdGenerator::TypePrefix", // TYPE_PREFIX "CIDLC::RepositoryIdGenerator::RepoId", // REPO_ID + "// Your code here.", // YCH + "//==================================================================", // SEP + "variable-size" // VAR_SIZE }; } diff --git a/TAO/CIAO/CIDLC/Literals.hpp b/TAO/CIAO/CIDLC/Literals.hpp index 2ae32a19fd0..d173026fa2f 100644 --- a/TAO/CIAO/CIDLC/Literals.hpp +++ b/TAO/CIAO/CIDLC/Literals.hpp @@ -35,14 +35,19 @@ namespace StringLiterals EXCP_ICF, EXCP_CR, EXCP_BET, + EXCP_CE, COMP_CK, COMP_NAMES, COMP_ECB, + COMP_EC, + COMP_SC, GLUE_NS, INH_RCSB, TYPE_ID, TYPE_PREFIX, REPO_ID, + YCH, + SEP, VAR_SIZE, SIZE }; diff --git a/TAO/CIAO/CIDLC/ServantGenerator.cpp b/TAO/CIAO/CIDLC/ServantGenerator.cpp index 8e1211eccac..54622931221 100644 --- a/TAO/CIAO/CIDLC/ServantGenerator.cpp +++ b/TAO/CIAO/CIDLC/ServantGenerator.cpp @@ -36,22 +36,46 @@ ServantGenerator::ServantGenerator (CommandLine const& cl) { } -void ServantGenerator:: -options (CL::Description& d) +void ServantGenerator::options (CL::Description& d) { d.add_option (CL::OptionDescription ( - "svnt-file-suffix", + "svnt-hdr-file-suffix", "suffix", - "Use provided suffix instead of default \'_svnt\' " + "Use provided suffix instead of default \'_svnt.h\' " "when constructing name of servant file.", true)); d.add_option (CL::OptionDescription ( - "svnt-file-regex", + "svnt-hdr-file-regex", "regex", "Use provided regular expression when constructing " "name of servant file.", true)); + d.add_option (CL::OptionDescription ( + "svnt-src-file-suffix", + "suffix", + "Use provided suffix instead of default \'_svnt.cpp\' " + "when constructing name of servant file.", + true)); + + d.add_option (CL::OptionDescription ( + "svnt-src-file-regex", + "regex", + "Use provided regular expression when constructing " + "name of servant file.", + true)); + d.add_option (CL::OptionDescription ( + "svnt-export-macro", + "macro", + "Replace default servant DLL export macro " + "with provided ,acro.", + true)); + d.add_option (CL::OptionDescription ( + "svnt-export-include", + "file", + "Replace default servant export include file " + "with provided file.", + true)); } @@ -63,9 +87,9 @@ void ServantGenerator::generate (SemanticGraph::TranslationUnit& u, { fs::ofstream hdr_ofs; - ostream& hdr_os = configure_stream ("hdr-file-suffix", + ostream& hdr_os = configure_stream ("svnt-hdr-file-suffix", "_svnt.h", - "hdr-file-regex", + "svnt-hdr-file-regex", hdr_ofs); Indentation::Implanter<Indentation::Cxx> header_guard (hdr_os); @@ -80,9 +104,9 @@ void ServantGenerator::generate (SemanticGraph::TranslationUnit& u, { fs::ofstream src_ofs; - ostream& src_os = configure_stream ("src-file-suffix", + ostream& src_os = configure_stream ("svnt-src-file-suffix", "_svnt.cpp", - "src-file-regex", + "svnt-src-file-regex", src_ofs); Indentation::Implanter<Indentation::Cxx> header_guard (src_os); @@ -103,7 +127,7 @@ ServantGenerator::compute_export_macro (const fs::path& file_path) file_name_ = file_path.leaf (); } - export_macro_ = cl_.get_value ("export-macro", ""); + export_macro_ = cl_.get_value ("svnt-export-macro", ""); if (export_macro_.empty () && !file_name_.empty ()) { diff --git a/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp b/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp index 6e58406d180..8e36ceadaa4 100644 --- a/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp +++ b/TAO/CIAO/CIDLC/ServantHeaderGenerator.cpp @@ -132,7 +132,7 @@ namespace virtual void post (Type&) { - os << ";" << endl; + os << ";" << endl << endl; } virtual void @@ -252,7 +252,7 @@ namespace os << endl << a.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << STRS[EXCP_SNGL] << ";" << endl << endl; os << "virtual void" << endl << a.name () << " (" << endl; @@ -261,7 +261,7 @@ namespace os << endl << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << STRS[EXCP_SNGL] << ";" << endl << endl; } private: @@ -292,7 +292,7 @@ namespace os << endl << a.name () << " (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << STRS[EXCP_SNGL] << ";" << endl << endl; } private: @@ -422,14 +422,14 @@ namespace << "_var executor_;" << endl << "// Context object." << endl << "::Components::CCMContext_var ctx_;" << endl - << "};" << endl; + << "};"; os << "typedef " << ctx.export_macro () << " " << i.name () << "_Servant_T<int> " << i.name () << "_Servant;"; // Close the CIAO_GLUE namespace. - os << "}" << endl; + os << "}"; i.context ().set ("facet_hdr_gen", true); } @@ -549,7 +549,7 @@ namespace << STRS[ENV_SNGL_HDR] << ")" << endl << STRS[EXCP_START] << endl << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_NC] << "));" << endl; + << STRS[EXCP_NC] << "));" << endl << endl; } virtual void @@ -733,86 +733,86 @@ namespace } os << STRS[GLUE_NS] - << regex::perl_s (t.scoped_name ().scope_name ().str (), "/::/_/") - << "{"; + << regex::perl_s (t.scoped_name ().scope_name ().str (), "/::/_/") + << "{"; os << "class " << ctx.export_macro () << " " << t.name () - << "_Context" << endl - << ": public virtual " << t.scoped_name ().scope_name () << "::CCM_" - << t.name () << "_Context," - << endl - << "public virtual TAO_Local_RefCounted_Object" - << endl - << "{" - << "public:" << endl; + << "_Context" << endl + << ": public virtual " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "_Context," + << endl + << "public virtual TAO_Local_RefCounted_Object" + << endl + << "{" + << "public:" << endl; os << "// We will allow the servant glue code we generate to " - << "access our state." << endl - << "friend class " << t.name () << "_Servant;" - << endl; + << "access our state." << endl + << "friend class " << t.name () << "_Servant;" + << endl; os << t.name () << "_Context (" << endl - << "::Components::CCMHome_ptr home," << endl - << "::CIAO::Session_Container *c," << endl - << t.name () << "_Servant *sv);" << endl; + << "::Components::CCMHome_ptr home," << endl + << "::CIAO::Session_Container *c," << endl + << t.name () << "_Servant *sv);" << endl; os << "virtual ~" << t.name () << "_Context (void);" - << endl; + << endl; os << "// Operations from ::Components::CCMContext." << endl << endl; os << "virtual ::Components::Principal_ptr" << endl - << "get_caller_principal (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << "get_caller_principal (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; os << "virtual ::Components::CCMHome_ptr" << endl - << "get_CCM_home (" << endl - << STRS[ENV_SNGL_HDR_NOTUSED] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl ; + << "get_CCM_home (" << endl + << STRS[ENV_SNGL_HDR_NOTUSED] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl ; os << "virtual CORBA::Boolean" << endl - << "get_rollback_only (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; + << "get_rollback_only (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_IS] << "));" << endl; os << "virtual ::Components::Transaction::UserTransaction_ptr" << endl - << "get_user_transaction (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; + << "get_user_transaction (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_IS] << "));" << endl; os << "virtual CORBA::Boolean" << endl - << "is_caller_in_role (" << endl - << "const char *role" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << "is_caller_in_role (" << endl + << "const char *role" << endl + << STRS[ENV_HDR] << ")" << endl + << STRS[EXCP_SNGL] << ";" << endl; os << "virtual void" << endl - << "set_rollback_only (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; + << "set_rollback_only (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_IS] << "));" << endl; - os << "// Operations from ::Components::SessionContext interface." - << endl << endl; + os << "// Operations from " << STRS[COMP_SC] << " interface." + << endl << endl; os << "virtual CORBA::Object_ptr" << endl - << "get_CCM_object (" << endl - << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_START] << endl - << STRS[EXCP_SYS] << "," << endl - << STRS[EXCP_IS] << "));" << endl; + << "get_CCM_object (" << endl + << STRS[ENV_SNGL_HDR] << ")" << endl + << STRS[EXCP_START] << endl + << STRS[EXCP_SYS] << "," << endl + << STRS[EXCP_IS] << "));" << endl; os << "// Operations for " << t.name () << " receptacles" - << " and event sources," << endl - << "// defined in " << t.scoped_name ().scope_name () << "::CCM_" - << t.name () << "_Context." - << endl << endl; + << " and event sources," << endl + << "// defined in " << t.scoped_name ().scope_name () << "::CCM_" + << t.name () << "_Context." + << endl << endl; { Traversal::Component component_emitter; @@ -836,7 +836,7 @@ namespace os << "static " << t.name () << "_Context *" << endl << "_narrow (" << endl - << "::Components::SessionContext_ptr p" << endl + << STRS[COMP_SC] << "_ptr p" << endl << STRS[ENV_HDR] << ");" << endl; os << "protected:" << endl @@ -881,16 +881,16 @@ namespace virtual void post (Type& t) { - os << "::Components::CCMHome_var home_;" << endl << endl + os << "::Components::CCMHome_var home_;" << endl << "::CIAO::Session_Container *container_;" << endl << endl - << t.name () << "_Servant *servant_;" << endl << endl - << t.scoped_name () << "_var component_;" << endl << endl; + << t.name () << "_Servant *servant_;" << endl + << t.scoped_name () << "_var component_;" << endl; // Component context class closer. - os << "};" << endl; + os << "};"; // Namespace closer. - os << "}" << endl; + os << "}"; } }; @@ -1079,9 +1079,9 @@ namespace os << c.scoped_name ().scope_name ().scope_name () << "::CCM_" << c.scoped_name ().scope_name ().simple_name () << "_Context_var" << endl - << "ctx_;" << endl; + << "ctx_;" << endl << endl; - os << "};" << endl << endl; + os << "};"; os << "virtual "; @@ -1181,7 +1181,7 @@ namespace Traversal::ConsumerData::belongs (c, belongs_); os << "Consumer_var" << endl - << "consumes_" << c.name () << "_;" << endl; + << "consumes_" << c.name () << "_;" << endl << endl; } private: @@ -1215,20 +1215,20 @@ namespace << "public:" << endl; os << "/// Hack for VC6 the most sucky compiler" << endl - << "typedef CIAO::Servant_Impl<" << endl - << "POA_" << stripped << "," << endl + << "typedef CIAO::Servant_Impl<" << endl + << "POA_" << stripped << "," << endl << " " << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "," << endl << " " << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_var," << endl << " " << t.name () << "_Context" << endl - << " > our_base;" << endl << endl; + << " > our_base;" << endl; os << t.name () << "_Servant (" << endl << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_ptr executor," << endl << "::Components::CCMHome_ptr home," << endl - << "::CIAO::Session_Container *c);" << endl << endl; + << "::CIAO::Session_Container *c);" << endl; os << "virtual ~" << t.name () << "_Servant (void);" << endl << endl; @@ -1337,8 +1337,7 @@ namespace component_emitter.traverse (t); } - os << endl - << "// Operations for Navigation interface." << endl << endl; + os << "// Operations for Navigation interface." << endl << endl; os << "virtual CORBA::Object_ptr" << endl << "provide_facet (" << endl @@ -1356,12 +1355,6 @@ namespace << STRS[EXCP_SYS] << "," << endl << STRS[EXCP_IN] << "));" << endl << endl; - os << "virtual CORBA::Boolean" << endl - << "same_component (" << endl - << "CORBA::Object_ptr object_ref" << endl - << STRS[ENV_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl << endl; - os << "// Operations for Receptacles interface." << endl << endl; os << "virtual " << STRS[COMP_CK] << " *" << endl @@ -1582,72 +1575,40 @@ namespace os << "private:" << endl << endl << "void populate_port_tables (" << endl << STRS[ENV_SNGL_HDR] << ")" << endl - << STRS[EXCP_SNGL] << ";" << endl; + << STRS[EXCP_SNGL] << ";" << endl << endl; } virtual void post (Type& t) { // Component servant class closer. - os << "};" << endl; + os << "};"; // Namespace closer. - os << "}" << endl; + os << "}"; } }; struct HomeEmitter : Traversal::Home, EmitterBase { HomeEmitter (Context& c) - : EmitterBase (c) - {} + : EmitterBase (c), + type_name_emitter_ (c.os ()), + simple_type_name_emitter_ (c.os ()), + enclosing_type_name_emitter_ (c.os ()) + { + 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: - struct ManagesEmitter : Traversal::Component, EmitterBase - { - ManagesEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - traverse (Type& c) - { - os << c.scoped_name (); - } - }; - - struct ManagesSimpleEmitter : Traversal::Component, EmitterBase - { - ManagesSimpleEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - traverse (Type& c) - { - os << c.name (); - } - }; - - struct ManagesScopeEmitter : Traversal::Component, EmitterBase - { - ManagesScopeEmitter (Context& c) - : EmitterBase (c) - {} - - virtual void - traverse (Type& c) - { - os << c.scoped_name ().scope_name (); - } - }; - // 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 don't want to - // generate anything for base class factory operations, - // example), we use this class for regular home operations + // 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, @@ -1670,12 +1631,10 @@ namespace }; struct FactoryOperationEmitter : Traversal::HomeFactory, - Traversal::Home, EmitterBase { - FactoryOperationEmitter (Context& c, SemanticGraph::Home& home) - : EmitterBase (c), - home_ (home) + FactoryOperationEmitter (Context& c) + : EmitterBase (c) {} virtual void @@ -1685,21 +1644,21 @@ namespace } virtual void - returns (SemanticGraph::HomeFactory& hf) + returns (SemanticGraph::HomeFactory& t) { ReturnTypeNameEmitter returns_emitter (os); Traversal::Returns returns_; returns_.node_traverser (returns_emitter); - Traversal::HomeFactory::returns (hf, returns_); + Traversal::HomeFactory::returns (t, returns_); os << endl; } virtual void - name (SemanticGraph::HomeFactory& hf) + name (SemanticGraph::HomeFactory& t) { - os << hf.name (); + os << t.name (); } virtual void @@ -1751,9 +1710,91 @@ namespace { 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: - SemanticGraph::Home& home_; + ReturnTypeNameEmitter returns_emitter_; + Traversal::Returns returns_; }; public: @@ -1776,7 +1817,7 @@ namespace os << t.name () << "_Servant (" << endl << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_ptr exe," << endl - << "::CIAO::Session_Container *c);" << endl << endl; + << "::CIAO::Session_Container *c);" << endl; os << "virtual ~" << t.name () << "_Servant (void);" << endl << endl; @@ -1832,9 +1873,9 @@ namespace } // Generate home factory operations. This is a separate traversal - // stack because we don't want to generate the factory operations - // of ancestors. - os << "// Home factory operations." << endl << endl; + // stack because we want to generate the factory operations + // of ancestors with the return type of the base component. + os << "// Home factory and finder operations." << endl << endl; { Traversal::Home home_emitter; @@ -1846,8 +1887,10 @@ namespace Traversal::Defines defines; home_emitter.edge_traverser (defines); - FactoryOperationEmitter factory_operation_emitter (ctx, t); + FactoryOperationEmitter factory_operation_emitter (ctx); + FinderOperationEmitter finder_operation_emitter (ctx); defines.node_traverser (factory_operation_emitter); + defines.node_traverser (finder_operation_emitter); Traversal::Receives receives; Traversal::Belongs returns; @@ -1855,6 +1898,9 @@ namespace factory_operation_emitter.edge_traverser (receives); factory_operation_emitter.edge_traverser (returns); factory_operation_emitter.edge_traverser (raises); + finder_operation_emitter.edge_traverser (receives); + finder_operation_emitter.edge_traverser (returns); + finder_operation_emitter.edge_traverser (raises); ParameterEmitter<Traversal::InParameter> in_param (os); ParameterEmitter<Traversal::InOutParameter> inout_param (os); @@ -1912,19 +1958,13 @@ namespace << STRS[ENV_SNGL_HDR] << ")" << endl << STRS[EXCP_START] << endl << STRS[EXCP_SYS] << "," << endl - << "::Components::CreateFailure));" << endl << endl ; + << "::Components::CreateFailure));" << endl << endl; os << "// Operations for implicit home interface." << endl << endl; os << "virtual "; - { - Traversal::Manages manages_; - ManagesEmitter manages_emitter (ctx); - manages_.node_traverser (manages_emitter); - - manages (t, manages_); - } + Traversal::Home::manages (t, manages_); os << "_ptr" << endl << "create (" << endl @@ -2020,34 +2060,16 @@ namespace os << "protected:" << endl << "// CIAO-specific operations." << endl << endl; - { - Traversal::Manages manages_; - ManagesEmitter manages_emitter (ctx); - manages_.node_traverser (manages_emitter); - - manages (t, manages_); - } + Traversal::Home::manages (t, manages_); os << "_ptr" << endl << "_ciao_activate_component (" << endl; - { - Traversal::Manages manages_; - ManagesScopeEmitter manages_emitter (ctx); - manages_.node_traverser (manages_emitter); - - manages (t, manages_); - } + Traversal::Home::manages (t, enclosing_manages_); os << "::CCM_"; - { - Traversal::Manages manages_; - ManagesSimpleEmitter manages_emitter (ctx); - manages_.node_traverser (manages_emitter); - - manages (t, manages_); - } + Traversal::Home::manages (t, simple_manages_); os << "_ptr exe" << endl << STRS[ENV_HDR] << ")" << endl @@ -2056,13 +2078,7 @@ namespace os << "void" << endl << "_ciao_passivate_component (" << endl; - { - Traversal::Manages manages_; - ManagesEmitter manages_emitter (ctx); - manages_.node_traverser (manages_emitter); - - manages (t, manages_); - } + Traversal::Home::manages (t, manages_); os << "_ptr comp" << endl << STRS[ENV_HDR] << ")" << endl @@ -2080,25 +2096,19 @@ namespace os << "ACE_Hash_Map_Manager_Ex<" << endl << "PortableServer::ObjectId," << endl; - { - Traversal::Manages manages_; - ManagesSimpleEmitter manages_emitter (ctx); - manages_.node_traverser (manages_emitter); - - manages (t, manages_); - } + Traversal::Home::manages (t, simple_manages_); os << "_Servant *," << endl << "TAO_ObjectId_Hash," << endl << "ACE_Equal_To<PortableServer::ObjectId>," << endl << "ACE_SYNCH_MUTEX>" << endl - << "component_map_;" << endl; + << "component_map_;" << endl << endl; // Home servant class closer. - os << "};" << endl << endl; + os << "};"; - os << "extern \"C\" " << ctx.export_macro () << " ::PortableServer::Servant" - << endl + os << "extern \"C\" " << ctx.export_macro () + << " ::PortableServer::Servant" << endl << "create" << t.name () << "_Servant (" << endl << "::Components::HomeExecutorBase_ptr p," << endl << "CIAO::Session_Container *c" << endl @@ -2108,11 +2118,18 @@ namespace virtual void post (Type& t) { // Namespace closer. - os << "}" << endl; + os << "}"; } + + private: + TypeNameEmitter type_name_emitter_; + SimpleTypeNameEmitter simple_type_name_emitter_; + EnclosingTypeNameEmitter enclosing_type_name_emitter_; + Traversal::Manages manages_; + Traversal::Manages simple_manages_; + Traversal::Manages enclosing_manages_; }; - struct CompositionEmitter : Traversal::Composition, EmitterBase { CompositionEmitter (Context& c) @@ -2128,7 +2145,7 @@ namespace } virtual void - post (Type& t) + post (Type&) { os << "}"; } @@ -2194,7 +2211,7 @@ ServantHeaderEmitter::pre (TranslationUnit& u) uc_file_name.begin (), upcase); - string uc_file_suffix = cl_.get_value ("hdr-file-suffix", + string uc_file_suffix = cl_.get_value ("svnt-hdr-file-suffix", "_svnt.h"); std::transform (uc_file_suffix.begin (), @@ -2351,7 +2368,7 @@ ServantHeaderEmitter::post (TranslationUnit& u) uc_file_name.begin (), upcase); - string uc_file_suffix = cl_.get_value ("hdr-file-suffix", + string uc_file_suffix = cl_.get_value ("svnt-hdr-file-suffix", "_svnt.h"); std::transform (uc_file_suffix.begin (), @@ -2366,8 +2383,7 @@ ServantHeaderEmitter::post (TranslationUnit& u) guard = regex::perl_s (guard, "/\\./_/"); - os << endl - << "#include /**/ \"ace/post.h\"" << endl << endl + os << "#include /**/ \"ace/post.h\"" << endl << endl << "#endif /* " << guard << " */" << endl << endl; } diff --git a/TAO/CIAO/CIDLC/ServantHeaderGenerator.hpp b/TAO/CIAO/CIDLC/ServantHeaderGenerator.hpp index 8643ab7a065..47fc1acf369 100644 --- a/TAO/CIAO/CIDLC/ServantHeaderGenerator.hpp +++ b/TAO/CIAO/CIDLC/ServantHeaderGenerator.hpp @@ -42,9 +42,3 @@ private: #endif // SERVANT_HEADER_GENERATOR_HPP -/* - * Local Variables: - * mode: C++ - * c-basic-offset: 2 - * End: - */ diff --git a/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp b/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp index d99fac540c0..fae9db4bad2 100644 --- a/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp +++ b/TAO/CIAO/CIDLC/ServantSourceGenerator.cpp @@ -9,7 +9,6 @@ #include "CCF/CodeGenerationKit/Regex.hpp" #include <ostream> -#include <sstream> using namespace CCF::CIDL; using namespace CCF::CIDL::SemanticGraph; @@ -242,7 +241,7 @@ namespace operation_emitter.traverse (o); - os << "}" << endl; + os << "}"; } virtual void @@ -371,7 +370,7 @@ namespace << "{" << "return this->executor_->" << a.name () << " (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; // Does nothing here, overridden for facet attributes. this->pre (a); @@ -392,7 +391,7 @@ namespace << "this->executor_->" << a.name () << " (" << endl << a.name () << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; } protected: @@ -442,7 +441,7 @@ namespace << "{" << "return this->executor_->" << a.name () << " (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; } protected: @@ -544,13 +543,13 @@ namespace << i.name () << "::_duplicate (executor))," << endl << "ctx_ (::Components::CCMContext::_duplicate (c))" << endl << "{" - << "}" << endl; + << "}"; os << "template <typename T>" << endl << i.name () << "_Servant_T<T>::~" << i.name () << "_Servant_T (void)" << endl << "{" - << "}" << endl; + << "}"; { InterfaceEmitter interface_emitter (ctx); @@ -610,8 +609,8 @@ namespace << STRS[ENV_SNGL_SRC] << ")" << endl << "ACE_THROW_SPEC ((CORBA::SystemException))" << endl << "{" - << "::Components::SessionContext_var sc =" << endl - << "::Components::SessionContext::_narrow (" << endl + << STRS[COMP_SC] << "_var sc =" << endl + << STRS[COMP_SC] << "::_narrow (" << endl << "this->ctx_.in ()" << endl << STRS[ENV_ARG] << ");" << "ACE_CHECK_RETURN (CORBA::Object::_nil ());" << endl @@ -619,7 +618,7 @@ namespace << "{" << "return sc->get_CCM_object (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl + << "}" << "::Components::EntityContext_var ec =" << endl << "::Components::EntityContext::_narrow (" << endl << "this->ctx_.in ()" << endl @@ -629,12 +628,12 @@ namespace << "{" << "return ec->get_CCM_object (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl + << "}" << "ACE_THROW_RETURN (CORBA::INTERNAL (), 0);" << endl - << "}" << endl; + << "}"; // Close the CIAO_GLUE namespace. - os << "}" << endl; + os << "}"; i.context ().set ("facet_src_gen", true); } @@ -682,7 +681,7 @@ namespace os << "::_duplicate (" << endl << "this->ciao_uses_" << u.name () << "_.in ());" << endl - << "}" << endl; + << "}"; os << "void" << endl << scope_.name () << "_Context::connect_" @@ -701,17 +700,17 @@ namespace << u.name () << "_.in ()))" << endl << "{" << "ACE_THROW (" << STRS[EXCP_AC] << " ());" << endl - << "}" << endl + << "}" << "if (CORBA::is_nil (c))" << endl << "{" << "ACE_THROW (" << STRS[EXCP_IC] << " ());" << endl - << "}" << endl + << "}" << "this->ciao_uses_" << u.name () << "_ =" << endl; Traversal::SingleUserData::belongs (u, belongs_); os << "::_duplicate (c);" << endl - << "}" << endl; + << "}"; Traversal::SingleUserData::belongs (u, belongs_); @@ -732,10 +731,10 @@ namespace Traversal::SingleUserData::belongs (u, belongs_); os << "::_nil ());" << endl - << "}" << endl + << "}" << "return this->ciao_uses_" << u.name () << "_._retn ();" << endl - << "}" << endl; + << "}"; } virtual void @@ -787,10 +786,10 @@ namespace << "retv[i++].ck," << endl << "CIAO::Map_Key_Cookie (entry.ext_id_)," << endl << "0);" << endl - << "}" << endl; + << "}"; os << "return retv._retn ();" << endl - << "}" << endl; + << "}"; os << "::Components::Cookie *" << endl << scope_.name () << "_Context::connect_" @@ -808,7 +807,7 @@ namespace << "if (CORBA::is_nil (c))" << endl << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_IC] << " (), 0);" << endl - << "}" << endl; + << "}"; Traversal::MultiUserData::belongs (u, belongs_); @@ -823,7 +822,7 @@ namespace << "_.bind (conn.in (), key) == -1)" << endl << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_IC] << " (), 0);" << endl - << "}" << endl; + << "}"; os << "conn._retn ();" << endl; @@ -834,7 +833,7 @@ namespace << "0);" << endl; os << "return retv._retn ();" << endl - << "}" << endl; + << "}"; Traversal::MultiUserData::belongs (u, belongs_); @@ -862,7 +861,7 @@ namespace Traversal::MultiUserData::belongs (u, belongs_); os << "::_nil ());" << endl - << "}" << endl; + << "}"; os << "if (this->ciao_uses_" << u.name () << "_.unbind (key, retv) != 0)" << endl @@ -873,10 +872,10 @@ namespace Traversal::MultiUserData::belongs (u, belongs_); os << "::_nil ());" << endl - << "}" << endl; + << "}"; os << "return retv._retn ();" << endl - << "}" << endl; + << "}"; } virtual void @@ -933,8 +932,8 @@ namespace << "ev" << endl << STRS[ENV_ARG] << ");" << "ACE_CHECK;" << endl - << "}" << endl - << "}" << endl; + << "}" + << "}"; os << STRS[COMP_CK] << " *" << endl << scope_.name () << "_Context::subscribe_" @@ -951,7 +950,7 @@ namespace << "if (CORBA::is_nil (c))" << endl << "{" << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);" << endl - << "}" << endl; + << "}"; Traversal::PublisherData::belongs (p, belongs_); @@ -967,7 +966,7 @@ namespace << STRS[COMP_CK] << "_var retv = " << "new ::CIAO::Map_Key_Cookie (key);" << "return retv._retn ();" << endl - << "}" << endl; + << "}"; Traversal::PublisherData::belongs (p, belongs_); @@ -994,7 +993,7 @@ namespace Traversal::PublisherData::belongs (p, belongs_); os << "Consumer::_nil ());" << endl - << "}" << endl << endl + << "}" << "if (this->ciao_publishes_" << p.name () << "_map_.unbind (key, retv) != 0)" << endl << "{" @@ -1004,9 +1003,9 @@ namespace Traversal::PublisherData::belongs (p, belongs_); os << "Consumer::_nil ());" << endl - << "}" << endl + << "}" << "return retv._retn ();" << endl - << "}" << endl; + << "}"; } virtual void @@ -1030,7 +1029,7 @@ namespace os << " (" << endl << "ev" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; os << "void" << endl << scope_.name () << "_Context::connect_" @@ -1047,19 +1046,19 @@ namespace << "if (CORBA::is_nil (c))" << endl << "{" << "ACE_THROW (CORBA::BAD_PARAM ());" << endl - << "}" << endl << endl + << "}" << endl << "if (! CORBA::is_nil (this->ciao_emits_" << e.name () << "_consumer_.in ()))" << endl << "{" << "ACE_THROW (" << STRS[EXCP_AC] << " ());" << endl - << "}" << endl << endl + << "}" << endl << "this->ciao_emits_" << e.name () << "_consumer_ = " << endl; Traversal::EmitterData::belongs (e, belongs_); os << "Consumer::_duplicate (c);" << endl - << "}" << endl; + << "}"; Traversal::EmitterData::belongs (e, belongs_); @@ -1080,10 +1079,10 @@ namespace Traversal::EmitterData::belongs (e, belongs_); os << "Consumer::_nil ());" << endl - << "}" << endl << endl + << "}" << endl << "return this->ciao_emits_" << e.name () << "_consumer_._retn ();" << endl - << "}" << endl; + << "}"; } private: @@ -1137,12 +1136,12 @@ namespace << "container_ (c)," << endl << "servant_ (sv)" << endl << "{" - << "}" << endl; + << "}"; os << t.name () << "_Context::~" << t.name () << "_Context (void)" << endl << "{" - << "}" << endl; + << "}"; os << "// Operations from ::Components::CCMContext." << endl << endl; @@ -1155,7 +1154,7 @@ namespace << "ACE_THROW_RETURN (" << endl << "::CORBA::NO_IMPLEMENT ()," << endl << "::Components::Principal::_nil ());" << endl - << "}" << endl; + << "}"; os << "::Components::CCMHome_ptr" << endl << t.name () << "_Context::" @@ -1165,7 +1164,7 @@ namespace << "{" << "return ::Components::CCMHome::_duplicate (this->home_.in ());" << endl - << "}" << endl; + << "}"; os << "CORBA::Boolean" << endl << t.name () << "_Context::" @@ -1176,7 +1175,7 @@ namespace << STRS[EXCP_IS] << "))" << endl << "{" << "ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << "::Components::Transaction::UserTransaction_ptr" << endl << t.name () << "_Context::" @@ -1189,7 +1188,7 @@ namespace << "ACE_THROW_RETURN (" << endl << "::CORBA::NO_IMPLEMENT ()," << endl << "::Components::Transaction::UserTransaction::_nil ());" << endl - << "}" << endl; + << "}"; os << "CORBA::Boolean" << endl << t.name () << "_Context::" @@ -1199,7 +1198,7 @@ namespace << STRS[EXCP_SNGL] << endl << "{" << "ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << "void" << endl << t.name () << "_Context::" @@ -1210,9 +1209,9 @@ namespace << STRS[EXCP_IS] << "))" << endl << "{" << "ACE_THROW (CORBA::NO_IMPLEMENT ());" << endl - << "}" << endl; + << "}"; - os << "// Operations from ::Components::SessionContext interface." + os << "// Operations from " << STRS[COMP_SC] << "interface." << endl << endl; os << "CORBA::Object_ptr" << endl @@ -1240,11 +1239,11 @@ namespace << "ACE_THROW_RETURN (" << endl << "::CORBA::INTERNAL ()," << endl << "::CORBA::Object::_nil ());" << endl - << "}" << endl - << "}" << endl + << "}" + << "}" << "return " << t.scoped_name () << "::_duplicate (" << endl << "this->component_.in ());" << endl - << "}" << endl; + << "}"; os << "// Operations for " << t.name () << " receptacles" << " and event sources," << endl @@ -1275,23 +1274,23 @@ namespace << "_ciao_the_Container (void) const" << endl << "{" << "return this->container_;" << endl - << "}" << endl; + << "}"; os << t.name () << "_Context *" << endl << t.name () << "_Context::_narrow (" << endl - << "::Components::SessionContext_ptr p" << endl + << STRS[COMP_SC] << "_ptr p" << endl << STRS[ENV_SRC_NOTUSED] << ")" << endl << "{" << "return dynamic_cast<" << t.name () << "_Context *> (p);" << endl - << "}" << endl; + << "}"; } virtual void post (Type& t) { // Namespace closer. - os << "}" << endl; + os << "}"; } }; @@ -1334,13 +1333,13 @@ namespace << "{" << "ACE_THROW (" << STRS[EXCP_IC] << " ());" << endl - << "}" << endl + << "}" << "this->connect_" << t.name () << " (" << endl << "_ciao_consumer.in ()" << endl << STRS[ENV_ARG] << ");" << endl << "return;" - << "}" << endl; + << "}"; } private: @@ -1363,7 +1362,7 @@ namespace << "{" << "return this->provide_" << t.name () << " (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; } }; @@ -1397,7 +1396,7 @@ namespace << " (" << endl << "c" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; Traversal::PublisherData::belongs (p, belongs_); @@ -1414,7 +1413,7 @@ namespace << p.name () << " (" << endl << "ck" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; } private: @@ -1455,14 +1454,14 @@ namespace << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_IC] << " (), 0);" << endl - << "}" << endl + << "}" << "// Simplex connect." << endl << "this->connect_" << u.name () << " (" << endl << "_ciao_conn.in ()" << endl << STRS[ENV_ARG] << ");" << "ACE_CHECK_RETURN (0);" << endl << "return 0;" << endl - << "}" << endl; + << "}"; } virtual void @@ -1486,12 +1485,12 @@ namespace << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_IC] << " (), 0);" << endl - << "}" << endl + << "}" << "// Multiplex connect." << endl << "return this->connect_" << u.name () << " (" << endl << "_ciao_conn.in ()" << endl << STRS[ENV_ARG] << ");" - << "}" << endl; + << "}"; } private: @@ -1517,7 +1516,7 @@ namespace << "// Simplex disconnect." << endl << "return this->disconnect_" << u.name () << " (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; } virtual void @@ -1530,7 +1529,7 @@ namespace << "return this->disconnect_" << u.name () << " (" << endl << "ck" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; } }; @@ -1566,7 +1565,7 @@ namespace << endl << "c" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; Traversal::SingleUserData::belongs (u, belongs_); @@ -1581,7 +1580,7 @@ namespace << "return this->context_->disconnect_" << u.name () << " (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; Traversal::SingleUserData::belongs (u, belongs_); @@ -1595,7 +1594,7 @@ namespace << "return this->context_->get_connection_" << u.name () << " (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; } virtual void @@ -1618,7 +1617,7 @@ namespace << endl << "c" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; Traversal::MultiUserData::belongs (u, belongs_); @@ -1635,7 +1634,7 @@ namespace << " (" << endl << "ck" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; os << u.scoped_name () << "Connections *" << endl << scope_.name () @@ -1647,7 +1646,7 @@ namespace << "return this->context_->get_connections_" << u.name () << " (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; } private: @@ -1671,7 +1670,7 @@ namespace << "{" << "return this->get_consumer_" << c.name () << " (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; } }; @@ -1706,12 +1705,12 @@ namespace << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_IC] << " (), 0);" << endl - << "}" << endl + << "}" << "return this->subscribe_" << p.name () << " (" << endl << "_ciao_consumer.in ()" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; } private: @@ -1736,7 +1735,7 @@ namespace << " (" << endl << "ck" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; } }; @@ -1770,7 +1769,7 @@ namespace << " (" << endl << "c" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; Traversal::EmitterData::belongs (e, belongs_); @@ -1785,7 +1784,7 @@ namespace << "return this->context_->disconnect_" << e.name () << " (" << endl << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; } private: @@ -1877,7 +1876,7 @@ namespace Traversal::ProviderData::belongs (p, belongs_); os << "::_nil ());" << endl - << "}" << endl; + << "}"; Traversal::ProviderData::belongs (p, servant_belongs_); @@ -1918,14 +1917,14 @@ namespace os << "::_nil ());" << endl << "this->provide_" << p.name () << "_ = fo;" << endl - << "}" << endl + << "}" << "return "; Traversal::ProviderData::belongs (p, belongs_); os << "::_duplicate (this->provide_" << p.name () << "_.in ());" << endl - << "}" << endl; + << "}"; } private: @@ -1981,7 +1980,7 @@ namespace << "::CCM_" << c.scoped_name ().scope_name ().simple_name () << "_Context::_duplicate (c))" << endl << "{" - << "}" << endl; + << "}"; os << scope_.name () << "_Servant::"; @@ -1995,7 +1994,7 @@ namespace os << "Consumer_" << c.name () << "_Servant (void)" << endl << "{" - << "}" << endl; + << "}"; os << "CORBA::Object_ptr" << endl << scope_.name () << "_Servant::"; @@ -2009,7 +2008,7 @@ namespace << "{" << "return this->ctx_->get_CCM_object " << "(" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; os << "void" << endl << scope_.name () << "_Servant::"; @@ -2033,7 +2032,7 @@ namespace << " (" << endl << "evt" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; os << "// Inherited from " << STRS[COMP_ECB] << "." << endl << "void" << endl @@ -2067,9 +2066,9 @@ namespace << "ev_type.in ()" << endl << STRS[ENV_ARG] << ");" << endl << "return;" << endl - << "}" << endl + << "}" << "ACE_THROW (" << STRS[EXCP_BET] << " ());" << endl - << "}" << endl; + << "}"; Traversal::ConsumerData::belongs (c, belongs_); @@ -2124,14 +2123,14 @@ namespace os<< "Consumer::_nil ());" << endl << "this->consumes_" << c.name () << "_ = eco;" << endl - << "}" << endl + << "}" << "return "; Traversal::ConsumerData::belongs (c, belongs_); os << "Consumer::_duplicate (this->consumes_" << c.name () << "_.in ());" << endl - << "}" << endl; + << "}"; } private: @@ -2267,30 +2266,13 @@ namespace << "{" << "}" << "ACE_ENDTRY;" << endl - << "}" << endl; + << "}"; // Servant Destructor os << t.name () << "_Servant::~" << t.name () << "_Servant (void)" << endl << "{" - << "ACE_TRY_NEW_ENV" << endl - << "{" - << "::Components::SessionComponent_var scom =" << endl - << "::Components::SessionComponent::_narrow (" << endl - << "this->executor_.in ()" << endl - << STRS[ENV_ARG] << ");" - << "ACE_TRY_CHECK;" << endl - << "if (! ::CORBA::is_nil (scom.in ()))" << endl - << "{" - << "scom->ccm_remove (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl - << "}" - << "ACE_CATCHANY" << endl - << "{" - << "}" - << "ACE_ENDTRY;" << endl - << "this->context_->_remove_ref ();" << endl - << "}" << endl; + << "}"; // Generate provides_<facet> operation. { @@ -2324,7 +2306,7 @@ namespace << "ACE_THROW_RETURN (" << endl << "::CORBA::BAD_PARAM ()," << endl << "::CORBA::Object::_nil ());" << endl - << "}" << endl; + << "}"; // Generate an IF block for each facet inside provide_facet(). { @@ -2346,7 +2328,7 @@ namespace os << "ACE_THROW_RETURN (" << endl << STRS[EXCP_IN] << " ()," << endl << "::CORBA::Object::_nil ());" << endl - << "}" << endl; + << "}"; os << "::Components::FacetDescriptions *" << endl << t.name () << "_Servant::get_named_facets (" << endl @@ -2357,28 +2339,7 @@ namespace << STRS[EXCP_IN] << "))" << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; - - os << "CORBA::Boolean" << endl - << t.name () << "_Servant::same_component (" << endl - << "CORBA::Object_ptr object_ref" << endl - << STRS[ENV_SRC] << ")" << endl - << STRS[EXCP_SNGL] << endl - << "{" - << "if (::CORBA::is_nil (object_ref))" << endl - << "{" - << "ACE_THROW_RETURN (::CORBA::BAD_PARAM (), 0);" << endl - << "}" << endl - << "::CORBA::Object_var the_other =" << endl - << "object_ref->_get_component (" << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK_RETURN (0);" << endl - << "::CORBA::Object_var me =" << endl - << "this->context_->get_CCM_object (" << STRS[ENV_SNGL_ARG] << ");" - << "ACE_CHECK_RETURN (0);" << endl - << "return me->_is_equivalent (" << endl - << "the_other.in ()" << endl - << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; os << "::Components::EmitterDescriptions *" << endl << t.name () << "_Servant::get_all_emitters (" @@ -2387,7 +2348,7 @@ namespace << STRS[EXCP_SNGL] << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << "::Components::EmitterDescriptions *" << endl << t.name () << "_Servant::get_named_emitters (" @@ -2399,7 +2360,7 @@ namespace << STRS[EXCP_IN] << "))" << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; // Generate subscribe_* and unsubscribe_* operations. { @@ -2453,7 +2414,7 @@ namespace << "if (name == 0)" << endl << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_IN] << " (), 0);" << endl - << "}" << endl; + << "}"; // Generate IF block in connect operation for each receptacle. { @@ -2473,7 +2434,7 @@ namespace } os << "ACE_THROW_RETURN (" << STRS[EXCP_IN] << " (), 0);" << endl - << "}" << endl; + << "}"; os << "CORBA::Object_ptr" << endl << t.name () << "_Servant::disconnect (" << endl @@ -2492,7 +2453,7 @@ namespace << "ACE_THROW_RETURN (" << endl << STRS[EXCP_IN] << " ()," << endl << "::CORBA::Object::_nil ());" << endl - << "}" << endl; + << "}"; // Generate IF block in disconnect operation for each receptacle. { @@ -2515,7 +2476,7 @@ namespace << STRS[EXCP_IN] << " ()," << endl << "::CORBA::Object::_nil ());" << endl << "ACE_UNUSED_ARG (ck);" << endl - << "}" << endl; + << "}"; os << "::Components::ConnectionDescriptions *" << endl << t.name () << "_Servant::get_connections (" @@ -2527,7 +2488,7 @@ namespace << STRS[EXCP_IN] << "))" << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << "::Components::ReceptacleDescriptions *" << endl << t.name () << "_Servant::get_all_receptacles (" @@ -2536,7 +2497,7 @@ namespace << STRS[EXCP_SNGL] << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << "::Components::ReceptacleDescriptions *" << endl << t.name () << "_Servant::get_named_receptacles (" @@ -2548,7 +2509,7 @@ namespace << STRS[EXCP_IN] << "))" << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; // Generate generic operations for receptacles. { @@ -2580,7 +2541,7 @@ namespace << "ACE_THROW_RETURN (" << endl << STRS[EXCP_IN] << " ()," << endl << STRS[COMP_ECB] << "::_nil ());" << endl - << "}" << endl; + << "}"; // Generate an IF block in for each consumer in get_consumer(). { @@ -2602,7 +2563,7 @@ namespace os << "ACE_THROW_RETURN (" << endl << STRS[EXCP_IN] << " ()," << endl << STRS[COMP_ECB] << "::_nil ());" << endl - << "}" << endl; + << "}"; os << "void" << endl << t.name () << "_Servant::connect_consumer (" @@ -2619,7 +2580,7 @@ namespace << "if (emitter_name == 0)" << endl << "{" << "ACE_THROW (::CORBA::BAD_PARAM ());" << endl - << "}" << endl; + << "}"; // Generate an IF block for each 'emits' declaration. { @@ -2641,7 +2602,7 @@ namespace os << "ACE_UNUSED_ARG (consumer);" << "ACE_THROW (" << STRS[EXCP_IN] << " ());" << endl - << "}" << endl; + << "}"; os << STRS[COMP_ECB] << "_ptr" << endl << t.name () << "_Servant::disconnect_consumer (" @@ -2654,7 +2615,7 @@ namespace << STRS[EXCP_NC] << "))" << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << "::Components::ConsumerDescriptions *" << endl << t.name () << "_Servant::get_named_consumers (" @@ -2666,7 +2627,7 @@ namespace << STRS[EXCP_IN] << "))" << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << STRS[COMP_CK] << " *" << endl << t.name () << "_Servant::subscribe (" << endl @@ -2685,7 +2646,7 @@ namespace << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_IN] << " (), 0);" << endl - << "}" << endl; + << "}"; // Generate an IF block in for each publisher in subscribe(). { @@ -2705,7 +2666,7 @@ namespace } os << "ACE_THROW_RETURN (" << STRS[EXCP_IN] << " (), 0);" << endl - << "}" << endl; + << "}"; os << STRS[COMP_ECB] << "_ptr" << endl << t.name () << "_Servant::unsubscribe (" @@ -2725,7 +2686,7 @@ namespace << "ACE_THROW_RETURN (" << endl << STRS[EXCP_IN] << " ()," << endl << STRS[COMP_ECB] << "::_nil ());" << endl - << "}" << endl; + << "}"; // Generate an IF block in for each publisher in unsubscribe(). { @@ -2747,7 +2708,7 @@ namespace os << "ACE_THROW_RETURN (" << endl << STRS[EXCP_IN] << " ()," << endl << STRS[COMP_ECB] << "::_nil ());" << endl - << "}" << endl; + << "}"; // @@ (diego) These are not implemented. Whenever they are, // they'll require a treatment as all the other ports above. @@ -2759,7 +2720,7 @@ namespace << STRS[EXCP_SNGL] << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; os << "::Components::PublisherDescriptions *" << endl << t.name () << "_Servant::get_named_publishers (" @@ -2771,7 +2732,7 @@ namespace << STRS[EXCP_IN] << "))" << endl << "{" << "ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0);" << endl - << "}" << endl; + << "}"; // Generate connect() and disconnect() for each emits declaration. { @@ -2800,7 +2761,7 @@ namespace << "ACE_THROW_RETURN (" << endl << "::CORBA::NO_IMPLEMENT ()," << endl << "::CORBA::IRObject::_nil ());" << endl - << "}" << endl; + << "}"; os << "::Components::CCMHome_ptr" << endl << t.name () << "_Servant::get_ccm_home (" << endl @@ -2809,7 +2770,7 @@ namespace << "{" << "return this->context_->get_CCM_home " << "(ACE_ENV_SINGLE_ARG_PARAMETER);" << endl - << "}" << endl; + << "}"; os << "::Components::PrimaryKeyBase *" << endl << t.name () << "_Servant::get_primary_key (" << endl @@ -2819,7 +2780,7 @@ namespace << STRS[EXCP_NKA] << "))" << endl << "{" << "ACE_THROW_RETURN (" << STRS[EXCP_NKA] << " (), 0);" << endl - << "}" << endl; + << "}"; os << "void" << endl << t.name () @@ -2830,7 +2791,7 @@ namespace << STRS[EXCP_ICF] << "))" << endl << "{" << "// CIAO to-do" << endl - << "}" << endl; + << "}"; os << "void" << endl << t.name () << "_Servant::remove (" << endl @@ -2840,7 +2801,7 @@ namespace << STRS[EXCP_RF] << "))" << endl << "{" << "// CIAO to-do" << endl - << "}" << endl; + << "}"; os << "::Components::ComponentPortDescription *" << endl << t.name () << "_Servant::get_all_ports (" << endl @@ -2872,15 +2833,15 @@ namespace << "retv->emitters (emitter_desc.in ());" << "retv->publishers (publisher_desc.in ());" << endl << "return retv._retn ();" << endl - << "}" << endl; + << "}"; os << "CORBA::Object_ptr" << endl << t.name () << "_Servant::_get_component (" << endl << STRS[ENV_SNGL_SRC] << ")" << endl << STRS[EXCP_SNGL] << endl << "{" - << "::Components::SessionContext_var sc =" << endl - << "::Components::SessionContext::_narrow (" << endl + << STRS[COMP_SC] << "_var sc =" << endl + << STRS[COMP_SC] << "::_narrow (" << endl << "this->context_" << endl << STRS[ENV_ARG] << ");" << "ACE_CHECK_RETURN (::CORBA::Object::_nil ());" << endl @@ -2888,7 +2849,7 @@ namespace << "{" << "return sc->get_CCM_object (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl + << "}" << "::Components::EntityContext_var ec =" << endl << "::Components::EntityContext::_narrow (" << endl << "this->context_" << endl @@ -2898,11 +2859,11 @@ namespace << "{" << "return ec->get_CCM_object (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl + << "}" << "ACE_THROW_RETURN (" << endl << "::CORBA::INTERNAL ()," << endl << "::CORBA::Object::_nil ());" << endl - << "}" << endl; + << "}"; os << "// CIAO-specific operations." << endl << endl; @@ -2919,8 +2880,8 @@ namespace << "if (! ::CORBA::is_nil (temp.in ()))" << endl << "{" << "temp->ciao_preactivate (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl - << "}" << endl; + << "}" + << "}"; os << "void" << endl << t.name () << "_Servant::ciao_activate (" << endl @@ -2954,8 +2915,8 @@ namespace << "if (! ::CORBA::is_nil (temp.in ()))" << endl << "{" << "temp->ccm_activate (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl - << "}" << endl; + << "}" + << "}"; os << "void" << endl << t.name () << "_Servant::ciao_postactivate (" << endl @@ -2971,12 +2932,12 @@ namespace << "{" << "temp->ciao_postactivate (" << STRS[ENV_SNGL_ARG] << ");" // << "ACE_CHECK;" - << "}" << endl + << "}" // @@@ JP - This is commented out for now until other issues in // DaNCe get resolved // << "this->populate_port_tables (" << STRS[ENV_SNGL_ARG] // << ");" - << "}" << endl; + << "}"; os << "void" << endl << t.name () << "_Servant::_ciao_passivate (" << endl @@ -2991,8 +2952,8 @@ namespace << "if (! ::CORBA::is_nil (temp.in ()))" << endl << "{" << "temp->ccm_passivate (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl - << "}" << endl; + << "}" + << "}"; os << "// Supported operations." << endl << endl; @@ -3108,14 +3069,14 @@ namespace component_emitter.traverse (t); } - os << "}" << endl; + os << "}"; } virtual void post (Type& t) { // Namespace closer. - os << "}" << endl; + os << "}"; } }; @@ -3136,7 +3097,7 @@ namespace virtual void traverse (SemanticGraph::Type&) { - os << "::Components::EnterpriseComponent_var _ciao_ec =" << endl + os << STRS[COMP_EC] << "_var _ciao_ec =" << endl << "this->executor_->"; } @@ -3176,16 +3137,19 @@ 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 ()), scope_ (home) - {} + { + returns_.node_traverser (return_type_name_emitter_); + enclosing_manages_.node_traverser (enclosing_type_name_emitter_); + simple_manages_.node_traverser (simple_type_name_emitter_); + } virtual void returns (SemanticGraph::HomeFactory& hf) { - ReturnTypeNameEmitter returns_emitter (os); - Traversal::Returns returns_; - returns_.node_traverser (returns_emitter); - Traversal::HomeFactory::returns (hf, returns_); os << endl; @@ -3263,53 +3227,23 @@ namespace os << "ACE_CHECK_RETURN ("; - { - ReturnTypeNameEmitter returns_emitter (os); - Traversal::Returns returns_; - returns_.node_traverser (returns_emitter); - - Traversal::HomeFactory::returns (hf, returns_); - } + Traversal::HomeFactory::returns (hf, returns_); os << "::_nil ());" << endl; - { - EnclosingTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (scope_, manages_); - } + Traversal::Home::manages (scope_, enclosing_manages_); os << "::CCM_"; - { - SimpleTypeNameEmitter manages_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (manages_emitter); - - manages (scope_, manages_); - } + Traversal::Home::manages (scope_, simple_manages_); os << "_var _ciao_comp =" << endl; - { - EnclosingTypeNameEmitter name_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (name_emitter); - - manages (scope_, manages_); - } + Traversal::Home::manages (scope_, enclosing_manages_); os << "::CCM_"; - { - SimpleTypeNameEmitter manages_emitter (os); - Traversal::Manages manages_; - manages_.node_traverser (manages_emitter); - - manages (scope_, manages_); - } + Traversal::Home::manages (scope_, simple_manages_); os << "::_narrow (" << endl << "_ciao_ec.in ()" << endl @@ -3317,13 +3251,7 @@ namespace os << "ACE_CHECK_RETURN ("; - { - ReturnTypeNameEmitter returns_emitter (os); - Traversal::Returns returns_; - returns_.node_traverser (returns_emitter); - - Traversal::HomeFactory::returns (hf, returns_); - } + Traversal::HomeFactory::returns (hf, returns_); os << "::_nil ());" << endl; @@ -3331,7 +3259,7 @@ namespace << "_ciao_comp.in ()" << endl << STRS[ENV_ARG] << ");" << endl; - os << "}" << endl; + os << "}"; } virtual void @@ -3341,6 +3269,113 @@ namespace } private: + ReturnTypeNameEmitter return_type_name_emitter_; + EnclosingTypeNameEmitter enclosing_type_name_emitter_; + SimpleTypeNameEmitter simple_type_name_emitter_; + Traversal::Returns returns_; + Traversal::Manages enclosing_manages_; + Traversal::Manages simple_manages_; + SemanticGraph::Home& scope_; + }; + + struct FinderOperationEmitter : Traversal::HomeFinder, + Traversal::Home, + EmitterBase + { + 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 ()), + scope_ (home) + { + returns_.node_traverser (return_type_name_emitter_); + simple_returns_.node_traverser (type_name_emitter_); + enclosing_manages_.node_traverser (enclosing_type_name_emitter_); + simple_manages_.node_traverser (simple_type_name_emitter_); + } + + virtual void + returns (SemanticGraph::HomeFinder& hf) + { + Traversal::HomeFinder::returns (hf, returns_); + + os << endl; + } + + virtual void + name (SemanticGraph::HomeFinder& hf) + { + os << scope_.name () << "_Servant::" << hf.name (); + } + + virtual void + receives_none (SemanticGraph::HomeFinder&) + { + os << " (" << endl + << STRS[ENV_SNGL_SRC] << ")" << endl; + } + + virtual void + receives_pre (SemanticGraph::HomeFinder&) + { + os << " (" << endl; + } + + virtual void + receives_post (SemanticGraph::HomeFinder&) + { + os << endl << STRS[ENV_SRC] << ")" << 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& hf) + { + os << "{" + << "ACE_THROW_RETURN (" << endl + << "::CORBA::NO_IMPLEMENT ()," << endl; + + Traversal::HomeFinder::returns (hf, simple_returns_); + + os << "::_nil ());" + << "}"; + } + + virtual void + comma (SemanticGraph::HomeFinder&) + { + os << "," << endl; + } + + private: + TypeNameEmitter type_name_emitter_; + ReturnTypeNameEmitter return_type_name_emitter_; + EnclosingTypeNameEmitter enclosing_type_name_emitter_; + SimpleTypeNameEmitter simple_type_name_emitter_; + Traversal::Returns returns_; + Traversal::Returns simple_returns_; + Traversal::Manages enclosing_manages_; + Traversal::Manages simple_manages_; SemanticGraph::Home& scope_; }; @@ -3361,12 +3396,12 @@ namespace << t.name () << "::_duplicate (exe))," << endl << "container_ (c)" << endl << "{" - << "}" << endl; + << "}"; os << t.name () << "_Servant::~" << t.name () << "_Servant (void)" << endl << "{" - << "}" << endl; + << "}"; os << "// Home operations." << endl << endl; @@ -3482,7 +3517,7 @@ namespace home_emitter.traverse (t); } - os << "// Home factory operations." << endl << endl; + os << "// Home factory and finder operations." << endl << endl; { Traversal::Home home_emitter; @@ -3495,7 +3530,9 @@ namespace home_emitter.edge_traverser (defines); FactoryOperationEmitter factory_operation_emitter (ctx, t); + FinderOperationEmitter finder_operation_emitter (ctx, t); defines.node_traverser (factory_operation_emitter); + defines.node_traverser (finder_operation_emitter); Traversal::Receives receives; Traversal::Belongs returns; @@ -3503,6 +3540,9 @@ namespace factory_operation_emitter.edge_traverser (receives); factory_operation_emitter.edge_traverser (returns); factory_operation_emitter.edge_traverser (raises); + finder_operation_emitter.edge_traverser (receives); + finder_operation_emitter.edge_traverser (returns); + finder_operation_emitter.edge_traverser (raises); ParameterEmitter<Traversal::InParameter> in_param (os); ParameterEmitter<Traversal::InOutParameter> inout_param (os); @@ -3562,7 +3602,7 @@ namespace << "::Components::CreateFailure))" << endl << "{" << "return this->create (" << STRS[ENV_SNGL_ARG] << ");" << endl - << "}" << endl; + << "}"; os << "// Operations for implicit home interface." << endl << endl; @@ -3595,8 +3635,8 @@ namespace } os << "::_nil ());" << endl - << "}" << endl - << "Components::EnterpriseComponent_var _ciao_ec =" << endl + << "}" + << STRS[COMP_EC] << "_var _ciao_ec =" << endl << "this->executor_->create (" << STRS[ENV_SNGL_ARG] << ");" << "ACE_CHECK_RETURN ("; @@ -3665,7 +3705,7 @@ namespace << "return this->_ciao_activate_component (" << endl << "_ciao_comp.in ()" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; os << "// Operations for CCMHome interface." << endl << endl; @@ -3677,7 +3717,7 @@ namespace << "ACE_THROW_RETURN (" << endl << "::CORBA::NO_IMPLEMENT ()," << endl << "::CORBA::IRObject::_nil ());" << endl - << "}" << endl; + << "}"; os << "::CORBA::IRObject_ptr" << endl << t.name () << "_Servant::get_home_def (" << endl @@ -3687,7 +3727,7 @@ namespace << "ACE_THROW_RETURN (" << endl << "::CORBA::NO_IMPLEMENT ()," << endl << "::CORBA::IRObject::_nil ());" << endl - << "}" << endl; + << "}"; os << "void" << endl << t.name () << "_Servant::remove_component (" << endl @@ -3723,13 +3763,13 @@ namespace << "if (CORBA::is_nil (_ciao_comp.in ()))" << endl << "{" << "ACE_THROW (CORBA::INTERNAL ());" << endl - << "}" << endl + << "}" << "_ciao_comp->remove (" << STRS[ENV_SNGL_ARG] << ");" << "ACE_CHECK;" << endl << "this->_ciao_passivate_component (" << endl << "_ciao_comp.in ()" << endl << STRS[ENV_ARG] << ");" << endl - << "}" << endl; + << "}"; os << "// CIAO-specific operations." << endl << endl; @@ -3880,9 +3920,9 @@ namespace << "if (this->component_map_.bind (oid.in (), svt) == 0)" << endl << "{" << "safe._retn ();" << endl - << "}" << endl + << "}" << "return ho._retn ();" << endl - << "}" << endl; + << "}"; os << "void" << endl << t.name () @@ -3923,15 +3963,15 @@ namespace << "PortableServer::ServantBase_var safe (servant);" << endl << "servant->_ciao_passivate (" << STRS[ENV_SNGL_ARG] << ");" << "ACE_CHECK;" << endl - << "}" << endl - << "}" << endl; + << "}" + << "}"; } virtual void post (Type& t) { // Namespace closer. - os << "}" << endl; + os << "}"; os << "extern \"C\" " << ctx.export_macro () << " ::PortableServer::Servant" @@ -3944,7 +3984,7 @@ namespace << "if (p == 0)" << endl << "{" << "return 0;" << endl - << "}" << endl + << "}" << t.scoped_name ().scope_name () << "::CCM_" << t.name () << "_var x =" << endl << t.scoped_name ().scope_name () << "::CCM_" << t.name () @@ -3955,7 +3995,7 @@ namespace << "if (::CORBA::is_nil (x.in ()))" << endl << "{" << "return 0;" << endl - << "}" << endl + << "}" << "return new" << endl; os << "CIAO_GLUE" @@ -3963,7 +4003,7 @@ namespace << "::" << t.name () << "_Servant (" << endl << "x.in ()," << endl << "c);" << endl - << "}" << endl; + << "}"; } }; @@ -4012,7 +4052,7 @@ ServantSourceEmitter::pre (TranslationUnit& u) file_name = file_.leaf (); } - string file_suffix = cl_.get_value ("hdr-file-suffix", + string file_suffix = cl_.get_value ("svnt-hdr-file-suffix", "_svnt.h"); file_name = regex::perl_s (file_name, diff --git a/TAO/CIAO/CIDLC/TypeNameEmitter.cpp b/TAO/CIAO/CIDLC/TypeNameEmitter.cpp index 71d4ca964b5..863a7813d78 100644 --- a/TAO/CIAO/CIDLC/TypeNameEmitter.cpp +++ b/TAO/CIAO/CIDLC/TypeNameEmitter.cpp @@ -196,6 +196,12 @@ ReturnTypeNameEmitter::traverse (SemanticGraph::Component& c) os << c.scoped_name () << "_ptr"; } +void +ReturnTypeNameEmitter::traverse (SemanticGraph::Home& h) +{ + os << h.scoped_name () << "_ptr"; +} + // =============================================================== INArgTypeNameEmitter::INArgTypeNameEmitter (ostream& os_) @@ -359,6 +365,12 @@ INArgTypeNameEmitter::traverse (SemanticGraph::Component& c) os << c.scoped_name () << "_ptr"; } +void +INArgTypeNameEmitter::traverse (SemanticGraph::Home& h) +{ + os << h.scoped_name () << "_ptr"; +} + // =============================================================== INOUTArgTypeNameEmitter::INOUTArgTypeNameEmitter (ostream& os_) @@ -522,6 +534,12 @@ INOUTArgTypeNameEmitter::traverse (SemanticGraph::Component& c) os << c.scoped_name () << "_ptr &"; } +void +INOUTArgTypeNameEmitter::traverse (SemanticGraph::Home& h) +{ + os << h.scoped_name () << "_ptr"; +} + // ================================================================= OUTArgTypeNameEmitter::OUTArgTypeNameEmitter (ostream& os_) @@ -685,4 +703,202 @@ OUTArgTypeNameEmitter::traverse (SemanticGraph::Component& c) os << c.scoped_name () << "_out"; } +void +OUTArgTypeNameEmitter::traverse (SemanticGraph::Home& h) +{ + os << h.scoped_name () << "_ptr"; +} + +// ==================================================================== + +NullReturnEmitter::NullReturnEmitter (ostream& os_) + : TypeNameEmitter (os_) +{ +} + +void +NullReturnEmitter::traverse (Void&) +{ +} + +void +NullReturnEmitter::traverse (Boolean&) +{ + os << "return false;"; +} + +void +NullReturnEmitter::traverse (Octet&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Char&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Wchar&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Short&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (UnsignedShort&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Long&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (UnsignedLong&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (LongLong&) +{ + os << "return ACE_CDR_LONGLONG_INITIALIZER;"; +} + +void +NullReturnEmitter::traverse (UnsignedLongLong&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Float&) +{ + os << "return 0.0f;"; +} + +void +NullReturnEmitter::traverse (Double&) +{ + os << "return 0.0;"; +} + +void +NullReturnEmitter::traverse (String&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Wstring&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Object&) +{ + os << "return ::CORBA::Object::_nil ();"; +} + +void +NullReturnEmitter::traverse (ValueBase&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (Any&) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (SemanticGraph::Enum& e) +{ + os << e.scoped_name (); +} + +void +NullReturnEmitter::traverse (SemanticGraph::Struct& s) +{ + // This should always be in the context, since the SizeTypeCalculator + // is executed before the servant code generators. + bool var_size = s.context ().get<bool> (STRS[VAR_SIZE]); + + if (var_size) + { + os << "return 0;"; + } + else + { + os << s.scoped_name () << " retval;" << endl + << "return retval;"; + } +} + +void +NullReturnEmitter::traverse (SemanticGraph::Union& u) +{ + // This should always be in the context, since the SizeTypeCalculator + // is executed before the servant code generators. + bool var_size = u.context ().get<bool> (STRS[VAR_SIZE]); + + if (var_size) + { + os << "return 0;"; + } + else + { + os << u.scoped_name () << " retval;" << endl + << "return retval;"; + } +} + +void +NullReturnEmitter::traverse (SemanticGraph::UnboundedSequence& s) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (SemanticGraph::Interface& i) +{ + os << "return " << i.scoped_name () << "::_nil ();"; +} + +void +NullReturnEmitter::traverse (SemanticGraph::ValueType& v) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (SemanticGraph::EventType& e) +{ + os << "return 0;"; +} + +void +NullReturnEmitter::traverse (SemanticGraph::Component& c) +{ + os << "return " << c.scoped_name () << "::_nil ();"; +} + +void +NullReturnEmitter::traverse (SemanticGraph::Home& h) +{ + os << "return " << h.scoped_name () << "::_nil ();"; +} + diff --git a/TAO/CIAO/CIDLC/TypeNameEmitter.hpp b/TAO/CIAO/CIDLC/TypeNameEmitter.hpp index 89fd89eb519..8a66e400d53 100644 --- a/TAO/CIAO/CIDLC/TypeNameEmitter.hpp +++ b/TAO/CIAO/CIDLC/TypeNameEmitter.hpp @@ -40,7 +40,8 @@ class TypeNameEmitter : public Traversal::Void, public Traversal::Interface, public Traversal::ValueType, public Traversal::EventType, - public Traversal::Component + public Traversal::Component, + public Traversal::Home { protected: TypeNameEmitter (std::ostream&); @@ -82,6 +83,7 @@ public: virtual void traverse (SemanticGraph::ValueType&); virtual void traverse (SemanticGraph::EventType&); virtual void traverse (SemanticGraph::Component&); + virtual void traverse (SemanticGraph::Home&); }; // Generates the typename of an IN argument. @@ -118,6 +120,7 @@ public: virtual void traverse (SemanticGraph::ValueType&); virtual void traverse (SemanticGraph::EventType&); virtual void traverse (SemanticGraph::Component&); + virtual void traverse (SemanticGraph::Home&); }; // Generates the typename of an INOUT argument. @@ -154,6 +157,7 @@ public: virtual void traverse (SemanticGraph::ValueType&); virtual void traverse (SemanticGraph::EventType&); virtual void traverse (SemanticGraph::Component&); + virtual void traverse (SemanticGraph::Home&); }; // Generates the typename of an OUT argument. @@ -190,6 +194,45 @@ public: virtual void traverse (SemanticGraph::ValueType&); virtual void traverse (SemanticGraph::EventType&); virtual void traverse (SemanticGraph::Component&); + virtual void traverse (SemanticGraph::Home&); +}; + +// Generates 'return' plus the appropriate NULL return value, +// including no output for Void. +// +// +class NullReturnEmitter : public TypeNameEmitter +{ +public: + NullReturnEmitter (std::ostream&); + + virtual void traverse (Void&); + virtual void traverse (Boolean&); + virtual void traverse (Octet&); + virtual void traverse (Char&); + virtual void traverse (Wchar&); + virtual void traverse (Short&); + virtual void traverse (UnsignedShort&); + virtual void traverse (Long&); + virtual void traverse (UnsignedLong&); + virtual void traverse (LongLong&); + virtual void traverse (UnsignedLongLong&); + virtual void traverse (Float&); + virtual void traverse (Double&); + virtual void traverse (String&); + virtual void traverse (Wstring&); + virtual void traverse (Object&); + virtual void traverse (ValueBase&); + virtual void traverse (Any&); + virtual void traverse (SemanticGraph::Enum&); + virtual void traverse (SemanticGraph::Struct&); + virtual void traverse (SemanticGraph::Union&); + virtual void traverse (SemanticGraph::UnboundedSequence&); + virtual void traverse (SemanticGraph::Interface&); + virtual void traverse (SemanticGraph::ValueType&); + virtual void traverse (SemanticGraph::EventType&); + virtual void traverse (SemanticGraph::Component&); + virtual void traverse (SemanticGraph::Home&); }; #endif /* TYPENAME_EMITTER_HPP */ diff --git a/TAO/CIAO/CIDLC/cidlc.cpp b/TAO/CIAO/CIDLC/cidlc.cpp index f5bc7921c64..d7db7708d53 100644 --- a/TAO/CIAO/CIDLC/cidlc.cpp +++ b/TAO/CIAO/CIDLC/cidlc.cpp @@ -22,6 +22,7 @@ #include "ExecutorMappingGenerator.hpp" #include "ServantGenerator.hpp" +#include "ExecImplGenerator.hpp" /* #include "RepositoryIdGenerator.hpp" */ @@ -37,8 +38,8 @@ class ErrorDetector : public std::streambuf { public: ErrorDetector (std::streambuf* prev) - : error_ (false), - prev_ (*prev) + : error_ (false), + prev_ (*prev) { } @@ -96,6 +97,7 @@ main (int argc, char* argv[]) ExecutorMappingGenerator lem_gen; ServantGenerator svnt_gen (cl); + ExecImplGenerator impl_gen (cl); /* RepositoryIdGenerator repid_gen; */ @@ -109,6 +111,7 @@ main (int argc, char* argv[]) lem_gen.options (d); svnt_gen.options (d); desc_gen.options (d); + impl_gen.options (d); d.add_option (CL::OptionDescription ( "trace-semantic-actions", @@ -121,6 +124,11 @@ main (int argc, char* argv[]) true)); d.add_option (CL::OptionDescription ( + "gen-exec-impl", + "Generate the executor implementation classes.", + true)); + + d.add_option (CL::OptionDescription ( "help", "Display usage information and exit.", true)); @@ -284,6 +292,12 @@ main (int argc, char* argv[]) svnt_gen.generate (tu, file_path); } + // Generate executor implementation code. + if (cl.get_value ("gen-exec-impl", false)) + { + impl_gen.generate (tu, file_path); + } + /* // Compute repository IDs in a separate pass. diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 8a6792f8487..8afc802efb1 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,68 @@ +Thu Aug 5 17:42:56 2004 Jeff Parsons <j.parsons@vanderbilt.edu> + + * CIDLC/ExecImplGenerator.cpp: + * CIDLC/ExecImplGenerator.hpp: + * CIDLC/ExecImplHeaderGenerator.cpp: + * CIDLC/ExecImplHeaderGenerator.hpp: + * CIDLC/ExecImplSourceGenerator.cpp: + * CIDLC/ExecImplSourceGenerator.hpp: + + New files, which generate empty executor implementation + classes (with spec-defined operations filled in and + IDL operations and attributes marked for the developer + to fill in). This generation is optional, triggered by + the CIDL compiler command line option --gen-exec-impl. + Two other options --exec-hdr-file-suffix and --exec-src-file-suffix, + can override the default generated file extensions of + _exec.h and _exec.cpp. Tao others, --exec-hdr-file-regex and + --exec-src-file-regex, allow replacement of default generated + filenames by pattern matching with regular expressions. + And finally, two more, --exec-export-include, + overrides the default generated export macro header file, + and --exec-export-macro, overrides the default generated + export macro for the executor implementation file. + + * CIDLC/Literals.cpp: + * CIDLC/Literals.hpp: + * CIDLC/ServantGenerator.cpp: + * CIDLC/ServantHeaderGenerator.cpp: + * CIDLC/ServantHeaderGenerator.hpp: + * CIDLC/ServantSourceGenerator.cpp: + * CIDLC/TypeNameEmitter.cpp: + * CIDLC/TypeNameEmitter.hpp: + * CIDLC/cidlc.cpp: + + - Added generation of (unimplemented) home finder + operations. + + - Filled gaps and organized the command line options + for servant filename suffixes and regular expressions + to replace default generated filenames. + + - Added a new type name emitter that generates the + appropriate NULL return value for any type. + + * tests/CIDL/CodeGen/Basic.idl: + * tests/CIDL/CodeGen/Basic_stub_export.h: + * tests/CIDL/CodeGen/Basic_svnt_export.h: + * tests/CIDL/CodeGen/CodeGen.cidl: + * tests/CIDL/CodeGen/CodeGen.idl: + * tests/CIDL/CodeGen/CodeGen.mpc: + * tests/CIDL/CodeGen/CodeGen_exec_export.h: + * tests/CIDL/CodeGen/CodeGen_stub_export.h: + * tests/CIDL/CodeGen/CodeGen_svnt_export.h: + * tests/CIDL/CodeGen/README: + + New test, for servant and executor implemtation code + generation of the CIDL compiler. This test target + correct code generation for many component-specific + features of IDL - catching operations and attributes + for supported interfaces, operations and attributes + for parents of supported interfaces, home operations + from base homes, inherited home factory and finder + operations, etc. The object of the test is to check + that the generated code builds and links successfully. + Thu Aug 5 15:49:10 2004 Ossama Othman <ossama@dre.vanderbilt.edu> * DAnCE/tests/NodeApplicationTest/RoundTrip_exec.h: @@ -36,6 +101,7 @@ Thu Aug 5 15:49:10 2004 Ossama Othman <ossama@dre.vanderbilt.edu> Fixed unused parameter warning in emulated exception builds. +>>>>>>> 1.869 Thu Aug 5 11:48:49 2004 Ossama Othman <ossama@dre.vanderbilt.edu> * performance-tests/Protocols/Controller/Controller.mpc: diff --git a/TAO/CIAO/tests/CIDL/CodeGen/Basic.idl b/TAO/CIAO/tests/CIDL/CodeGen/Basic.idl new file mode 100644 index 00000000000..2d8ab209e5a --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/Basic.idl @@ -0,0 +1,57 @@ +// $Id$ +//============================================================================= +/** + * @file Basic.idl + * + * Definition of events, and common interfaces used in the BasicSP module. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_BASIC_IDL +#define CIAO_BASIC_IDL + +#include <Components.idl> + +// @@NOTE: Do we need a pragma prefix. Anyway its broken now in TAO.. + +module Extra +{ + exception NoReason {}; + exception NoRhyme {}; + + interface Superfluous + { + attribute string useless_attr; + long superfluous_op (in string empty_arg) + raises (NoReason); + }; + + interface Supernumerary + { + void supernumerary_op (out string dummy_arg) + raises (NoRhyme, NoReason); + }; +}; + +// #pragma prefix "" + +module Basic +{ + interface ReadData : Extra::Superfluous + { + string get_data (); + }; + + interface AnalyzeData + { + void perform_analysis (inout string data); + attribute boolean fine_tooth_comb; + }; + + eventtype TimeOut {}; + eventtype DataAvailable {}; +}; + +#endif /*CIAO_BASIC_IDL*/ diff --git a/TAO/CIAO/tests/CIDL/CodeGen/Basic_stub_export.h b/TAO/CIAO/tests/CIDL/CodeGen/Basic_stub_export.h new file mode 100644 index 00000000000..c47d1d3f45f --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/Basic_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s BASIC_STUB +// ------------------------------ +#ifndef BASIC_STUB_EXPORT_H +#define BASIC_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (BASIC_STUB_HAS_DLL) +# define BASIC_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && BASIC_STUB_HAS_DLL */ + +#if !defined (BASIC_STUB_HAS_DLL) +# define BASIC_STUB_HAS_DLL 1 +#endif /* ! BASIC_STUB_HAS_DLL */ + +#if defined (BASIC_STUB_HAS_DLL) && (BASIC_STUB_HAS_DLL == 1) +# if defined (BASIC_STUB_BUILD_DLL) +# define BASIC_STUB_Export ACE_Proper_Export_Flag +# define BASIC_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BASIC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BASIC_STUB_BUILD_DLL */ +# define BASIC_STUB_Export ACE_Proper_Import_Flag +# define BASIC_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BASIC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BASIC_STUB_BUILD_DLL */ +#else /* BASIC_STUB_HAS_DLL == 1 */ +# define BASIC_STUB_Export +# define BASIC_STUB_SINGLETON_DECLARATION(T) +# define BASIC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BASIC_STUB_HAS_DLL == 1 */ + +// Set BASIC_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BASIC_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define BASIC_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BASIC_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BASIC_STUB_NTRACE */ + +#if (BASIC_STUB_NTRACE == 1) +# define BASIC_STUB_TRACE(X) +#else /* (BASIC_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define BASIC_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (BASIC_STUB_NTRACE == 1) */ + +#endif /* BASIC_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/tests/CIDL/CodeGen/Basic_svnt_export.h b/TAO/CIAO/tests/CIDL/CodeGen/Basic_svnt_export.h new file mode 100644 index 00000000000..996ea3e3160 --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/Basic_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s BASIC_SVNT +// ------------------------------ +#ifndef BASIC_SVNT_EXPORT_H +#define BASIC_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (BASIC_SVNT_HAS_DLL) +# define BASIC_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && BASIC_SVNT_HAS_DLL */ + +#if !defined (BASIC_SVNT_HAS_DLL) +# define BASIC_SVNT_HAS_DLL 1 +#endif /* ! BASIC_SVNT_HAS_DLL */ + +#if defined (BASIC_SVNT_HAS_DLL) && (BASIC_SVNT_HAS_DLL == 1) +# if defined (BASIC_SVNT_BUILD_DLL) +# define BASIC_SVNT_Export ACE_Proper_Export_Flag +# define BASIC_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BASIC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BASIC_SVNT_BUILD_DLL */ +# define BASIC_SVNT_Export ACE_Proper_Import_Flag +# define BASIC_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BASIC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BASIC_SVNT_BUILD_DLL */ +#else /* BASIC_SVNT_HAS_DLL == 1 */ +# define BASIC_SVNT_Export +# define BASIC_SVNT_SINGLETON_DECLARATION(T) +# define BASIC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BASIC_SVNT_HAS_DLL == 1 */ + +// Set BASIC_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BASIC_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define BASIC_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BASIC_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BASIC_SVNT_NTRACE */ + +#if (BASIC_SVNT_NTRACE == 1) +# define BASIC_SVNT_TRACE(X) +#else /* (BASIC_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define BASIC_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (BASIC_SVNT_NTRACE == 1) */ + +#endif /* BASIC_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.cidl b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.cidl new file mode 100644 index 00000000000..e8570e23f38 --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.cidl @@ -0,0 +1,19 @@ +//$Id$ + +#ifndef CODEGEN_CIDL +#define CODEGEN_CIDL + +#include "CodeGen.idl" + +composition session CodeGen_Impl +{ + home executor CodeGenHome_Exec + { + implements Basic::CodeGenHome; + manages CodeGen_Exec; + }; +}; + +#endif /* CODEGEN_CIDL */ + + diff --git a/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.idl b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.idl new file mode 100644 index 00000000000..e14f5fde42e --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.idl @@ -0,0 +1,45 @@ +//$Id$ +#include "Basic.idl" + +module Basic +{ + component Base supports Extra::Supernumerary, Extra::Superfluous + { + provides ReadData data_read; + attribute boolean is_not_necessary; + }; + + component CodeGen : Base + { + provides ReadData data_out; + uses ReadData data_in; + publishes DataAvailable out_avail; + consumes DataAvailable in_avail; + provides AnalyzeData data_crunch; + + readonly attribute boolean is_necessary; + }; + + home BaseHome supports Extra::Supernumerary manages Base + { + void base_do_nothing (); + + factory create_no_base (in long fake_id) + raises (Extra::NoRhyme); + + finder find_no_base (); + + readonly attribute boolean is_useful; + }; + + home CodeGenHome : BaseHome manages CodeGen + { + factory create_no_derived (); + + finder find_no_derived (); + + attribute boolean is_not_useful; + + string do_nothing (); + }; +}; diff --git a/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.mpc b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.mpc new file mode 100644 index 00000000000..12453328707 --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen.mpc @@ -0,0 +1,115 @@ +// $Id$ + +project(Basic_stub): ciao_client { + + sharedname = Basic_stub + idlflags += -Wb,stub_export_macro=BASIC_STUB_Export -Wb,stub_export_include=Basic_stub_export.h -Wb,skel_export_macro=BASIC_SVNT_Export -Wb,skel_export_include=Basic_svnt_export.h + dynamicflags = BASIC_STUB_BUILD_DLL + + IDL_Files { + Basic.idl + } + + Source_Files { + BasicC.cpp + } + + Header_Files { + BasicC.h + Basic_stub_export.h + } +} + +project(Basic_svnt) : ciao_server { + after += Basic_stub + sharedname = Basic_svnt + libs += Basic_stub + + idlflags += -Wb,stub_export_macro=BASIC_STUB_Export -Wb,stub_export_include=Basic_stub_export.h -Wb,skel_export_macro=BASIC_SVNT_Export -Wb,skel_export_include=Basic_svnt_export.h + dynamicflags = BASIC_SVNT_BUILD_DLL + + IDL_Files { + Basic.idl + } + + Source_Files { + BasicS.cpp + } + + Header_Files { + BasicS.h + Basic_svnt_export.h + } +} + +project(CodeGen_stub): ciao_client { + after += Basic_stub + sharedname = CodeGen_stub + idlflags += -Wb,stub_export_macro=CODEGEN_STUB_Export -Wb,stub_export_include=CodeGen_stub_export.h -Wb,skel_export_macro=CODEGEN_SVNT_Export -Wb,skel_export_include=CodeGen_svnt_export.h + dynamicflags = CODEGEN_STUB_BUILD_DLL + + IDL_Files { + CodeGen.idl + } + + Source_Files { + CodeGenC.cpp + } + + Header_Files { + CodeGenC.h + CodeGen_stub_export.h + } +} + +project(CodeGen_svnt) : ciao_servant { + after += Basic_svnt CodeGen_stub + sharedname = CodeGen_svnt + libs += CodeGen_stub Basic_stub Basic_svnt + idlflags += -Wb,export_macro=CODEGEN_SVNT_Export -Wb,export_include=CODEGEN_svnt_export.h + dynamicflags = CODEGEN_SVNT_BUILD_DLL + cidlflags -= -- + cidlflags += --gen-exec-impl --exec-export-include CodeGen_exec_export.h -- + + CIDL_Files { + CodeGen.cidl + } + + IDL_Files { + CodeGenE.idl + } + + Source_Files { + CodeGenEC.cpp + CodeGenS.cpp + CodeGen_svnt.cpp + } + + Header_Files { + CodeGenEC.h + CodeGenS.h + CodeGen_svnt.h + CodeGen_svnt_export.h + } +} + + +project(CodeGen_exec) : ciao_component { + after += CodeGen_svnt + sharedname = CodeGen_exec + libs += CodeGen_stub CodeGen_svnt Basic_stub Basic_svnt + dynamicflags = CODEGEN_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + CodeGen_exec.cpp + } + + Header_Files { + CodeGen_exec.h + CodeGen_exec_export.h + } +} + diff --git a/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_exec_export.h b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_exec_export.h new file mode 100644 index 00000000000..545561f1278 --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_exec_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s CODEGEN_EXEC +// ------------------------------ +#ifndef CODEGEN_EXEC_EXPORT_H +#define CODEGEN_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (CODEGEN_EXEC_HAS_DLL) +# define CODEGEN_EXEC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && CODEGEN_EXEC_HAS_DLL */ + +#if !defined (CODEGEN_EXEC_HAS_DLL) +# define CODEGEN_EXEC_HAS_DLL 1 +#endif /* ! CODEGEN_EXEC_HAS_DLL */ + +#if defined (CODEGEN_EXEC_HAS_DLL) && (CODEGEN_EXEC_HAS_DLL == 1) +# if defined (CODEGEN_EXEC_BUILD_DLL) +# define CODEGEN_EXEC_Export ACE_Proper_Export_Flag +# define CODEGEN_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CODEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CODEGEN_EXEC_BUILD_DLL */ +# define CODEGEN_EXEC_Export ACE_Proper_Import_Flag +# define CODEGEN_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CODEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CODEGEN_EXEC_BUILD_DLL */ +#else /* CODEGEN_EXEC_HAS_DLL == 1 */ +# define CODEGEN_EXEC_Export +# define CODEGEN_EXEC_SINGLETON_DECLARATION(T) +# define CODEGEN_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CODEGEN_EXEC_HAS_DLL == 1 */ + +// Set CODEGEN_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CODEGEN_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define CODEGEN_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CODEGEN_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CODEGEN_EXEC_NTRACE */ + +#if (CODEGEN_EXEC_NTRACE == 1) +# define CODEGEN_EXEC_TRACE(X) +#else /* (CODEGEN_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CODEGEN_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CODEGEN_EXEC_NTRACE == 1) */ + +#endif /* CODEGEN_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_stub_export.h b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_stub_export.h new file mode 100644 index 00000000000..bd48c6a60ab --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_stub_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s CODEGEN_STUB +// ------------------------------ +#ifndef CODEGEN_STUB_EXPORT_H +#define CODEGEN_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (CODEGEN_STUB_HAS_DLL) +# define CODEGEN_STUB_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && CODEGEN_STUB_HAS_DLL */ + +#if !defined (CODEGEN_STUB_HAS_DLL) +# define CODEGEN_STUB_HAS_DLL 1 +#endif /* ! CODEGEN_STUB_HAS_DLL */ + +#if defined (CODEGEN_STUB_HAS_DLL) && (CODEGEN_STUB_HAS_DLL == 1) +# if defined (CODEGEN_STUB_BUILD_DLL) +# define CODEGEN_STUB_Export ACE_Proper_Export_Flag +# define CODEGEN_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CODEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CODEGEN_STUB_BUILD_DLL */ +# define CODEGEN_STUB_Export ACE_Proper_Import_Flag +# define CODEGEN_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CODEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CODEGEN_STUB_BUILD_DLL */ +#else /* CODEGEN_STUB_HAS_DLL == 1 */ +# define CODEGEN_STUB_Export +# define CODEGEN_STUB_SINGLETON_DECLARATION(T) +# define CODEGEN_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CODEGEN_STUB_HAS_DLL == 1 */ + +// Set CODEGEN_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CODEGEN_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define CODEGEN_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CODEGEN_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CODEGEN_STUB_NTRACE */ + +#if (CODEGEN_STUB_NTRACE == 1) +# define CODEGEN_STUB_TRACE(X) +#else /* (CODEGEN_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CODEGEN_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CODEGEN_STUB_NTRACE == 1) */ + +#endif /* CODEGEN_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_svnt_export.h b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_svnt_export.h new file mode 100644 index 00000000000..4c1f720b01f --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/CodeGen_svnt_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s CODEGEN_SVNT +// ------------------------------ +#ifndef CODEGEN_SVNT_EXPORT_H +#define CODEGEN_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (CODEGEN_SVNT_HAS_DLL) +# define CODEGEN_SVNT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && CODEGEN_SVNT_HAS_DLL */ + +#if !defined (CODEGEN_SVNT_HAS_DLL) +# define CODEGEN_SVNT_HAS_DLL 1 +#endif /* ! CODEGEN_SVNT_HAS_DLL */ + +#if defined (CODEGEN_SVNT_HAS_DLL) && (CODEGEN_SVNT_HAS_DLL == 1) +# if defined (CODEGEN_SVNT_BUILD_DLL) +# define CODEGEN_SVNT_Export ACE_Proper_Export_Flag +# define CODEGEN_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CODEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CODEGEN_SVNT_BUILD_DLL */ +# define CODEGEN_SVNT_Export ACE_Proper_Import_Flag +# define CODEGEN_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CODEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CODEGEN_SVNT_BUILD_DLL */ +#else /* CODEGEN_SVNT_HAS_DLL == 1 */ +# define CODEGEN_SVNT_Export +# define CODEGEN_SVNT_SINGLETON_DECLARATION(T) +# define CODEGEN_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CODEGEN_SVNT_HAS_DLL == 1 */ + +// Set CODEGEN_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CODEGEN_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define CODEGEN_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CODEGEN_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CODEGEN_SVNT_NTRACE */ + +#if (CODEGEN_SVNT_NTRACE == 1) +# define CODEGEN_SVNT_TRACE(X) +#else /* (CODEGEN_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CODEGEN_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CODEGEN_SVNT_NTRACE == 1) */ + +#endif /* CODEGEN_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/tests/CIDL/CodeGen/README b/TAO/CIAO/tests/CIDL/CodeGen/README new file mode 100644 index 00000000000..da6e8f6ee90 --- /dev/null +++ b/TAO/CIAO/tests/CIDL/CodeGen/README @@ -0,0 +1,40 @@ + +Code Generation Test +======================== + +While the tests in CIAO_ROOT/tests/IDL3 target IDL3 support +and IDL3-specific code generation in particular, the tests +in CIAO_ROOT/CIDL target CIDL features and code generated +from .cidl files. The test in this directory particularly +stresses the code generation of the CIDL compiler. This +code includes the executor mapping IDL, the servant code, +and the executor implementation code. The latter is not +fully generated of course, it's merely classes (one for +each component executor, home executor, and facet executor) +with the spec-defined operations filled in, but with the +IDL-defined operations and attributes left blank. + +The IDL files in this test include most if not all of the +IDL3 features that might cause a problem in code generation - +catching operations and attributes for supported interfaces, +operations and attributes for supported interface base +classes, operations and attributes for inherited home +classes, factory and finder operations for homes and those +inherited from base homes - you get the idea. More stuff +will be added as we think of it or a problem crops up.The object +of this test is for all builds to complete successfully - +there's no execution involved, since every build is a +library, there's no executable to drive it. + +Please see the README file in CIAO_ROOT for info on how +to set up builds with MPC. The builds in this test depend +directly on CIAO_Container, CIAO_Servant and CIAO_Stub, +and indirectly on everything those three depend on. There's +a list in the above mentioned README file - to build those +libraries, you'll of course need ACE (ACE_ROOT/ace), TAO +(ACE_ROOT/TAO/tao) the IDL compiler (3 builds in +ACE_ROOT/TAO/TAO_IDL) and gperf (ACE_ROOT/apps/gperf/src). + +Enjoy! + +Jeff
\ No newline at end of file |