summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/TopicExchange.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-06-27 12:39:49 +0000
committerGordon Sim <gsim@apache.org>2007-06-27 12:39:49 +0000
commit5a88e6f19bddc0b9f6da4712b616f5f08b4dec25 (patch)
tree6d32b3a3ef5416bb40027852b98eda9389cbbb6c /cpp/src/qpid/broker/TopicExchange.cpp
parent4add83a2d2482a51f447ca71d2385ae19ea173fa (diff)
downloadqpid-python-5a88e6f19bddc0b9f6da4712b616f5f08b4dec25.tar.gz
Added preview of exchange- and binding- query methods that have been approved for 0-10.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@551144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/TopicExchange.cpp')
-rw-r--r--cpp/src/qpid/broker/TopicExchange.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/TopicExchange.cpp b/cpp/src/qpid/broker/TopicExchange.cpp
index 4ad1607aa2..80c207b56a 100644
--- a/cpp/src/qpid/broker/TopicExchange.cpp
+++ b/cpp/src/qpid/broker/TopicExchange.cpp
@@ -162,6 +162,31 @@ void TopicExchange::route(Deliverable& msg, const string& routingKey, const Fiel
}
}
+bool TopicExchange::isBound(Queue::shared_ptr queue, const string* const routingKey, const FieldTable* const)
+{
+ if (routingKey && queue) {
+ TopicPattern key(*routingKey);
+ return isBound(queue, key);
+ } else if (!routingKey && !queue) {
+ return bindings.size() > 0;
+ } else if (routingKey) {
+ for (BindingMap::iterator i = bindings.begin(); i != bindings.end(); ++i) {
+ if (i->first.match(*routingKey)) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ for (BindingMap::iterator i = bindings.begin(); i != bindings.end(); ++i) {
+ Queue::vector& qv(i->second);
+ if (find(qv.begin(), qv.end(), queue) != qv.end()) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
TopicExchange::~TopicExchange() {}
const std::string TopicExchange::typeName("topic");