summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/Response.h
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-08-05 13:25:36 +0000
committerGordon Sim <gsim@apache.org>2007-08-05 13:25:36 +0000
commitb2efcb6ed3e1e2104836928cda81ed69f2f24559 (patch)
tree392ae403dcb0d32da3edaeaf8a1f497679d9102c /cpp/src/qpid/client/Response.h
parentb2fadec5d86e278d96112e915e67aec934e91046 (diff)
downloadqpid-python-b2efcb6ed3e1e2104836928cda81ed69f2f24559.tar.gz
Added first cut of generated client interface.
Old channel interface still supported; shares SessionCore with the new interface. Todo: allow applications to signal completion of received commands; keywrod args for interface. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@562866 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/Response.h')
-rw-r--r--cpp/src/qpid/client/Response.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/cpp/src/qpid/client/Response.h b/cpp/src/qpid/client/Response.h
new file mode 100644
index 0000000000..f44cd72783
--- /dev/null
+++ b/cpp/src/qpid/client/Response.h
@@ -0,0 +1,63 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#ifndef _Response_
+#define _Response_
+
+#include <boost/shared_ptr.hpp>
+#include "qpid/framing/amqp_framing.h"
+#include "FutureResponse.h"
+
+namespace qpid {
+namespace client {
+
+class Response
+{
+ boost::shared_ptr<FutureResponse> future;
+
+public:
+ Response(boost::shared_ptr<FutureResponse> f) : future(f) {}
+
+ template <class T> T& as()
+ {
+ framing::AMQMethodBody::shared_ptr response(future->getResponse());
+ return boost::shared_polymorphic_cast<T>(*response);
+ }
+ template <class T> bool isA()
+ {
+ return future->getResponse()->isA<T>();
+ }
+
+ void sync()
+ {
+ return future->waitForCompletion();
+ }
+
+ //TODO: only exposed for old channel class, may want to hide this eventually
+ framing::AMQMethodBody::shared_ptr getPtr()
+ {
+ return future->getResponse();
+ }
+};
+
+}}
+
+#endif