diff options
Diffstat (limited to 'cpp/src/qpid/client')
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/SenderImpl.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/SenderImpl.h | 1 | ||||
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/SessionImpl.cpp | 23 | ||||
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/SessionImpl.h | 5 |
4 files changed, 33 insertions, 1 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/SenderImpl.cpp b/cpp/src/qpid/client/amqp0_10/SenderImpl.cpp index 9d168725e6..ef16b26b91 100644 --- a/cpp/src/qpid/client/amqp0_10/SenderImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/SenderImpl.cpp @@ -129,4 +129,9 @@ void SenderImpl::cancelImpl() parent.senderCancelled(name); } +const std::string& SenderImpl::getName() const +{ + return name; +} + }}} // namespace qpid::client::amqp0_10 diff --git a/cpp/src/qpid/client/amqp0_10/SenderImpl.h b/cpp/src/qpid/client/amqp0_10/SenderImpl.h index 60b196b21b..8140b3479a 100644 --- a/cpp/src/qpid/client/amqp0_10/SenderImpl.h +++ b/cpp/src/qpid/client/amqp0_10/SenderImpl.h @@ -54,6 +54,7 @@ class SenderImpl : public qpid::messaging::SenderImpl uint32_t getCapacity(); uint32_t pending(); void init(qpid::client::AsyncSession, AddressResolution&); + const std::string& getName() const; private: SessionImpl& parent; diff --git a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp index 4d40bd6c50..3a8992d503 100644 --- a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp @@ -39,6 +39,7 @@ #include <boost/intrusive_ptr.hpp> using qpid::messaging::Filter; +using qpid::messaging::KeyError; using qpid::messaging::MessageImplAccess; using qpid::messaging::Sender; using qpid::messaging::Receiver; @@ -176,6 +177,28 @@ Sender SessionImpl::createSenderImpl(const qpid::messaging::Address& address) return sender; } +Sender SessionImpl::getSender(const std::string& name) const +{ + qpid::sys::Mutex::ScopedLock l(lock); + Senders::const_iterator i = senders.find(name); + if (i == senders.end()) { + throw KeyError(name); + } else { + return i->second; + } +} + +Receiver SessionImpl::getReceiver(const std::string& name) const +{ + qpid::sys::Mutex::ScopedLock l(lock); + Receivers::const_iterator i = receivers.find(name); + if (i == receivers.end()) { + throw KeyError(name); + } else { + return i->second; + } +} + SessionImpl& SessionImpl::convert(qpid::messaging::Session& s) { boost::intrusive_ptr<SessionImpl> impl = getImplPtr<qpid::messaging::Session, SessionImpl>(s); diff --git a/cpp/src/qpid/client/amqp0_10/SessionImpl.h b/cpp/src/qpid/client/amqp0_10/SessionImpl.h index f3018b9685..872f66801d 100644 --- a/cpp/src/qpid/client/amqp0_10/SessionImpl.h +++ b/cpp/src/qpid/client/amqp0_10/SessionImpl.h @@ -65,6 +65,9 @@ class SessionImpl : public qpid::messaging::SessionImpl qpid::messaging::Sender createSender(const qpid::messaging::Address& address); qpid::messaging::Receiver createReceiver(const qpid::messaging::Address& address); + qpid::messaging::Sender getSender(const std::string& name) const; + qpid::messaging::Receiver getReceiver(const std::string& name) const; + bool nextReceiver(qpid::messaging::Receiver& receiver, qpid::sys::Duration timeout); qpid::messaging::Receiver nextReceiver(qpid::sys::Duration timeout); @@ -99,7 +102,7 @@ class SessionImpl : public qpid::messaging::SessionImpl typedef std::map<std::string, qpid::messaging::Receiver> Receivers; typedef std::map<std::string, qpid::messaging::Sender> Senders; - qpid::sys::Mutex lock; + mutable qpid::sys::Mutex lock; ConnectionImpl& connection; qpid::client::Session session; AddressResolution resolver; |