Author: gsim
Date: Tue Aug 21 13:11:20 2007
New Revision: 568249
URL: http://svn.apache.org/viewvc?rev=568249&view=rev
Log:
Invocation now uses the visitor mechanism
Modified:
incubator/qpid/trunk/qpid/cpp/rubygen/templates/structs.rb
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h
Modified: incubator/qpid/trunk/qpid/cpp/rubygen/templates/structs.rb
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/templates/structs.rb?rev=568249&r1=568248&r2=568249&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/templates/structs.rb (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/templates/structs.rb Tue Aug 21
13:11:20 2007
@@ -129,45 +129,6 @@
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)
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp?rev=568249&r1=568248&r2=568249&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.cpp Tue Aug 21
13:11:20 2007
@@ -19,10 +19,25 @@
*
*/
#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
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h?rev=568249&r1=568248&r2=568249&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQMethodBody.h Tue Aug 21
13:11:20 2007
@@ -50,8 +50,8 @@
virtual MethodId amqpMethodId() const = 0;
virtual ClassId amqpClassId() const = 0;
- virtual void invoke(AMQP_ServerOperations&) { assert(0); }
- virtual bool invoke(Invocable*) { return false; }
+ void invoke(AMQP_ServerOperations&);
+ bool invoke(Invocable*);
template <class T> bool isA() const {
return amqpClassId()==T::CLASS_ID && amqpMethodId()==T::METHOD_ID;