00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _DirectExchange_
00022 #define _DirectExchange_
00023
00024 #include <map>
00025 #include <vector>
00026 #include "Exchange.h"
00027 #include "qpid/framing/FieldTable.h"
00028 #include "qpid/sys/CopyOnWriteArray.h"
00029 #include "qpid/sys/Mutex.h"
00030 #include "Queue.h"
00031
00032 namespace qpid {
00033 namespace broker {
00034 class DirectExchange : public virtual Exchange{
00035 typedef qpid::sys::CopyOnWriteArray<Binding::shared_ptr> Queues;
00036 typedef std::map<string, Queues> Bindings;
00037 Bindings bindings;
00038 qpid::sys::Mutex lock;
00039
00040 public:
00041 static const std::string typeName;
00042
00043 DirectExchange(const std::string& name, management::Manageable* parent = 0);
00044 DirectExchange(const string& _name, bool _durable,
00045 const qpid::framing::FieldTable& _args, management::Manageable* parent = 0);
00046
00047 virtual std::string getType() const { return typeName; }
00048
00049 virtual bool bind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
00050
00051 virtual bool unbind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
00052
00053 virtual void route(Deliverable& msg, const std::string& routingKey, const qpid::framing::FieldTable* args);
00054
00055 virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args);
00056
00057 virtual ~DirectExchange();
00058 };
00059 }
00060 }
00061
00062
00063 #endif