From d20f8aab6bb42dfb668452ea0d916344034eb29c Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 28 Sep 2007 16:21:34 +0000 Subject: * src/tests/ClientSessionTest.cpp: Suspend/resume tests. * broker/SessionManager.cpp, broker/SessionHandler.cpp: Implement suspend/resume * client/ScopedAssociation.h, SessionCore.h, SessionHandler.h: Simplified relationships. - Removed ScopedAssociation. - SessionHandler: is now a member of SessionCore. - SessionCore: shared_ptr ownership by Session(s) and ConnectionImpl. - Using framing::FrameHandler interfaces. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@580403 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/rubygen/templates/Session.rb | 45 ++++++++++++++++------------------- 1 file changed, 20 insertions(+), 25 deletions(-) (limited to 'qpid/cpp/rubygen') diff --git a/qpid/cpp/rubygen/templates/Session.rb b/qpid/cpp/rubygen/templates/Session.rb index d2b4a3233d..c02bce5699 100644 --- a/qpid/cpp/rubygen/templates/Session.rb +++ b/qpid/cpp/rubygen/templates/Session.rb @@ -23,7 +23,7 @@ class SessionGen < CppGen end def declare_method (m) - param_unpackers = m.fields.collect { |f| "args[#{f.cppname}|#{f.cpptype.default_value}]" } + param_unpackers = m.fields.collect { |f| "args[::qpid::client::#{f.cppname}|#{f.cpptype.default_value}]" } if (m.content()) param_names = m.param_names + ["content"] param_unpackers << "args[content|DefaultContent(\"\")]" @@ -89,14 +89,14 @@ class SessionGen < CppGen gen "){\n\n" end indent (2) { - gen "return #{return_type(m)}(impl()->send(#{m.body_name}(" + gen "return #{return_type(m)}(impl->send(#{m.body_name}(" params = ["version"] + m.param_names gen params.join(", ") other_params=[] if (m.content()) - gen "), content), impl());\n" + gen "), content), impl);\n" else - gen ")), impl());\n" + gen ")), impl);\n" end } gen "}\n\n" @@ -127,6 +127,7 @@ class SessionGen < CppGen #include #include #include "qpid/framing/amqp_framing.h" +#include "qpid/framing/Uuid.h" #include "qpid/framing/amqp_structs.h" #include "qpid/framing/ProtocolVersion.h" #include "qpid/framing/MethodContent.h" @@ -134,8 +135,9 @@ class SessionGen < CppGen #include "qpid/client/Completion.h" #include "qpid/client/ConnectionImpl.h" #include "qpid/client/Response.h" -#include "qpid/client/ScopedAssociation.h" +#include "qpid/client/SessionCore.h" #include "qpid/client/TypedResult.h" +#include "qpid/shared_ptr.h" namespace qpid { namespace client { @@ -145,25 +147,26 @@ using framing::Content; using framing::FieldTable; using framing::MethodContent; using framing::SequenceNumberSet; +using framing::Uuid; EOS declare_keywords(@amqp.classes.select { |c| !excludes.include?(c.name) }) genl gen < impl; framing::ProtocolVersion version; - - SessionCore::shared_ptr impl(); - -public: #{@classname}(); - #{@classname}(ScopedAssociation::shared_ptr); + #{@classname}(shared_ptr); - framing::FrameSet::shared_ptr get() { return impl()->get(); } - void setSynchronous(bool sync) { impl()->setSync(sync); } + friend class Connection; +public: + framing::FrameSet::shared_ptr get() { return impl->get(); } + Uuid getId() const { return impl->getId(); } + void setSynchronous(bool sync) { impl->setSync(sync); } + void suspend(); void close(); - Execution& execution() { return impl()->getExecution(); } + Execution& execution() { return impl->getExecution(); } typedef framing::TransferContent DefaultContent; EOS @@ -188,18 +191,10 @@ namespace qpid { namespace client { #{@classname}::#{@classname}() {} -#{@classname}::#{@classname}(ScopedAssociation::shared_ptr _assoc) : assoc(_assoc) {} +#{@classname}::#{@classname}(shared_ptr core) : impl(core) {} -SessionCore::shared_ptr #{@classname}::impl() -{ - if (!assoc) throw Exception("Uninitialised session"); - return assoc->session; -} - -void #{@classname}::close() -{ - impl()->close(); -} +void #{@classname}::suspend() { impl->suspend(); } +void #{@classname}::close() { impl->close(); } EOS -- cgit v1.2.1