Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qpid/client/Future.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * Licensed to the Apache Software Foundation (ASF) under one
00004  * or more contributor license agreements.  See the NOTICE file
00005  * distributed with this work for additional information
00006  * regarding copyright ownership.  The ASF licenses this file
00007  * to you under the Apache License, Version 2.0 (the
00008  * "License"); you may not use this file except in compliance
00009  * with the License.  You may obtain a copy of the License at
00010  *
00011  *   http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing,
00014  * software distributed under the License is distributed on an
00015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00016  * KIND, either express or implied.  See the License for the
00017  * specific language governing permissions and limitations
00018  * under the License.
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 QPID_CLIENT_CLASS_EXTERN 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

Qpid C++ API Reference
Generated on Mon Aug 22 2011 for Qpid C++ Client API by doxygen 1.7.4