Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _Future_
00023 #define _Future_
00024
00025 #include <boost/bind.hpp>
00026 #include <boost/shared_ptr.hpp>
00027 #include "qpid/Exception.h"
00028 #include "qpid/framing/SequenceNumber.h"
00029 #include "qpid/client/FutureCompletion.h"
00030 #include "qpid/client/FutureResult.h"
00031 #include "qpid/client/ClientImportExport.h"
00032
00033 namespace qpid {
00034 namespace client {
00035
00037 class Future
00038 {
00039 framing::SequenceNumber command;
00040 boost::shared_ptr<FutureResult> result;
00041 bool complete;
00042
00043 public:
00044 Future() : complete(false) {}
00045 Future(const framing::SequenceNumber& id) : command(id), complete(false) {}
00046
00047 std::string getResult(SessionImpl& session) {
00048 if (result) return result->getResult(session);
00049 else throw Exception("Result not expected");
00050 }
00051
00052 QPID_CLIENT_EXTERN void wait(SessionImpl& session);
00053 QPID_CLIENT_EXTERN bool isComplete(SessionImpl& session);
00054 QPID_CLIENT_EXTERN void setFutureResult(boost::shared_ptr<FutureResult> r);
00055 };
00056
00057 }}
00058
00059 #endif