summaryrefslogtreecommitdiff
path: root/cpp/rubygen/templates/structs.rb
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-10-16 19:07:54 +0000
committerAlan Conway <aconway@apache.org>2007-10-16 19:07:54 +0000
commit428de9b6fe6f81f2bfc3f47d5db013b4b00da6a2 (patch)
treee3fe772cbe0e08ea84f4b2f54b969dc7471bb8e1 /cpp/rubygen/templates/structs.rb
parent3bd61c1fa1a748789707b502ada85200f6180f5b (diff)
downloadqpid-python-428de9b6fe6f81f2bfc3f47d5db013b4b00da6a2.tar.gz
* Summary: generalized Invoker visitor to all *Operations and
*Handler classes, client and broker. Single template free function invoke(Invocable, const AMQBody&); works for all invocable handlers. * rubygen/templates/OperationsInvoker.rb: Generates invoker visitors for all Operations classes, client and server. * src/qpid/framing/Invoker.h: Invoker base class and template invoke() function. * rubygen/templates/structs.rb: add generic invoke method template to invoke an arbitrary object with the correct memeber function. * src/qpid/framing/AMQMethodBody.cpp, .h: Removed invoke(), replaced by qpid::framing::invoke() * src/qpid/broker/SemanticHandler.cpp, ConnectionHandler.cpp: Replace AMQMethodBody::invoke with invoke() free function. * src/qpid/framing/StructHelper.h: Avoid un-necessary alloc and copy in encode/decode. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@585223 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen/templates/structs.rb')
-rw-r--r--cpp/rubygen/templates/structs.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/cpp/rubygen/templates/structs.rb b/cpp/rubygen/templates/structs.rb
index 2f5a3d8365..6a58dfd763 100644
--- a/cpp/rubygen/templates/structs.rb
+++ b/cpp/rubygen/templates/structs.rb
@@ -191,14 +191,20 @@ class StructGen < CppGen
def methodbody_extra_defs(s)
gen <<EOS
+ typedef #{s.result ? s.result.struct.cpptype.name : 'void'} ResultType;
+
+ template <class T> ResultType invoke(T& invocable) const {
+ return invocable.#{s.cppname}(#{s.param_names.join ", "});
+ }
+
using AMQMethodBody::accept;
void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
- inline ClassId amqpClassId() const { return CLASS_ID; }
- inline MethodId amqpMethodId() const { return METHOD_ID; }
- inline bool isContentBearing() const { return #{s.content ? "true" : "false" }; }
- inline bool resultExpected() const { return #{s.result ? "true" : "false"}; }
- inline bool responseExpected() const { return #{s.responses().empty? ? "false" : "true"}; }
+ ClassId amqpClassId() const { return CLASS_ID; }
+ MethodId amqpMethodId() const { return METHOD_ID; }
+ bool isContentBearing() const { return #{s.content ? "true" : "false" }; }
+ bool resultExpected() const { return #{s.result ? "true" : "false"}; }
+ bool responseExpected() const { return #{s.responses().empty? ? "false" : "true"}; }
EOS
end