summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/framing/ChannelAdapter.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-04-05 19:16:09 +0000
committerAlan Conway <aconway@apache.org>2007-04-05 19:16:09 +0000
commit6b5c686b366846b7ecb0bb298c41fe474e1fb3c8 (patch)
tree33e57b5f764c5d9549b150a43df62da193f735eb /qpid/cpp/src/framing/ChannelAdapter.h
parent0370e5550e1d9bc72d742bbbee1f6f0e2835406e (diff)
downloadqpid-python-6b5c686b366846b7ecb0bb298c41fe474e1fb3c8.tar.gz
* Exteneded use of shared pointers frame bodies across all send() commands.
* tests/Makefile.am: added check-unit target to run just unit tests. * Introduced make_shared_ptr convenience function for wrapping plain pointers with shared_ptr. * cpp/src/client/ClientChannel.h,cpp (sendsendAndReceive,sendAndReceiveSync): Pass shared_ptr instead of raw ptr to fix memory problems. Updated the following files to use make_shared_ptr - src/client/BasicMessageChannel.cpp - src/client/ClientConnection.cpp * src/client/MessageMessageChannel.cpp: implemented 0-9 message.get. * src/framing/Correlator.h,cpp: Allow request sender to register actions to take when the correlated response arrives. * cpp/src/tests/FramingTest.cpp: Added Correlator tests. * src/framing/ChannelAdapter.h,cpp: use Correlator to dispatch response actions. * cpp/src/shared_ptr.h (make_shared_ptr): Convenience function to make a shared pointer from a raw pointer. * cpp/src/tests/ClientChannelTest.cpp: Added message.get test. * cpp/src/tests/Makefile.am (check-unit): Added test-unit target to run unit tests. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@525932 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/framing/ChannelAdapter.h')
-rw-r--r--qpid/cpp/src/framing/ChannelAdapter.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/qpid/cpp/src/framing/ChannelAdapter.h b/qpid/cpp/src/framing/ChannelAdapter.h
index 493191d92b..1b325495ff 100644
--- a/qpid/cpp/src/framing/ChannelAdapter.h
+++ b/qpid/cpp/src/framing/ChannelAdapter.h
@@ -22,11 +22,11 @@
*
*/
-#include <boost/shared_ptr.hpp>
-
+#include "../shared_ptr.h"
#include "BodyHandler.h"
#include "Requester.h"
#include "Responder.h"
+#include "Correlator.h"
#include "amqp_types.h"
namespace qpid {
@@ -64,17 +64,24 @@ class ChannelAdapter : public BodyHandler {
ChannelId getId() const { return id; }
ProtocolVersion getVersion() const { return version; }
-
+
/**
- * Wrap body in a frame and send the frame.
- * Takes ownership of body.
+ * Send a frame.
+ *@param body Body of the frame.
+ *@param action optional action to execute when we receive a
+ *response to this frame. Ignored if body is not a Request.
+ *@return If body is a request, the ID assigned else 0.
*/
- RequestId send(AMQBody::shared_ptr body);
+ RequestId send(shared_ptr<AMQBody> body,
+ Correlator::Action action=Correlator::Action());
+
+ // TODO aconway 2007-04-05: remove and use make_shared_ptr at call sites.
+ /**@deprecated Use make_shared_ptr with the other send() override */
RequestId send(AMQBody* body) { return send(AMQBody::shared_ptr(body)); }
- void handleMethod(boost::shared_ptr<qpid::framing::AMQMethodBody>);
- void handleRequest(boost::shared_ptr<qpid::framing::AMQRequestBody>);
- void handleResponse(boost::shared_ptr<qpid::framing::AMQResponseBody>);
+ void handleMethod(shared_ptr<AMQMethodBody>);
+ void handleRequest(shared_ptr<AMQRequestBody>);
+ void handleResponse(shared_ptr<AMQResponseBody>);
virtual bool isOpen() const = 0;
@@ -84,7 +91,7 @@ class ChannelAdapter : public BodyHandler {
void assertChannelNotOpen() const;
virtual void handleMethodInContext(
- boost::shared_ptr<qpid::framing::AMQMethodBody> method,
+ shared_ptr<AMQMethodBody> method,
const MethodContext& context) = 0;
RequestId getFirstAckRequest() { return requester.getFirstAckRequest(); }
@@ -97,6 +104,7 @@ class ChannelAdapter : public BodyHandler {
ProtocolVersion version;
Requester requester;
Responder responder;
+ Correlator correlator;
};
}}