summaryrefslogtreecommitdiff
path: root/cpp/rubygen
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-09-28 16:21:34 +0000
committerAlan Conway <aconway@apache.org>2007-09-28 16:21:34 +0000
commit8b82aef0397d65de0c7278476e4f409fcc636306 (patch)
treea25d9bbb01203335bc1450a5e5ed0c29074913ae /cpp/rubygen
parentf689c47486b4cfc7655e37da2b232fe27be1cc42 (diff)
downloadqpid-python-8b82aef0397d65de0c7278476e4f409fcc636306.tar.gz
* 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/qpid@580403 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen')
-rw-r--r--cpp/rubygen/templates/Session.rb45
1 files changed, 20 insertions, 25 deletions
diff --git a/cpp/rubygen/templates/Session.rb b/cpp/rubygen/templates/Session.rb
index d2b4a3233d..c02bce5699 100644
--- a/cpp/rubygen/templates/Session.rb
+++ b/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 <sstream>
#include <boost/parameter.hpp>
#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 <<EOS
class #{@classname} {
- ScopedAssociation::shared_ptr assoc;
+ shared_ptr<SessionCore> impl;
framing::ProtocolVersion version;
-
- SessionCore::shared_ptr impl();
-
-public:
#{@classname}();
- #{@classname}(ScopedAssociation::shared_ptr);
+ #{@classname}(shared_ptr<SessionCore>);
- 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<SessionCore> 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