Author: astitcher
Date: Thu Feb  1 05:27:03 2007
New Revision: 502209

URL: http://svn.apache.org/viewvc?view=rev&rev=502209
Log:
Changed methodBody in Methodcontext to be a shared_ptr

Modified:
    incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Connection.cpp
    incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ChannelAdapter.cpp
    incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/MethodContext.h

Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Connection.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Connection.cpp?view=diff&rev=502209&r1=502208&r2=502209
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Connection.cpp (original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/broker/Connection.cpp Thu Feb  1 
05:27:03 2007
@@ -74,7 +74,7 @@
     string locales("en_US");
     // TODO aconway 2007-01-16: Client call, move to adapter.
     client->getConnection().start(
-        MethodContext(0, 0, &getAdapter(0)),
+        MethodContext(0, &getAdapter(0)),
         header->getMajor(), header->getMinor(),
         properties, mechanisms, locales);
     getAdapter(0).init(0, *out, client->getProtocolVersion());

Modified: 
incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ChannelAdapter.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ChannelAdapter.cpp?view=diff&rev=502209&r1=502208&r2=502209
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ChannelAdapter.cpp 
(original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ChannelAdapter.cpp 
Thu Feb  1 05:27:03 2007
@@ -32,7 +32,7 @@
     id = i;
     out = &o;
     version = v;
-    context = MethodContext(0, id, this);
+    context = MethodContext(id, this);
 }
 
 void ChannelAdapter::send(AMQFrame* frame) {
@@ -62,7 +62,7 @@
 void ChannelAdapter::handleRequest(AMQRequestBody::shared_ptr request) {
     assertMethodOk(*request);
     responder.received(request->getData());
-    context =MethodContext(request.get(), id, this, request->getRequestId());
+    context =MethodContext(id, request, this, request->getRequestId());
     handleMethodInContext(request, context);
 }
 
@@ -76,7 +76,7 @@
 
 void ChannelAdapter::handleMethod(AMQMethodBody::shared_ptr method) {
     assertMethodOk(*method);
-    context = MethodContext(method.get(), id, this);
+    context = MethodContext(id, method, this);
     handleMethodInContext(method, context);
 }
 

Modified: 
incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/MethodContext.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/MethodContext.h?view=diff&rev=502209&r1=502208&r2=502209
==============================================================================
--- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/MethodContext.h 
(original)
+++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/MethodContext.h Thu 
Feb  1 05:27:03 2007
@@ -22,6 +22,8 @@
 #include "OutputHandler.h"
 #include "ProtocolVersion.h"
 
+#include <boost/shared_ptr.hpp>
+
 namespace qpid {
 namespace framing {
 
@@ -46,11 +48,17 @@
      * Passing a integer channel-id in place of a MethodContext
      * will automatically construct the MethodContext.
      */
-    MethodContext(
-        const AMQMethodBody* method,
-        ChannelId channel, OutputHandler* output=0, RequestId request=0)
+    MethodContext(ChannelId channel,
+       OutputHandler* output=0, RequestId request=0)
+        : channelId(channel), out(output), requestId(request)
+    {}
+    
+    MethodContext(ChannelId channel,
+        boost::shared_ptr<AMQMethodBody> method,
+        OutputHandler* output=0, RequestId request=0)
         : channelId(channel), out(output), requestId(request),
-          methodBody(method) {}
+          methodBody(method)
+    {}
 
     /** \internal Channel on which the method is sent. */
     ChannelId channelId;
@@ -66,7 +74,7 @@
     /** \internal This is the Method Body itself
      * It's useful for passing around instead of unpacking all its parameters
      */
-    const AMQMethodBody* methodBody;
+    boost::shared_ptr<AMQMethodBody> methodBody;
 };
 
 }} // namespace qpid::framing


Reply via email to