diff options
| author | Gordon Sim <gsim@apache.org> | 2007-09-06 20:27:33 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-09-06 20:27:33 +0000 |
| commit | b33a63b36c659a894143382d0a61efe6a598fcc6 (patch) | |
| tree | 0efc848ae9cc6064d615c6968b1d127e92b231d3 /cpp/src/qpid/client/CompletionTracker.h | |
| parent | 748698e4b8d5bd0c3ccec4ca898d334c13fc0795 (diff) | |
| download | qpid-python-b33a63b36c659a894143382d0a61efe6a598fcc6.tar.gz | |
Implementation of execution.result on the client side
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@573359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/CompletionTracker.h')
| -rw-r--r-- | cpp/src/qpid/client/CompletionTracker.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/cpp/src/qpid/client/CompletionTracker.h b/cpp/src/qpid/client/CompletionTracker.h index 30999b4184..05cdc45c9f 100644 --- a/cpp/src/qpid/client/CompletionTracker.h +++ b/cpp/src/qpid/client/CompletionTracker.h @@ -19,7 +19,7 @@ * */ -#include <queue> +#include <list> #include <boost/function.hpp> #include "qpid/framing/amqp_framing.h" #include "qpid/framing/SequenceNumber.h" @@ -34,19 +34,40 @@ namespace client { class CompletionTracker { public: - typedef boost::function<void()> Listener; + //typedef boost::function<void()> CompletionListener; + typedef boost::function0<void> CompletionListener; + typedef boost::function<void(const std::string&)> ResultListener; CompletionTracker(); CompletionTracker(const framing::SequenceNumber& mark); void completed(const framing::SequenceNumber& mark); - void listen(const framing::SequenceNumber& point, Listener l); + void received(const framing::SequenceNumber& id, const std::string& result); + void listenForCompletion(const framing::SequenceNumber& point, CompletionListener l); + void listenForResult(const framing::SequenceNumber& point, ResultListener l); + void close(); private: + struct Record + { + framing::SequenceNumber id; + CompletionListener f; + ResultListener g; + + Record(const framing::SequenceNumber& _id, CompletionListener l) : id(_id), f(l) {} + Record(const framing::SequenceNumber& _id, ResultListener l) : id(_id), g(l) {} + void completed(); + void received(const std::string& result); + + }; + + typedef std::list<Record> Listeners; + sys::Mutex lock; framing::SequenceNumber mark; - std::queue< std::pair<framing::SequenceNumber, Listener> > listeners; + Listeners listeners; - bool add(const framing::SequenceNumber& point, Listener l); + bool add(const Record& r); + Listeners::iterator seek(const framing::SequenceNumber&); }; } |
