diff options
author | Alan Conway <aconway@apache.org> | 2007-08-14 16:15:26 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-08-14 16:15:26 +0000 |
commit | cb65298edd497295d215220397f8fedff7b14aca (patch) | |
tree | 9f3a167ef11b0f3bd918507767fbf455d362d79d /cpp/rubygen/templates | |
parent | b3ddadd9b15088afecf1f9774d2004258b164258 (diff) | |
download | qpid-python-cb65298edd497295d215220397f8fedff7b14aca.tar.gz |
Removed unused types: RequestId, ResponseId, MethodContext.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@565821 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/templates')
-rwxr-xr-x | cpp/rubygen/templates/Proxy.rb | 142 |
1 files changed, 43 insertions, 99 deletions
diff --git a/cpp/rubygen/templates/Proxy.rb b/cpp/rubygen/templates/Proxy.rb index 40eaa2baa3..f36d6bcd99 100755 --- a/cpp/rubygen/templates/Proxy.rb +++ b/cpp/rubygen/templates/Proxy.rb @@ -15,96 +15,51 @@ class ProxyGen < CppGen def inner_class_decl(c) cname=c.name.caps - gen <<EOS - // ==================== class #{cname} ==================== - class #{cname} - { - private: - ChannelAdapter& channel; - RequestId responseTo; + cpp_class(cname) { + gen <<EOS +ChannelAdapter& channel; - public: - // Constructors and destructors +public: +#{cname}(ChannelAdapter& ch) : channel(ch) {} +virtual ~#{cname}() {} - #{cname}(ChannelAdapter& ch) : - channel(ch) {} - virtual ~#{cname}() {} +static #{cname}& get(#{@classname}& proxy) { return proxy.get#{cname}(); } - static #{cname}& get(#{@classname}& proxy) { return proxy.get#{cname}();} - // set for response correlation - void setResponseTo(RequestId r) { responseTo = r; } - - // Protocol methods EOS - indent(2) { c.amqp_methods_on(@chassis).each { |m| inner_method_decl(m) } } - gen "\n }; // class #{cname}\n\n" - end - - def inner_method_decl(m) - genl "virtual RequestId #{m.cppname}(#{m.signature.join(",\n ")});" - genl + c.amqp_methods_on(@chassis).each { |m| + genl "virtual void #{m.cppname}(#{m.signature.join(",\n ")});" + genl + }} end def inner_class_defn(c) cname=c.cppname - gen "// ==================== class #{cname} ====================\n" - c.amqp_methods_on(@chassis).each { |m| inner_method_defn(m, cname) } - end - - def inner_method_defn(m,cname) - genl "RequestId #{@classname}::#{cname}::#{m.cppname}(#{m.signature.join(", ")})" - scope { - params=(["channel.getVersion()"]+m.param_names).join(", ") - genl "return channel.send(make_shared_ptr(new #{m.body_name}(#{params})));" - } - end - - def get_decl(c) - cname=c.name.caps - gen " #{cname}& get#{cname}();\n" - end - - def get_defn(c) - cname=c.name.caps - gen <<EOS -#{@classname}::#{c.name.caps}& #{@classname}::get#{c.name.caps}() -{ - return #{proxy_member(c)}; -} -EOS + c.amqp_methods_on(@chassis).each { |m| + genl "void #{@classname}::#{cname}::#{m.cppname}(#{m.signature.join(", ")})" + scope { + params=(["channel.getVersion()"]+m.param_names).join(", ") + genl "channel.send(make_shared_ptr(new #{m.body_name}(#{params})));" + }} end def generate # .h file h_file(@filename) { - gen <<EOS -#include "qpid/framing/Proxy.h" - -namespace qpid { -namespace framing { - -class #{@classname} : public Proxy -{ -public: - #{@classname}(ChannelAdapter& ch); - - // Inner class definitions -EOS - @amqp.amqp_classes.each{ |c| inner_class_decl(c) } - gen " // Inner class instance get methods\n" - @amqp.amqp_classes.each{ |c| get_decl(c) } - gen <<EOS - private: - // Inner class instances -EOS - indent { @amqp.amqp_classes.each{ |c| gen c.cppname+" "+proxy_member(c)+";\n" } } - gen <<EOS -}; /* class #{@classname} */ - -} /* namespace framing */ -} /* namespace qpid */ -EOS - } + include "qpid/framing/Proxy.h" + namespace("qpid::framing") { + cpp_class(@classname, "public Proxy") { + public + genl "#{@classname}(ChannelAdapter& ch);" + genl + @amqp.amqp_classes.each { |c| + inner_class_decl(c) + genl + genl "#{c.cppname}& get#{c.cppname}() { return #{proxy_member(c)}; }" + genl + } + private + @amqp.amqp_classes.each{ |c| gen c.cppname+" "+proxy_member(c)+";\n" } + }}} # .cpp file cpp_file(@filename) { @@ -112,30 +67,19 @@ EOS include "#{@classname}.h" include "qpid/framing/ChannelAdapter.h" include "qpid/framing/amqp_types_full.h" - @amqp.amqp_methods_on(@chassis).each { - |m| include "qpid/framing/#{m.body_name}.h" } - gen <<EOS -namespace qpid { -namespace framing { - -#{@classname}::#{@classname}(ChannelAdapter& ch) : -EOS - gen " Proxy(ch)" - @amqp.amqp_classes.each { |c| gen ",\n "+proxy_member(c)+"(channel)" } - gen <<EOS - {} - - // Inner class instance get methods -EOS - @amqp.amqp_classes.each { |c| get_defn(c) } - gen " // Inner class implementation\n\n" - @amqp.amqp_classes.each { |c| inner_class_defn(c) } - genl "}} // namespae qpid::framing" - } + Amqp.amqp_methods_on(@chassis).each { |m| include "qpid/framing/"+m.body_name } + genl + namespace("qpid::framing") { + genl "#{@classname}::#{@classname}(ChannelAdapter& ch) :" + gen " Proxy(ch)" + @amqp.amqp_classes.each { |c| gen ",\n "+proxy_member(c)+"(channel)" } + genl "{}\n" + @amqp.amqp_classes.each { |c| inner_class_defn(c) } + }} end end -ProxyGen.new("client", ARGV[0], Amqp).generate; -ProxyGen.new("server", ARGV[0], Amqp).generate; +ProxyGen.new("client", Outdir, Amqp).generate; +ProxyGen.new("server", Outdir, Amqp).generate; |