summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-08-21 21:52:31 +0000
committerAlan Conway <aconway@apache.org>2007-08-21 21:52:31 +0000
commita9bd6d6e8686574d0170248ccd0280ec21dd67c3 (patch)
tree0d4bf61b6316933ca2e42ade1fad03cf75899783
parentf3737cf4414656f9804dde96271ef426523df050 (diff)
downloadqpid-python-a9bd6d6e8686574d0170248ccd0280ec21dd67c3.tar.gz
Undo revision 568249, causing tests to hang.
------------------------------------------------------------------------ r568249 | gsim | 2007-08-21 16:11:20 -0400 (Tue, 21 Aug 2007) | 3 lines Invocation now uses the visitor mechanism ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@568298 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--cpp/rubygen/templates/structs.rb39
-rw-r--r--cpp/src/qpid/framing/AMQMethodBody.cpp15
-rw-r--r--cpp/src/qpid/framing/AMQMethodBody.h4
3 files changed, 41 insertions, 17 deletions
diff --git a/cpp/rubygen/templates/structs.rb b/cpp/rubygen/templates/structs.rb
index 571a85b827..972a0386b9 100644
--- a/cpp/rubygen/templates/structs.rb
+++ b/cpp/rubygen/templates/structs.rb
@@ -129,6 +129,45 @@ class StructGen < CppGen
inline ClassId amqpClassId() const { return CLASS_ID; }
inline MethodId amqpMethodId() const { return METHOD_ID; }
EOS
+ if (s.is_server_method?)
+ gen <<EOS
+ void invoke(AMQP_ServerOperations& target)
+ {
+ target.get#{s.amqp_parent.cppname}Handler()->#{s.cppname}
+ (
+EOS
+ if (s.amqp_parent.name == "message" && (s.name == "transfer" || s.name == "append"))
+ indent(4) { genl "*this" }
+ else
+ indent(4) { genl s.param_names.join(",\n") }
+ end
+
+ genl <<EOS
+ );
+ }
+
+ bool invoke(Invocable* target)
+ {
+ AMQP_ServerOperations::#{s.amqp_parent.cppname}Handler* ptr
+ = dynamic_cast<AMQP_ServerOperations::#{s.amqp_parent.cppname}Handler*>(target);
+ if (ptr) {
+ ptr->#{s.cppname}(
+EOS
+ if (s.amqp_parent.name == "message" && (s.name == "transfer" || s.name == "append"))
+ indent(5) { genl "*this" }
+ else
+ indent(5) { genl s.param_names.join(",\n") }
+ end
+
+ gen <<EOS
+ );
+ return true;
+ } else {
+ return false;
+ }
+ }
+EOS
+ end
end
def define_constructor(name, s)
diff --git a/cpp/src/qpid/framing/AMQMethodBody.cpp b/cpp/src/qpid/framing/AMQMethodBody.cpp
index 48b50763fc..924d906d43 100644
--- a/cpp/src/qpid/framing/AMQMethodBody.cpp
+++ b/cpp/src/qpid/framing/AMQMethodBody.cpp
@@ -19,25 +19,10 @@
*
*/
#include "AMQMethodBody.h"
-#include "qpid/framing/InvocationVisitor.h"
namespace qpid {
namespace framing {
AMQMethodBody::~AMQMethodBody() {}
-void AMQMethodBody::invoke(AMQP_ServerOperations& ops)
-{
- InvocationVisitor v(&ops);
- accept(v);
- assert(v.wasHandled());
-}
-
-bool AMQMethodBody::invoke(Invocable* invocable)
-{
- InvocationVisitor v(invocable);
- accept(v);
- return v.wasHandled();
-}
-
}} // namespace qpid::framing
diff --git a/cpp/src/qpid/framing/AMQMethodBody.h b/cpp/src/qpid/framing/AMQMethodBody.h
index 5acb3a7b66..9c776e143b 100644
--- a/cpp/src/qpid/framing/AMQMethodBody.h
+++ b/cpp/src/qpid/framing/AMQMethodBody.h
@@ -50,8 +50,8 @@ class AMQMethodBody : public AMQBody {
virtual MethodId amqpMethodId() const = 0;
virtual ClassId amqpClassId() const = 0;
- void invoke(AMQP_ServerOperations&);
- bool invoke(Invocable*);
+ virtual void invoke(AMQP_ServerOperations&) { assert(0); }
+ virtual bool invoke(Invocable*) { return false; }
template <class T> bool isA() const {
return amqpClassId()==T::CLASS_ID && amqpMethodId()==T::METHOD_ID;