summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/LocalQueue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/client/LocalQueue.cpp')
-rw-r--r--cpp/src/qpid/client/LocalQueue.cpp51
1 files changed, 11 insertions, 40 deletions
diff --git a/cpp/src/qpid/client/LocalQueue.cpp b/cpp/src/qpid/client/LocalQueue.cpp
index dfd8405a7f..eac4b458af 100644
--- a/cpp/src/qpid/client/LocalQueue.cpp
+++ b/cpp/src/qpid/client/LocalQueue.cpp
@@ -19,6 +19,7 @@
*
*/
#include "LocalQueue.h"
+#include "LocalQueueImpl.h"
#include "MessageImpl.h"
#include "qpid/Exception.h"
#include "qpid/framing/FrameSet.h"
@@ -26,56 +27,26 @@
#include "qpid/framing/reply_exceptions.h"
#include "PrivateImplRef.h"
#include "SubscriptionImpl.h"
-#include "CompletionImpl.h"
namespace qpid {
namespace client {
using namespace framing;
-LocalQueue::LocalQueue() {}
-LocalQueue::~LocalQueue() {}
+typedef PrivateImplRef<LocalQueue> PI;
-Message LocalQueue::pop(sys::Duration timeout) { return get(timeout); }
+LocalQueue::LocalQueue() { PI::ctor(*this, new LocalQueueImpl()); }
+LocalQueue::LocalQueue(const LocalQueue& x) : Handle<LocalQueueImpl>() { PI::copy(*this, x); }
+LocalQueue::~LocalQueue() { PI::dtor(*this); }
+LocalQueue& LocalQueue::operator=(const LocalQueue& x) { return PI::assign(*this, x); }
-Message LocalQueue::get(sys::Duration timeout) {
- Message result;
- bool ok = get(result, timeout);
- if (!ok) throw Exception("Timed out waiting for a message");
- return result;
-}
+Message LocalQueue::pop(sys::Duration timeout) { return impl->pop(timeout); }
-bool LocalQueue::get(Message& result, sys::Duration timeout) {
- if (!queue)
- throw ClosedException();
- FrameSet::shared_ptr content;
- bool ok = queue->pop(content, timeout);
- if (!ok) return false;
- if (content->isA<MessageTransferBody>()) {
+Message LocalQueue::get(sys::Duration timeout) { return impl->get(timeout); }
- *MessageImpl::get(result) = MessageImpl(*content);
- boost::intrusive_ptr<SubscriptionImpl> si = PrivateImplRef<Subscription>::get(subscription);
- assert(si);
- if (si) si->received(result);
- return true;
- }
- else
- throw CommandInvalidException(
- QPID_MSG("Unexpected method: " << content->getMethod()));
-}
+bool LocalQueue::get(Message& result, sys::Duration timeout) { return impl->get(result, timeout); }
-bool LocalQueue::empty() const
-{
- if (!queue)
- throw ClosedException();
- return queue->empty();
-}
-
-size_t LocalQueue::size() const
-{
- if (!queue)
- throw ClosedException();
- return queue->size();
-}
+bool LocalQueue::empty() const { return impl->empty(); }
+size_t LocalQueue::size() const { return impl->size(); }
}} // namespace qpid::client