From a804510d81ade0594a75b5c9b8765cafcc233245 Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Mon, 16 Jul 2012 13:54:11 +0000 Subject: QPID-3858: Refactor to tidy up several class design issues git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1362039 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp | 114 ++++++++++++----------------- 1 file changed, 48 insertions(+), 66 deletions(-) (limited to 'cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp') diff --git a/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp b/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp index 9135fcc27e..6b5c3ac582 100644 --- a/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp +++ b/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp @@ -23,7 +23,11 @@ #include "AsyncStoreImpl.h" -#include "AsyncOperation.h" +#include "ConfigHandleImpl.h" +#include "EnqueueHandleImpl.h" +#include "EventHandleImpl.h" +#include "MessageHandleImpl.h" +#include "QueueHandleImpl.h" #include "TxnHandleImpl.h" #include "qpid/broker/ConfigHandle.h" @@ -33,8 +37,6 @@ #include "qpid/broker/QueueHandle.h" #include "qpid/broker/TxnHandle.h" -#include - namespace qpid { namespace asyncStore { @@ -88,6 +90,36 @@ AsyncStoreImpl::createTxnHandle(const std::string& xid, return qpid::broker::TxnHandle(new TxnHandleImpl(xid, tb)); } +void +AsyncStoreImpl::submitPrepare(qpid::broker::TxnHandle& txnHandle, + boost::shared_ptr brokerCtxt) +{ + boost::shared_ptr op(new AsyncOperation(AsyncOperation::TXN_PREPARE, + dynamic_cast(&txnHandle), + brokerCtxt)); + m_operations.submit(op); +} + +void +AsyncStoreImpl::submitCommit(qpid::broker::TxnHandle& txnHandle, + boost::shared_ptr brokerCtxt) +{ + boost::shared_ptr op(new AsyncOperation(AsyncOperation::TXN_COMMIT, + dynamic_cast(&txnHandle), + brokerCtxt)); + m_operations.submit(op); +} + +void +AsyncStoreImpl::submitAbort(qpid::broker::TxnHandle& txnHandle, + boost::shared_ptr brokerCtxt) +{ + boost::shared_ptr op(new AsyncOperation(AsyncOperation::TXN_ABORT, + dynamic_cast(&txnHandle), + brokerCtxt)); + m_operations.submit(op); +} + qpid::broker::ConfigHandle AsyncStoreImpl::createConfigHandle() { @@ -98,14 +130,16 @@ qpid::broker::EnqueueHandle AsyncStoreImpl::createEnqueueHandle(qpid::broker::MessageHandle& msgHandle, qpid::broker::QueueHandle& queueHandle) { - return qpid::broker::EnqueueHandle(new EnqueueHandleImpl(msgHandle, queueHandle)); + return qpid::broker::EnqueueHandle(new EnqueueHandleImpl(msgHandle, + queueHandle)); } qpid::broker::EventHandle AsyncStoreImpl::createEventHandle(qpid::broker::QueueHandle& queueHandle, const std::string& key) { - return qpid::broker::EventHandle(new EventHandleImpl(queueHandle, key)); + return qpid::broker::EventHandle(new EventHandleImpl(queueHandle, + key)); } qpid::broker::MessageHandle @@ -122,43 +156,13 @@ AsyncStoreImpl::createQueueHandle(const std::string& name, return qpid::broker::QueueHandle(new QueueHandleImpl(name, opts)); } -void -AsyncStoreImpl::submitPrepare(qpid::broker::TxnHandle& txnHandle, - boost::shared_ptr brokerCtxt) -{ - boost::shared_ptr op(new AsyncOperation(AsyncOperation::TXN_PREPARE, - dynamic_cast(&txnHandle), - brokerCtxt)); - m_operations.submit(op); -} - -void -AsyncStoreImpl::submitCommit(qpid::broker::TxnHandle& txnHandle, - boost::shared_ptr brokerCtxt) -{ - boost::shared_ptr op(new AsyncOperation(AsyncOperation::TXN_COMMIT, - dynamic_cast(&txnHandle), - brokerCtxt)); - m_operations.submit(op); -} - -void -AsyncStoreImpl::submitAbort(qpid::broker::TxnHandle& txnHandle, - boost::shared_ptr brokerCtxt) -{ - boost::shared_ptr op(new AsyncOperation(AsyncOperation::TXN_ABORT, - dynamic_cast(&txnHandle), - brokerCtxt)); - m_operations.submit(op); -} - void AsyncStoreImpl::submitCreate(qpid::broker::ConfigHandle& cfgHandle, const qpid::broker::DataSource* const dataSrc, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::CONFIG_CREATE, - dynamic_cast(&cfgHandle), + dynamic_cast(&cfgHandle), dataSrc, brokerCtxt)); m_operations.submit(op); @@ -169,7 +173,7 @@ AsyncStoreImpl::submitDestroy(qpid::broker::ConfigHandle& cfgHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::CONFIG_DESTROY, - dynamic_cast(&cfgHandle), + dynamic_cast(&cfgHandle), brokerCtxt)); m_operations.submit(op); } @@ -180,7 +184,7 @@ AsyncStoreImpl::submitCreate(qpid::broker::QueueHandle& queueHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::QUEUE_CREATE, - dynamic_cast(&queueHandle), + dynamic_cast(&queueHandle), dataSrc, brokerCtxt)); m_operations.submit(op); @@ -191,7 +195,7 @@ AsyncStoreImpl::submitDestroy(qpid::broker::QueueHandle& queueHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::QUEUE_DESTROY, - dynamic_cast(&queueHandle), + dynamic_cast(&queueHandle), brokerCtxt)); m_operations.submit(op); } @@ -201,19 +205,7 @@ AsyncStoreImpl::submitFlush(qpid::broker::QueueHandle& queueHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::QUEUE_FLUSH, - dynamic_cast(&queueHandle), - brokerCtxt)); - m_operations.submit(op); -} - -void -AsyncStoreImpl::submitCreate(qpid::broker::EventHandle& eventHandle, - const qpid::broker::DataSource* const dataSrc, - boost::shared_ptr brokerCtxt) -{ - boost::shared_ptr op(new AsyncOperation(AsyncOperation::EVENT_CREATE, - dynamic_cast(&eventHandle), - dataSrc, + dynamic_cast(&queueHandle), brokerCtxt)); m_operations.submit(op); } @@ -225,30 +217,20 @@ AsyncStoreImpl::submitCreate(qpid::broker::EventHandle& eventHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::EVENT_CREATE, - dynamic_cast(&eventHandle), + dynamic_cast(&eventHandle), dataSrc, &txnHandle, brokerCtxt)); m_operations.submit(op); } -void -AsyncStoreImpl::submitDestroy(qpid::broker::EventHandle& eventHandle, - boost::shared_ptr brokerCtxt) -{ - boost::shared_ptr op(new AsyncOperation(AsyncOperation::EVENT_DESTROY, - dynamic_cast(&eventHandle), - brokerCtxt)); - m_operations.submit(op); -} - void AsyncStoreImpl::submitDestroy(qpid::broker::EventHandle& eventHandle, qpid::broker::TxnHandle& txnHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::EVENT_DESTROY, - dynamic_cast(&eventHandle), + dynamic_cast(&eventHandle), &txnHandle, brokerCtxt)); m_operations.submit(op); @@ -260,7 +242,7 @@ AsyncStoreImpl::submitEnqueue(qpid::broker::EnqueueHandle& enqHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::MSG_ENQUEUE, - dynamic_cast(&enqHandle), + dynamic_cast(&enqHandle), &txnHandle, brokerCtxt)); m_operations.submit(op); @@ -272,7 +254,7 @@ AsyncStoreImpl::submitDequeue(qpid::broker::EnqueueHandle& enqHandle, boost::shared_ptr brokerCtxt) { boost::shared_ptr op(new AsyncOperation(AsyncOperation::MSG_DEQUEUE, - dynamic_cast(&enqHandle), + dynamic_cast(&enqHandle), &txnHandle, brokerCtxt)); m_operations.submit(op); -- cgit v1.2.1