qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r562255 - in /incubator/qpid/trunk/qpid/cpp/rubygen: cppgen.rb generate samples/Operations.rb samples/Proxy.rb templates/ClassBodyVariant.rb
Date Thu, 02 Aug 2007 21:00:55 GMT
Author: aconway
Date: Thu Aug  2 14:00:54 2007
New Revision: 562255

URL: http://svn.apache.org/viewvc?view=rev&rev=562255
Log:
Generate boost::variants for each class. Not yet used on trunk.

Added:
    incubator/qpid/trunk/qpid/cpp/rubygen/templates/ClassBodyVariant.rb   (with props)
Modified:
    incubator/qpid/trunk/qpid/cpp/rubygen/cppgen.rb
    incubator/qpid/trunk/qpid/cpp/rubygen/generate
    incubator/qpid/trunk/qpid/cpp/rubygen/samples/Operations.rb
    incubator/qpid/trunk/qpid/cpp/rubygen/samples/Proxy.rb

Modified: incubator/qpid/trunk/qpid/cpp/rubygen/cppgen.rb
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/cppgen.rb?view=diff&rev=562255&r1=562254&r2=562255
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/cppgen.rb (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/cppgen.rb Thu Aug  2 14:00:54 2007
@@ -68,6 +68,12 @@
   def body_name() @cache_body_name ||= amqp_parent.name.caps+name.caps+"Body"; end
 end
 
+# Additional methods for AmqpClass
+class AmqpClass
+  def cppname() @cache_cppname ||= name.caps; end
+  def body_name() @cache_body_name ||= name.caps+"Body";  end
+end
+
 # Additional methos for AmqpRoot
 class AmqpRoot
   # FIXME aconway 2007-06-20: fix u_int types, should be uint
@@ -91,11 +97,6 @@
   def member_type(amqptype) lookup(amqptype)[0]; end
   def param_type(amqptype) t=lookup(amqptype); t[1] or t[0]; end
   def return_type(amqptype) t=lookup(amqptype); t[2] or t[0]; end
-end
-
-# Additional methods for AmqpClass
-class AmqpClass
-  def cppname() @cache_cppname ||= name.caps; end
 end
 
 class CppGen < Generator

Modified: incubator/qpid/trunk/qpid/cpp/rubygen/generate
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/generate?view=diff&rev=562255&r1=562254&r2=562255
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/generate (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/generate Thu Aug  2 14:00:54 2007
@@ -16,7 +16,7 @@
 EOS
   exit 1
 end
-outdir=ARGV[0]
+Outdir=ARGV[0]
 specs=ARGV.grep(/\.xml$/)
 templates=ARGV.grep(/\.rb$/)
 Amqp=AmqpRoot.new(*specs)

Modified: incubator/qpid/trunk/qpid/cpp/rubygen/samples/Operations.rb
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/samples/Operations.rb?view=diff&rev=562255&r1=562254&r2=562255
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/samples/Operations.rb (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/samples/Operations.rb Thu Aug  2 14:00:54 2007
@@ -80,6 +80,6 @@
   end
 end
 
-OperationsGen.new("client",ARGV[0], Amqp).generate()
-OperationsGen.new("server",ARGV[0], Amqp).generate()
+OperationsGen.new("client",ARGV[0], amqp).generate()
+OperationsGen.new("server",ARGV[0], amqp).generate()
 

Modified: incubator/qpid/trunk/qpid/cpp/rubygen/samples/Proxy.rb
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/samples/Proxy.rb?view=diff&rev=562255&r1=562254&r2=562255
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/samples/Proxy.rb (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/samples/Proxy.rb Thu Aug  2 14:00:54 2007
@@ -148,6 +148,6 @@
 end
 
 
-ProxyGen.new("client", ARGV[0], Amqp).generate;
-ProxyGen.new("server", ARGV[0], Amqp).generate;
+ProxyGen.new("client", ARGV[0], amqp).generate;
+ProxyGen.new("server", ARGV[0], amqp).generate;
     

Added: incubator/qpid/trunk/qpid/cpp/rubygen/templates/ClassBodyVariant.rb
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/templates/ClassBodyVariant.rb?view=auto&rev=562255
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/templates/ClassBodyVariant.rb (added)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/templates/ClassBodyVariant.rb Thu Aug  2 14:00:54
2007
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+$: << ".."                      # Include .. in load path
+require 'cppgen'
+
+class ClassBodyVariant < CppGen
+  
+  def initialize(outdir, amqp)
+    super(outdir, amqp)
+  end
+
+  def class_body(c)
+    h_file (c.body_name) { 
+      c.methods.each { |m| genl "#include \"#{m.body_name}.h\""; }
+      genl
+      genl "#include <boost/visitor.hpp>"
+      genl
+      gen "typedef boost::variant<"
+      indent { genl c.methods().collect { |m| m.body_name }.join(",\n") }
+      genl ">  #{c.body_name};"
+    }
+  end
+
+  def generate()
+    @amqp.classes.each{ |c| class_body c }
+  end
+end
+
+ClassBodyVariant.new(Outdir, Amqp).generate();
+

Propchange: incubator/qpid/trunk/qpid/cpp/rubygen/templates/ClassBodyVariant.rb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/cpp/rubygen/templates/ClassBodyVariant.rb
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message