You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/06/18 23:58:12 UTC
[34/50] [abbrv] qpid-proton git commit: PROTON-865: Use .hpp
extension for C++ headers.
PROTON-865: Use .hpp extension for C++ headers.
The common convention of using the same ".h" extension for C and C++ headers is insane.
The standard C++ library convention of using no extension at all for C++ headers is even worse.
Adopting the boost convention of ".hpp" for the proton C++ binding.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/38f57e9d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/38f57e9d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/38f57e9d
Branch: refs/heads/cjansen-cpp-client
Commit: 38f57e9d93426ffdbb9781f91906dfc44453bddd
Parents: 693752d
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Jun 16 20:20:12 2015 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Jun 18 17:28:44 2015 -0400
----------------------------------------------------------------------
examples/cpp/broker.cpp | 4 +-
examples/cpp/encode_decode.cpp | 4 +-
examples/cpp/helloworld.cpp | 4 +-
examples/cpp/helloworld_blocking.cpp | 6 +-
examples/cpp/helloworld_direct.cpp | 6 +-
examples/cpp/simple_recv.cpp | 6 +-
examples/cpp/simple_send.cpp | 6 +-
proton-c/bindings/cpp/CMakeLists.txt | 1 -
.../bindings/cpp/include/proton/Acceptor.hpp | 50 ++++
proton-c/bindings/cpp/include/proton/Acking.hpp | 44 ++++
.../cpp/include/proton/BlockingConnection.hpp | 67 +++++
.../cpp/include/proton/BlockingLink.hpp | 59 +++++
.../cpp/include/proton/BlockingSender.hpp | 54 ++++
.../bindings/cpp/include/proton/Connection.hpp | 70 ++++++
.../bindings/cpp/include/proton/Container.hpp | 77 ++++++
proton-c/bindings/cpp/include/proton/Data.hpp | 59 +++++
.../bindings/cpp/include/proton/Decoder.hpp | 219 ++++++++++++++++
.../bindings/cpp/include/proton/Delivery.hpp | 61 +++++
.../bindings/cpp/include/proton/Duration.hpp | 56 +++++
.../bindings/cpp/include/proton/Encoder.hpp | 184 ++++++++++++++
.../bindings/cpp/include/proton/Endpoint.hpp | 58 +++++
proton-c/bindings/cpp/include/proton/Event.hpp | 60 +++++
proton-c/bindings/cpp/include/proton/Handle.hpp | 79 ++++++
.../bindings/cpp/include/proton/Handler.hpp | 50 ++++
.../cpp/include/proton/ImportExport.hpp | 50 ++++
proton-c/bindings/cpp/include/proton/Link.hpp | 70 ++++++
.../bindings/cpp/include/proton/Message.hpp | 116 +++++++++
.../cpp/include/proton/MessagingAdapter.hpp | 79 ++++++
.../cpp/include/proton/MessagingEvent.hpp | 100 ++++++++
.../cpp/include/proton/MessagingHandler.hpp | 97 +++++++
.../bindings/cpp/include/proton/ProtonEvent.hpp | 57 +++++
.../cpp/include/proton/ProtonHandle.hpp | 68 +++++
.../cpp/include/proton/ProtonHandler.hpp | 83 ++++++
.../bindings/cpp/include/proton/Receiver.hpp | 48 ++++
proton-c/bindings/cpp/include/proton/Sender.hpp | 52 ++++
.../bindings/cpp/include/proton/Session.hpp | 63 +++++
.../bindings/cpp/include/proton/Terminus.hpp | 81 ++++++
.../bindings/cpp/include/proton/Transport.hpp | 48 ++++
proton-c/bindings/cpp/include/proton/Value.hpp | 98 ++++++++
proton-c/bindings/cpp/include/proton/Values.hpp | 56 +++++
.../cpp/include/proton/WaitCondition.hpp | 45 ++++
.../bindings/cpp/include/proton/cpp/Acceptor.h | 50 ----
.../bindings/cpp/include/proton/cpp/Acking.h | 44 ----
.../cpp/include/proton/cpp/BlockingConnection.h | 67 -----
.../cpp/include/proton/cpp/BlockingLink.h | 59 -----
.../cpp/include/proton/cpp/BlockingSender.h | 54 ----
.../cpp/include/proton/cpp/Connection.h | 70 ------
.../bindings/cpp/include/proton/cpp/Container.h | 77 ------
proton-c/bindings/cpp/include/proton/cpp/Data.h | 59 -----
.../bindings/cpp/include/proton/cpp/Decoder.h | 219 ----------------
.../bindings/cpp/include/proton/cpp/Delivery.h | 61 -----
.../bindings/cpp/include/proton/cpp/Duration.h | 56 -----
.../bindings/cpp/include/proton/cpp/Encoder.h | 184 --------------
.../bindings/cpp/include/proton/cpp/Endpoint.h | 58 -----
.../bindings/cpp/include/proton/cpp/Event.h | 60 -----
.../bindings/cpp/include/proton/cpp/Handle.h | 79 ------
.../bindings/cpp/include/proton/cpp/Handler.h | 50 ----
.../cpp/include/proton/cpp/ImportExport.h | 50 ----
proton-c/bindings/cpp/include/proton/cpp/Link.h | 70 ------
.../bindings/cpp/include/proton/cpp/Message.h | 116 ---------
.../cpp/include/proton/cpp/MessagingAdapter.h | 79 ------
.../cpp/include/proton/cpp/MessagingEvent.h | 100 --------
.../cpp/include/proton/cpp/MessagingHandler.h | 97 -------
.../cpp/include/proton/cpp/ProtonEvent.h | 57 -----
.../cpp/include/proton/cpp/ProtonHandle.h | 68 -----
.../cpp/include/proton/cpp/ProtonHandler.h | 83 ------
.../bindings/cpp/include/proton/cpp/Receiver.h | 48 ----
.../bindings/cpp/include/proton/cpp/Sender.h | 52 ----
.../bindings/cpp/include/proton/cpp/Session.h | 63 -----
.../bindings/cpp/include/proton/cpp/Terminus.h | 81 ------
.../bindings/cpp/include/proton/cpp/Transport.h | 48 ----
.../bindings/cpp/include/proton/cpp/Value.h | 98 --------
.../bindings/cpp/include/proton/cpp/Values.h | 56 -----
.../cpp/include/proton/cpp/WaitCondition.h | 45 ----
.../cpp/include/proton/cpp/exceptions.h | 49 ----
.../bindings/cpp/include/proton/cpp/types.h | 250 -------------------
.../bindings/cpp/include/proton/exceptions.hpp | 49 ++++
proton-c/bindings/cpp/include/proton/types.hpp | 250 +++++++++++++++++++
proton-c/bindings/cpp/src/Acceptor.cpp | 8 +-
proton-c/bindings/cpp/src/Acking.cpp | 2 +-
proton-c/bindings/cpp/src/Connection.cpp | 16 +-
proton-c/bindings/cpp/src/ConnectionImpl.cpp | 18 +-
proton-c/bindings/cpp/src/ConnectionImpl.h | 75 ------
proton-c/bindings/cpp/src/ConnectionImpl.hpp | 75 ++++++
proton-c/bindings/cpp/src/Connector.cpp | 14 +-
proton-c/bindings/cpp/src/Connector.h | 59 -----
proton-c/bindings/cpp/src/Connector.hpp | 59 +++++
proton-c/bindings/cpp/src/Container.cpp | 26 +-
proton-c/bindings/cpp/src/ContainerImpl.cpp | 30 +--
proton-c/bindings/cpp/src/ContainerImpl.h | 82 ------
proton-c/bindings/cpp/src/ContainerImpl.hpp | 82 ++++++
proton-c/bindings/cpp/src/Data.cpp | 4 +-
proton-c/bindings/cpp/src/Decoder.cpp | 8 +-
proton-c/bindings/cpp/src/Delivery.cpp | 4 +-
proton-c/bindings/cpp/src/Duration.cpp | 2 +-
proton-c/bindings/cpp/src/Encoder.cpp | 8 +-
proton-c/bindings/cpp/src/Endpoint.cpp | 6 +-
proton-c/bindings/cpp/src/Event.cpp | 10 +-
proton-c/bindings/cpp/src/Handler.cpp | 4 +-
proton-c/bindings/cpp/src/Link.cpp | 14 +-
proton-c/bindings/cpp/src/Message.cpp | 8 +-
proton-c/bindings/cpp/src/MessagingAdapter.cpp | 10 +-
proton-c/bindings/cpp/src/MessagingEvent.cpp | 14 +-
proton-c/bindings/cpp/src/MessagingHandler.cpp | 6 +-
proton-c/bindings/cpp/src/Msg.h | 59 -----
proton-c/bindings/cpp/src/Msg.hpp | 59 +++++
proton-c/bindings/cpp/src/PrivateImplRef.h | 97 -------
proton-c/bindings/cpp/src/PrivateImplRef.hpp | 97 +++++++
proton-c/bindings/cpp/src/ProtonEvent.cpp | 16 +-
proton-c/bindings/cpp/src/ProtonHandler.cpp | 4 +-
proton-c/bindings/cpp/src/ProtonImplRef.h | 66 -----
proton-c/bindings/cpp/src/ProtonImplRef.hpp | 66 +++++
proton-c/bindings/cpp/src/Receiver.cpp | 8 +-
proton-c/bindings/cpp/src/Sender.cpp | 10 +-
proton-c/bindings/cpp/src/Session.cpp | 10 +-
proton-c/bindings/cpp/src/Terminus.cpp | 2 +-
proton-c/bindings/cpp/src/Transport.cpp | 4 +-
proton-c/bindings/cpp/src/Url.cpp | 8 +-
proton-c/bindings/cpp/src/Url.h | 49 ----
proton-c/bindings/cpp/src/Url.hpp | 49 ++++
proton-c/bindings/cpp/src/Value.cpp | 4 +-
proton-c/bindings/cpp/src/Values.cpp | 4 +-
.../cpp/src/blocking/BlockingConnection.cpp | 16 +-
.../cpp/src/blocking/BlockingConnectionImpl.cpp | 16 +-
.../cpp/src/blocking/BlockingConnectionImpl.h | 63 -----
.../cpp/src/blocking/BlockingConnectionImpl.hpp | 63 +++++
.../bindings/cpp/src/blocking/BlockingLink.cpp | 12 +-
.../cpp/src/blocking/BlockingSender.cpp | 10 +-
proton-c/bindings/cpp/src/contexts.cpp | 6 +-
proton-c/bindings/cpp/src/contexts.h | 52 ----
proton-c/bindings/cpp/src/contexts.hpp | 52 ++++
proton-c/bindings/cpp/src/interop_test.cpp | 8 +-
proton-c/bindings/cpp/src/proton_bits.cpp | 2 +-
proton-c/bindings/cpp/src/proton_bits.h | 44 ----
proton-c/bindings/cpp/src/proton_bits.hpp | 44 ++++
proton-c/bindings/cpp/src/types.cpp | 2 +-
136 files changed, 3598 insertions(+), 3599 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
index 01160a7..ccecefa 100644
--- a/examples/cpp/broker.cpp
+++ b/examples/cpp/broker.cpp
@@ -19,8 +19,8 @@
*
*/
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
#include <iostream>
#include <deque>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/encode_decode.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/encode_decode.cpp b/examples/cpp/encode_decode.cpp
index 5096c40..bf1dba9 100644
--- a/examples/cpp/encode_decode.cpp
+++ b/examples/cpp/encode_decode.cpp
@@ -17,8 +17,8 @@
* under the License.
*/
-#include <proton/cpp/Values.h>
-#include <proton/cpp/Value.h>
+#include <proton/Values.hpp>
+#include <proton/Value.hpp>
#include <algorithm>
#include <iostream>
#include <iterator>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld.cpp b/examples/cpp/helloworld.cpp
index 6b58eb7..5ac73da 100644
--- a/examples/cpp/helloworld.cpp
+++ b/examples/cpp/helloworld.cpp
@@ -19,8 +19,8 @@
*
*/
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
#include <iostream>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/helloworld_blocking.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_blocking.cpp b/examples/cpp/helloworld_blocking.cpp
index 5f443b6..c0ef4c5 100644
--- a/examples/cpp/helloworld_blocking.cpp
+++ b/examples/cpp/helloworld_blocking.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/BlockingSender.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/BlockingSender.hpp"
#include <iostream>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/helloworld_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp
index 12617cd..965ba04 100644
--- a/examples/cpp/helloworld_direct.cpp
+++ b/examples/cpp/helloworld_direct.cpp
@@ -19,10 +19,10 @@
*
*/
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Container.h"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Container.hpp"
-//#include "proton/cpp/Acceptor.h"
+//#include "proton/Acceptor.hpp"
#include <iostream>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 6612b16..48ba8a4 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Link.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Link.hpp"
#include <iostream>
#include <stdlib.h>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/examples/cpp/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp
index eb87c8a..59222e4 100644
--- a/examples/cpp/simple_send.cpp
+++ b/examples/cpp/simple_send.cpp
@@ -19,9 +19,9 @@
*
*/
-#include "proton/cpp/Container.h"
-#include "proton/cpp/MessagingHandler.h"
-#include "proton/cpp/Connection.h"
+#include "proton/Container.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/Connection.hpp"
#include <iostream>
#include <string.h>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 18533ec..b7e198f 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -28,7 +28,6 @@ set(qpid-proton-cpp-source
src/Connection.cpp
src/ConnectionImpl.cpp
src/Connector.cpp
- src/Connector.h
src/Container.cpp
src/ContainerImpl.cpp
src/Data.cpp
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acceptor.hpp b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
new file mode 100644
index 0000000..5fd0004
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Acceptor.hpp
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_ACCEPTOR_H
+#define PROTON_CPP_ACCEPTOR_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+#include "proton/reactor.h"
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Acceptor : public ProtonHandle<pn_acceptor_t>
+{
+ public:
+ PN_CPP_EXTERN Acceptor();
+ PN_CPP_EXTERN Acceptor(pn_acceptor_t *);
+ PN_CPP_EXTERN Acceptor(const Acceptor&);
+ PN_CPP_EXTERN Acceptor& operator=(const Acceptor&);
+ PN_CPP_EXTERN ~Acceptor();
+
+ PN_CPP_EXTERN void close();
+ private:
+ friend class ProtonImplRef<Acceptor>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_ACCEPTOR_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Acking.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Acking.hpp b/proton-c/bindings/cpp/include/proton/Acking.hpp
new file mode 100644
index 0000000..f9f079f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Acking.hpp
@@ -0,0 +1,44 @@
+#ifndef PROTON_CPP_ACKING_H
+#define PROTON_CPP_ACKING_H
+
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "proton/ImportExport.hpp"
+#include "proton/Delivery.hpp"
+
+namespace proton {
+namespace reactor {
+
+
+class Acking
+{
+ public:
+ PN_CPP_EXTERN virtual void accept(Delivery &d);
+ PN_CPP_EXTERN virtual void reject(Delivery &d);
+ PN_CPP_EXTERN virtual void release(Delivery &d, bool delivered=true);
+ PN_CPP_EXTERN virtual void settle(Delivery &d, Delivery::state s = Delivery::REJECTED);
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_ACKING_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
new file mode 100644
index 0000000..138b239
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/BlockingConnection.hpp
@@ -0,0 +1,67 @@
+#ifndef PROTON_CPP_BLOCKINGCONNECTION_H
+#define PROTON_CPP_BLOCKINGCONNECTION_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/Duration.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Container;
+class BlockingConnectionImpl;
+class SslDomain;
+class BlockingSender;
+class WaitCondition;
+
+class BlockingConnection : public Handle<BlockingConnectionImpl>
+{
+ public:
+ PN_CPP_EXTERN BlockingConnection();
+ PN_CPP_EXTERN BlockingConnection(const BlockingConnection& c);
+ PN_CPP_EXTERN BlockingConnection& operator=(const BlockingConnection& c);
+ PN_CPP_EXTERN ~BlockingConnection();
+
+ PN_CPP_EXTERN BlockingConnection(std::string &url, Duration = Duration::FOREVER,
+ SslDomain *ssld=0, Container *c=0);
+ PN_CPP_EXTERN void close();
+
+ PN_CPP_EXTERN BlockingSender createSender(std::string &address, Handler *h=0);
+ PN_CPP_EXTERN void wait(WaitCondition &condition);
+ PN_CPP_EXTERN void wait(WaitCondition &condition, std::string &msg, Duration timeout=Duration::FOREVER);
+ PN_CPP_EXTERN Duration getTimeout();
+ private:
+ friend class PrivateImplRef<BlockingConnection>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_BLOCKINGCONNECTION_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingLink.hpp b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
new file mode 100644
index 0000000..3eec755
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/BlockingLink.hpp
@@ -0,0 +1,59 @@
+#ifndef PROTON_CPP_BLOCKINGLINK_H
+#define PROTON_CPP_BLOCKINGLINK_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/Duration.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/BlockingConnection.hpp"
+#include "proton/types.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class BlockingConnection;
+
+class BlockingLink
+{
+ public:
+ PN_CPP_EXTERN void close();
+ ~BlockingLink();
+ protected:
+ PN_CPP_EXTERN BlockingLink(BlockingConnection *c, pn_link_t *l);
+ PN_CPP_EXTERN void waitForClosed(Duration timeout=Duration::SECOND);
+ private:
+ BlockingConnection connection;
+ Link link;
+ void checkClosed();
+ friend class BlockingConnection;
+ friend class BlockingSender;
+ friend class BlockingReceiver;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_BLOCKINGLINK_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/BlockingSender.hpp b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
new file mode 100644
index 0000000..64cbdfd
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/BlockingSender.hpp
@@ -0,0 +1,54 @@
+#ifndef PROTON_CPP_BLOCKINGSENDER_H
+#define PROTON_CPP_BLOCKINGSENDER_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/Duration.hpp"
+#include "proton/MessagingHandler.hpp"
+#include "proton/BlockingLink.hpp"
+#include "proton/types.h"
+#include "proton/delivery.h"
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class BlockingConnection;
+class BlockingLink;
+
+class BlockingSender : public BlockingLink
+{
+ public:
+ PN_CPP_EXTERN Delivery send(Message &msg);
+ PN_CPP_EXTERN Delivery send(Message &msg, Duration timeout);
+ private:
+ PN_CPP_EXTERN BlockingSender(BlockingConnection &c, Sender &l);
+ friend class BlockingConnection;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_BLOCKINGSENDER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Connection.hpp b/proton-c/bindings/cpp/include/proton/Connection.hpp
new file mode 100644
index 0000000..e72b091
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Connection.hpp
@@ -0,0 +1,70 @@
+#ifndef PROTON_CPP_CONNECTION_H
+#define PROTON_CPP_CONNECTION_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Container.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Transport;
+class Container;
+class ConnectionImpl;
+
+class Connection : public Endpoint, public Handle<ConnectionImpl>
+{
+ public:
+ PN_CPP_EXTERN Connection();
+ PN_CPP_EXTERN Connection(ConnectionImpl *);
+ PN_CPP_EXTERN Connection(const Connection& c);
+ PN_CPP_EXTERN Connection& operator=(const Connection& c);
+ PN_CPP_EXTERN ~Connection();
+
+ PN_CPP_EXTERN Connection(Container &c, Handler *h = 0);
+ PN_CPP_EXTERN Transport &getTransport();
+ PN_CPP_EXTERN Handler *getOverride();
+ PN_CPP_EXTERN void setOverride(Handler *h);
+ PN_CPP_EXTERN void open();
+ PN_CPP_EXTERN void close();
+ PN_CPP_EXTERN pn_connection_t *getPnConnection();
+ PN_CPP_EXTERN Container &getContainer();
+ PN_CPP_EXTERN std::string getHostname();
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ PN_CPP_EXTERN Link getLinkHead(Endpoint::State mask);
+ private:
+ friend class PrivateImplRef<Connection>;
+ friend class Connector;
+ friend class ConnectionImpl;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_CONNECTION_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Container.hpp b/proton-c/bindings/cpp/include/proton/Container.hpp
new file mode 100644
index 0000000..0f61599
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Container.hpp
@@ -0,0 +1,77 @@
+#ifndef PROTON_CPP_CONTAINER_H
+#define PROTON_CPP_CONTAINER_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/Handle.hpp"
+#include "proton/Acceptor.hpp"
+#include "proton/Duration.hpp"
+#include <proton/reactor.h>
+#include <string>
+
+namespace proton {
+namespace reactor {
+
+class DispatchHelper;
+class Connection;
+class Connector;
+class Acceptor;
+class ContainerImpl;
+class MessagingHandler;
+class Sender;
+class Receiver;
+class Link;
+ class Handler;
+
+class Container : public Handle<ContainerImpl>
+{
+ public:
+ PN_CPP_EXTERN Container(ContainerImpl *);
+ PN_CPP_EXTERN Container(const Container& c);
+ PN_CPP_EXTERN Container& operator=(const Container& c);
+ PN_CPP_EXTERN ~Container();
+
+ PN_CPP_EXTERN Container();
+ PN_CPP_EXTERN Container(MessagingHandler &mhandler);
+ PN_CPP_EXTERN Connection connect(std::string &host, Handler *h=0);
+ PN_CPP_EXTERN void run();
+ PN_CPP_EXTERN void start();
+ PN_CPP_EXTERN bool process();
+ PN_CPP_EXTERN void stop();
+ PN_CPP_EXTERN void wakeup();
+ PN_CPP_EXTERN bool isQuiesced();
+ PN_CPP_EXTERN pn_reactor_t *getReactor();
+ PN_CPP_EXTERN Sender createSender(Connection &connection, std::string &addr, Handler *h=0);
+ PN_CPP_EXTERN Sender createSender(std::string &url);
+ PN_CPP_EXTERN Receiver createReceiver(Connection &connection, std::string &addr);
+ PN_CPP_EXTERN Receiver createReceiver(const std::string &url);
+ PN_CPP_EXTERN Acceptor listen(const std::string &url);
+ PN_CPP_EXTERN std::string getContainerId();
+ PN_CPP_EXTERN Duration getTimeout();
+ PN_CPP_EXTERN void setTimeout(Duration timeout);
+ private:
+ friend class PrivateImplRef<Container>;
+};
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_CONTAINER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Data.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Data.hpp b/proton-c/bindings/cpp/include/proton/Data.hpp
new file mode 100644
index 0000000..7f9dad0
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Data.hpp
@@ -0,0 +1,59 @@
+#ifndef DATA_H
+#define DATA_H
+/*
+ * 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.
+ */
+
+#include "proton/ImportExport.hpp"
+#include <iosfwd>
+
+/**@file
+ * Base for classes that hold AMQP data.
+ * @internal
+ */
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+/** Base for classes that hold AMQP data. */
+class Data {
+ public:
+ virtual ~Data();
+
+ /** Copies the data */
+ Data& operator=(const Data&);
+
+ /** Clear the data. */
+ PN_CPP_EXTERN void clear();
+
+ /** True if there are no values. */
+ PN_CPP_EXTERN bool empty() const;
+
+ /** Human readable representation of data. */
+ friend std::ostream& operator<<(std::ostream&, const Data&);
+
+ protected:
+ /** Takes ownership of pd */
+ explicit Data(pn_data_t* pd=0);
+ mutable pn_data_t* data;
+};
+
+
+}}
+#endif // DATA_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Decoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Decoder.hpp b/proton-c/bindings/cpp/include/proton/Decoder.hpp
new file mode 100644
index 0000000..814fb05
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Decoder.hpp
@@ -0,0 +1,219 @@
+#ifndef DECODER_H
+#define DECODER_H
+/*
+ * 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.
+ */
+
+#include "proton/Data.hpp"
+#include "proton/types.hpp"
+#include "proton/exceptions.hpp"
+#include <iosfwd>
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**@file
+ * Stream-like decoder from AMQP bytes to C++ values.
+ * @ingroup cpp
+ */
+
+/**
+@ingroup cpp
+
+Stream-like decoder from AMQP bytes to a stream of C++ values.
+
+types.h defines C++ types corresponding to AMQP types.
+
+Decoder operator>> will extract AMQP types into corresponding C++ types, and do
+simple conversions, e.g. from AMQP integer types to corresponding or larger C++
+integer types.
+
+You can require an exact AMQP type using the `as<type>(value)` helper. E.g.
+
+ Int i;
+ decoder >> as<INT>(i): // Will throw if decoder does not contain an INT
+
+You can also use the `as` helper to extract an AMQP list, array or map into C++ containers.
+
+ std::vector<Int> v;
+ decoder >> as<LIST>(v); // Extract a list of INT.
+
+AMQP maps can be inserted/extracted to any container with pair<X,Y> as
+value_type, which includes std::map and std::unordered_map but also for
+example std::vector<std::pair<X,Y> >. This allows you to perserve order when
+extracting AMQP maps.
+
+You can also extract container values element-by-element, see the Start class.
+*/
+PN_CPP_EXTERN class Decoder : public virtual Data {
+ public:
+ /** Raised if a Decoder operation fails */
+ struct Error : public ProtonException {
+ explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+ };
+
+ PN_CPP_EXTERN Decoder();
+ PN_CPP_EXTERN ~Decoder();
+
+ /** Copy AMQP data from a byte buffer into the Decoder. */
+ PN_CPP_EXTERN Decoder(const char* buffer, size_t size);
+
+ /** Copy AMQP data from a std::string into the Decoder. */
+ PN_CPP_EXTERN Decoder(const std::string&);
+
+ /** Decode AMQP data from a byte buffer onto the end of the value stream. */
+ PN_CPP_EXTERN void decode(const char* buffer, size_t size);
+
+ /** Decode AMQP data from bytes in std::string onto the end of the value stream. */
+ PN_CPP_EXTERN void decode(const std::string&);
+
+ /** Return true if there are more values to read at the current level. */
+ PN_CPP_EXTERN bool more() const;
+
+ /** Type of the next value that will be read by operator>>
+ *@throw Error if empty().
+ */
+ PN_CPP_EXTERN TypeId type() const;
+
+ /** @name Extract simple types
+ * Overloads to extract simple types.
+ * @throw Error if the Decoder is empty or the current value has an incompatible type.
+ * @{
+ */
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Null);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Bool&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ubyte&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Byte&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ushort&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Short&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uint&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Int&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Char&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Ulong&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Long&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Timestamp&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Float&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Double&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal32&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal64&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Decimal128&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Uuid&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, std::string&);
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Value&);
+ ///@}
+
+ /** Extract and return a value of type T. */
+ template <class T> T get() { T value; *this >> value; return value; }
+
+ /** Extract and return a value of type T, as AMQP type. */
+ template <class T, TypeId A> T getAs() { T value; *this >> as<A>(value); return value; }
+
+ /** Call Decoder::start() in constructor, Decoder::finish in destructor() */
+ struct Scope : public Start {
+ Decoder& decoder;
+ Scope(Decoder& d) : decoder(d) { d >> *this; }
+ ~Scope() { decoder >> finish(); }
+ };
+
+ template <TypeId A, class T> friend Decoder& operator>>(Decoder& d, Ref<T, A> ref) {
+ d.checkType(A);
+ d >> ref.value;
+ return d;
+ }
+
+ /** start extracting a container value, one of array, list, map, described.
+ * The basic pattern is:
+ *
+ * Start s;
+ * decoder >> s;
+ * // check s.type() to see if this is an ARRAY, LIST, MAP or DESCRIBED type.
+ * if (s.described) extract the descriptor...
+ * for (size_t i = 0; i < s.size(); ++i) Extract each element...
+ * decoder >> finish();
+ *
+ * The first value of an ARRAY is a descriptor if Start::descriptor is true,
+ * followed by Start::size elemets of type Start::element.
+ *
+ * A LIST has Start::size elements which may be of mixed type.
+ *
+ * A MAP has Start::size elements which alternate key, value, key, value...
+ * and may be of mixed type.
+ *
+ * A DESCRIBED contains a descriptor and a single element, so it always has
+ * Start::described=true and Start::size=1.
+ *
+ * Note Scope automatically calls finish() in its destructor.
+ *
+ *@throw decoder::error if the curent value is not a container type.
+ */
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Start&);
+
+ /** Finish extracting a container value. */
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Finish);
+
+ /** Skip a value */
+ PN_CPP_EXTERN friend Decoder& operator>>(Decoder&, Skip);
+
+ private:
+ template <class T> Decoder& extract(T& value);
+ void checkType(TypeId);
+
+ // Not implemented
+ Decoder(const Decoder&);
+ Decoder& operator=(const Decoder&);
+
+ friend class Value;
+ friend class Encoder;
+};
+
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, ARRAY> ref) {
+ Decoder::Scope s(d);
+ if (s.isDescribed) d >> skip();
+ ref.value.clear();
+ ref.value.resize(s.size);
+ for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i) {
+ d >> *i;
+ }
+ return d;
+}
+
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, LIST> ref) {
+ Decoder::Scope s(d);
+ ref.value.clear();
+ ref.value.resize(s.size);
+ for (typename T::iterator i = ref.value.begin(); i != ref.value.end(); ++i)
+ d >> *i;
+ return d;
+}
+
+template <class T> Decoder& operator>>(Decoder& d, Ref<T, MAP> ref) {
+ Decoder::Scope m(d);
+ ref.value.clear();
+ for (size_t i = 0; i < m.size/2; ++i) {
+ typename T::key_type k;
+ typename T::mapped_type v;
+ d >> k >> v;
+ ref.value[k] = v;
+ }
+ return d;
+}
+
+}} // namespace proton::reactor
+#endif // DECODER_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Delivery.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Delivery.hpp b/proton-c/bindings/cpp/include/proton/Delivery.hpp
new file mode 100644
index 0000000..63ecfcd
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Delivery.hpp
@@ -0,0 +1,61 @@
+#ifndef PROTON_CPP_DELIVERY_H
+#define PROTON_CPP_DELIVERY_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+
+#include "proton/delivery.h"
+#include "proton/disposition.h"
+
+namespace proton {
+namespace reactor {
+
+class Delivery : public ProtonHandle<pn_delivery_t>
+{
+ public:
+
+ enum state {
+ NONE = 0,
+ RECEIVED = PN_RECEIVED,
+ ACCEPTED = PN_ACCEPTED,
+ REJECTED = PN_REJECTED,
+ RELEASED = PN_RELEASED,
+ MODIFIED = PN_MODIFIED
+ }; // AMQP spec 3.4 Delivery State
+
+ PN_CPP_EXTERN Delivery(pn_delivery_t *d);
+ PN_CPP_EXTERN Delivery();
+ PN_CPP_EXTERN ~Delivery();
+ PN_CPP_EXTERN Delivery(const Delivery&);
+ PN_CPP_EXTERN Delivery& operator=(const Delivery&);
+ PN_CPP_EXTERN bool settled();
+ PN_CPP_EXTERN void settle();
+ PN_CPP_EXTERN pn_delivery_t *getPnDelivery();
+ private:
+ friend class ProtonImplRef<Delivery>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_DELIVERY_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Duration.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Duration.hpp b/proton-c/bindings/cpp/include/proton/Duration.hpp
new file mode 100644
index 0000000..0265e73
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Duration.hpp
@@ -0,0 +1,56 @@
+#ifndef PROTON_CPP_DURATION_H
+#define PROTON_CPP_DURATION_H
+
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "proton/ImportExport.hpp"
+#include "proton/types.h"
+
+namespace proton {
+namespace reactor {
+
+/** @ingroup cpp
+ * A duration is a time in milliseconds.
+ */
+class Duration
+{
+ public:
+ PN_CPP_EXTERN explicit Duration(uint64_t milliseconds);
+ PN_CPP_EXTERN uint64_t getMilliseconds() const;
+ PN_CPP_EXTERN static const Duration FOREVER;
+ PN_CPP_EXTERN static const Duration IMMEDIATE;
+ PN_CPP_EXTERN static const Duration SECOND;
+ PN_CPP_EXTERN static const Duration MINUTE;
+ private:
+ uint64_t milliseconds;
+};
+
+PN_CPP_EXTERN Duration operator*(const Duration& duration,
+ uint64_t multiplier);
+PN_CPP_EXTERN Duration operator*(uint64_t multiplier,
+ const Duration& duration);
+PN_CPP_EXTERN bool operator==(const Duration& a, const Duration& b);
+PN_CPP_EXTERN bool operator!=(const Duration& a, const Duration& b);
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_DURATION_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Encoder.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Encoder.hpp b/proton-c/bindings/cpp/include/proton/Encoder.hpp
new file mode 100644
index 0000000..e32fce5
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Encoder.hpp
@@ -0,0 +1,184 @@
+#ifndef ENCODER_H
+#define ENCODER_H
+/*
+ * 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.
+ */
+
+#include "proton/Data.hpp"
+#include "proton/types.hpp"
+#include "proton/exceptions.hpp"
+#include <iosfwd>
+
+struct pn_data_t;
+
+namespace proton {
+namespace reactor {
+
+class Value;
+
+/**@file
+ * Stream-like encoder from C++ values to AMQP bytes.
+ * @ingroup cpp
+*/
+
+/**
+@ingroup cpp
+
+types.h defines C++ typedefs and types for AMQP each type. These types
+insert as the corresponding AMQP type. Normal C++ conversion rules apply if you
+insert any other type.
+
+C++ containers can be inserted as AMQP containers with the as() helper functions. E.g.
+
+ std::vector<Symbol> v; encoder << as<List>(v);
+
+AMQP maps can be inserted/extracted to any container with pair<X,Y> as
+value_type, which includes std::map and std::unordered_map but also for
+example std::vector<std::pair<X,Y> >. This allows you to perserve order when
+extracting AMQP maps.
+
+You can also insert containers element-by-element, see the Start class.
+*/
+class Encoder : public virtual Data {
+ public:
+ /** Raised if a Encoder operation fails */
+ struct Error : public ProtonException {
+ explicit Error(const std::string& msg) throw() : ProtonException(msg) {}
+ };
+
+ PN_CPP_EXTERN Encoder();
+ PN_CPP_EXTERN ~Encoder();
+
+ /**
+ * Encode the current values into buffer and update size to reflect the number of bytes encoded.
+ *
+ * Clears the encoder.
+ *
+ *@return if buffer==0 or size is too small then return false and size to the required size.
+ *Otherwise return true and set size to the number of bytes encoded.
+ */
+ PN_CPP_EXTERN bool encode(char* buffer, size_t& size);
+
+ /** Encode the current values into a std::string, resize the string if necessary.
+ *
+ * Clears the encoder.
+ */
+ PN_CPP_EXTERN void encode(std::string&);
+
+ /** Encode the current values into a std::string. Clears the encoder. */
+ PN_CPP_EXTERN std::string encode();
+
+ /** @name Insert simple types.
+ *@{
+ */
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Null);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Bool);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ubyte);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Byte);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ushort);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Short);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uint);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Int);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Char);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Ulong);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Long);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Timestamp);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Float);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Double);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal32);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal64);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Decimal128);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Uuid);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, String);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Symbol);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, Binary);
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Value&);
+ ///@}
+
+ /** Start a container type. See the Start class. */
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder&, const Start&);
+
+ /** Finish a container type. */
+ PN_CPP_EXTERN friend Encoder& operator<<(Encoder& e, Finish);
+
+
+ /**@name Insert values returned by the as<TypeId> helper.
+ *@{
+ */
+ template <class T, TypeId A> friend Encoder& operator<<(Encoder&, CRef<T, A>);
+ template <class T> friend Encoder& operator<<(Encoder&, CRef<T, ARRAY>);
+ template <class T> friend Encoder& operator<<(Encoder&, CRef<T, LIST>);
+ template <class T> friend Encoder& operator<<(Encoder&, CRef<T, MAP>);
+ // TODO aconway 2015-06-16: DESCRIBED.
+ ///@}
+
+ private:
+ PN_CPP_EXTERN Encoder(pn_data_t* pd);
+
+ // Not implemented
+ Encoder(const Encoder&);
+ Encoder& operator=(const Encoder&);
+
+ friend class Value;
+};
+
+/** Encode const char* as string */
+inline Encoder& operator<<(Encoder& e, const char* s) { return e << String(s); }
+
+/** Encode char* as string */
+inline Encoder& operator<<(Encoder& e, char* s) { return e << String(s); }
+
+/** Encode std::string as string */
+inline Encoder& operator<<(Encoder& e, const std::string& s) { return e << String(s); }
+
+//@internal Convert a Ref to a CRef.
+template <class T, TypeId A> Encoder& operator<<(Encoder& e, Ref<T, A> ref) {
+ return e << CRef<T,A>(ref);
+}
+
+// TODO aconway 2015-06-16: described array insertion.
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, ARRAY> a) {
+ e << Start::array(TypeIdOf<typename T::value_type>::value);
+ for (typename T::const_iterator i = a.value.begin(); i != a.value.end(); ++i)
+ e << *i;
+ e << finish();
+ return e;
+}
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, LIST> l) {
+ e << Start::list();
+ for (typename T::const_iterator i = l.value.begin(); i != l.value.end(); ++i)
+ e << *i;
+ e << finish();
+ return e;
+}
+
+template <class T> Encoder& operator<<(Encoder& e, CRef<T, MAP> m){
+ e << Start::map();
+ for (typename T::const_iterator i = m.value.begin(); i != m.value.end(); ++i) {
+ e << i->first;
+ e << i->second;
+ }
+ e << finish();
+ return e;
+}
+
+
+}}
+#endif // ENCODER_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Endpoint.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Endpoint.hpp b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
new file mode 100644
index 0000000..e68ffbf
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Endpoint.hpp
@@ -0,0 +1,58 @@
+#ifndef PROTON_CPP_ENDPOINT_H
+#define PROTON_CPP_ENDPOINT_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/connection.h"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Connection;
+class Transport;
+
+class Endpoint
+{
+ public:
+ enum {
+ LOCAL_UNINIT = PN_LOCAL_UNINIT,
+ REMOTE_UNINIT = PN_REMOTE_UNINIT,
+ LOCAL_ACTIVE = PN_LOCAL_ACTIVE,
+ REMOTE_ACTIVE = PN_REMOTE_ACTIVE,
+ LOCAL_CLOSED = PN_LOCAL_CLOSED,
+ REMOTE_CLOSED = PN_REMOTE_CLOSED
+ };
+ typedef int State;
+
+ // TODO: getCondition, getRemoteCondition, updateCondition, get/setHandler
+ virtual PN_CPP_EXTERN Connection &getConnection() = 0;
+ Transport PN_CPP_EXTERN &getTransport();
+ protected:
+ Endpoint();
+ ~Endpoint();
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_ENDPOINT_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Event.hpp b/proton-c/bindings/cpp/include/proton/Event.hpp
new file mode 100644
index 0000000..f808dd1
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Event.hpp
@@ -0,0 +1,60 @@
+#ifndef PROTON_CPP_EVENT_H
+#define PROTON_CPP_EVENT_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/Link.hpp"
+#include "proton/Connection.hpp"
+#include "proton/Message.hpp"
+#include <vector>
+
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+
+class Event
+{
+ public:
+ virtual PN_CPP_EXTERN void dispatch(Handler &h) = 0;
+ virtual PN_CPP_EXTERN Container &getContainer();
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ virtual PN_CPP_EXTERN Sender getSender();
+ virtual PN_CPP_EXTERN Receiver getReceiver();
+ virtual PN_CPP_EXTERN Link getLink();
+ virtual PN_CPP_EXTERN Message getMessage();
+ virtual PN_CPP_EXTERN void setMessage(Message &);
+ virtual PN_CPP_EXTERN ~Event();
+ protected:
+ PN_CPP_EXTERN PN_CPP_EXTERN Event();
+ private:
+ PN_CPP_EXTERN Event(const Event&);
+ PN_CPP_EXTERN Event& operator=(const Event&);
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_EVENT_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Handle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handle.hpp b/proton-c/bindings/cpp/include/proton/Handle.hpp
new file mode 100644
index 0000000..f8fc81b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Handle.hpp
@@ -0,0 +1,79 @@
+#ifndef PROTON_CPP_HANDLE_H
+#define PROTON_CPP_HANDLE_H
+
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "proton/ImportExport.hpp"
+
+namespace proton {
+namespace reactor {
+
+template <class> class PrivateImplRef;
+template <class> class ProtonImplRef;
+
+// FIXME aconway 2015-06-09: don't need handle, get rid of it.
+
+/**
+ * A handle is like a pointer: refers to an underlying implementation object.
+ * Copying the handle does not copy the object.
+ *
+ * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the
+ * conversion to bool to test for a null handle.
+ */
+template <class T> class Handle {
+ public:
+
+ /**@return true if handle is valid, i.e. not null. */
+ PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+
+ /**@return true if handle is null. It is an error to call any function on a null handle. */
+ PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+
+ /** Conversion to bool supports idiom if (handle) { handle->... } */
+ PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+
+ /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+ PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+
+ /** Operator == equal if they point to same non-null object*/
+ PROTON_CPP_INLINE_EXTERN bool operator ==(const Handle<T>& other) const { return impl == other.impl; }
+ PROTON_CPP_INLINE_EXTERN bool operator !=(const Handle<T>& other) const { return impl != other.impl; }
+
+ void swap(Handle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+ private:
+ // Not implemented, subclasses must implement.
+ Handle(const Handle&);
+ Handle& operator=(const Handle&);
+
+ protected:
+ typedef T Impl;
+ PROTON_CPP_INLINE_EXTERN Handle() :impl() {}
+
+ Impl* impl;
+
+ friend class PrivateImplRef<T>;
+};
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_HANDLE_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Handler.hpp b/proton-c/bindings/cpp/include/proton/Handler.hpp
new file mode 100644
index 0000000..d20fbeb
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Handler.hpp
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_HANDLER_H
+#define PROTON_CPP_HANDLER_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/Event.hpp"
+#include "proton/event.h"
+#include <vector>
+
+namespace proton {
+namespace reactor {
+
+class PN_CPP_EXTERN Handler
+{
+ public:
+ PN_CPP_EXTERN Handler();
+ PN_CPP_EXTERN virtual ~Handler();
+
+ PN_CPP_EXTERN virtual void onUnhandled(Event &e);
+
+ PN_CPP_EXTERN virtual void addChildHandler(Handler &e);
+ PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersBegin();
+ PN_CPP_EXTERN std::vector<Handler *>::iterator childHandlersEnd();
+ protected:
+ std::vector<Handler *>childHandlers;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_HANDLER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/ImportExport.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ImportExport.hpp b/proton-c/bindings/cpp/include/proton/ImportExport.hpp
new file mode 100644
index 0000000..cbc0626
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/ImportExport.hpp
@@ -0,0 +1,50 @@
+#ifndef PROTON_CPP_IMPORTEXPORT_H
+#define PROTON_CPP_IMPORTEXPORT_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#if defined(WIN32) && !defined(PROTON_CPP_DECLARE_STATIC)
+ //
+ // Import and Export definitions for Windows:
+ //
+# define PROTON_CPP_EXPORT __declspec(dllexport)
+# define PROTON_CPP_IMPORT __declspec(dllimport)
+#else
+ //
+ // Non-Windows (Linux, etc.) definitions:
+ //
+# define PROTON_CPP_EXPORT
+# define PROTON_CPP_IMPORT
+#endif
+
+
+// For c++ library symbols
+
+#ifdef protoncpp_EXPORTS
+# define PN_CPP_EXTERN PROTON_CPP_EXPORT
+#else
+# define PN_CPP_EXTERN PROTON_CPP_IMPORT
+#endif
+
+// TODO:
+#define PROTON_CPP_INLINE_EXTERN
+
+#endif /*!PROTON_CPP_IMPORTEXPORT_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Link.hpp b/proton-c/bindings/cpp/include/proton/Link.hpp
new file mode 100644
index 0000000..bf5a9a7
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Link.hpp
@@ -0,0 +1,70 @@
+#ifndef PROTON_CPP_LINK_H
+#define PROTON_CPP_LINK_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+#include "proton/Endpoint.hpp"
+#include "proton/Terminus.hpp"
+#include "proton/types.h"
+#include <string>
+
+struct pn_connection_t;
+
+namespace proton {
+namespace reactor {
+
+class Link : public Endpoint, public ProtonHandle<pn_link_t>
+{
+ public:
+ PN_CPP_EXTERN Link(pn_link_t *);
+ PN_CPP_EXTERN Link();
+ PN_CPP_EXTERN ~Link();
+ PN_CPP_EXTERN Link(const Link&);
+ PN_CPP_EXTERN Link& operator=(const Link&);
+ PN_CPP_EXTERN void open();
+ PN_CPP_EXTERN void close();
+ PN_CPP_EXTERN bool isSender();
+ PN_CPP_EXTERN bool isReceiver();
+ PN_CPP_EXTERN int getCredit();
+ PN_CPP_EXTERN Terminus getSource();
+ PN_CPP_EXTERN Terminus getTarget();
+ PN_CPP_EXTERN Terminus getRemoteSource();
+ PN_CPP_EXTERN Terminus getRemoteTarget();
+ PN_CPP_EXTERN std::string getName();
+ PN_CPP_EXTERN pn_link_t *getPnLink() const;
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ PN_CPP_EXTERN Link getNext(Endpoint::State mask);
+ protected:
+ virtual void verifyType(pn_link_t *l);
+ private:
+ friend class ProtonImplRef<Link>;
+ bool senderLink;
+};
+
+
+}} // namespace proton::reactor
+
+#include "proton/Sender.hpp"
+#include "proton/Receiver.hpp"
+
+#endif /*!PROTON_CPP_LINK_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/Message.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/Message.hpp b/proton-c/bindings/cpp/include/proton/Message.hpp
new file mode 100644
index 0000000..f94f58b
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/Message.hpp
@@ -0,0 +1,116 @@
+#ifndef PROTON_CPP_MESSAGE_H
+#define PROTON_CPP_MESSAGE_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ImportExport.hpp"
+#include "proton/ProtonHandle.hpp"
+#include "proton/message.h"
+#include <string>
+
+
+namespace proton {
+namespace reactor {
+
+class Message : public ProtonHandle<pn_message_t>
+{
+ public:
+ PN_CPP_EXTERN Message();
+ PN_CPP_EXTERN Message(pn_message_t *);
+ PN_CPP_EXTERN Message(const Message&);
+ PN_CPP_EXTERN Message& operator=(const Message&);
+ PN_CPP_EXTERN ~Message();
+
+ PN_CPP_EXTERN pn_message_t *getPnMessage() const;
+
+ // FIXME aconway 2015-06-11: get rid of get/set prefixes
+
+ // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+ PN_CPP_EXTERN void setId(uint64_t id);
+ PN_CPP_EXTERN uint64_t getId();
+ PN_CPP_EXTERN void setId(const std::string &id);
+ PN_CPP_EXTERN std::string getStringId();
+ PN_CPP_EXTERN void setId(const char *p, size_t len);
+ PN_CPP_EXTERN size_t getId(const char **p);
+ PN_CPP_EXTERN pn_type_t getIdType();
+
+ PN_CPP_EXTERN void setUserId(const std::string &id);
+ PN_CPP_EXTERN std::string getUserId();
+
+ PN_CPP_EXTERN void setAddress(const std::string &addr);
+ PN_CPP_EXTERN std::string getAddress();
+
+ PN_CPP_EXTERN void setSubject(const std::string &s);
+ PN_CPP_EXTERN std::string getSubject();
+
+ PN_CPP_EXTERN void setReplyTo(const std::string &s);
+ PN_CPP_EXTERN std::string getReplyTo();
+
+ PN_CPP_EXTERN void setCorrelationId(uint64_t id);
+ PN_CPP_EXTERN uint64_t getCorrelationId();
+ PN_CPP_EXTERN void setCorrelationId(const std::string &id);
+ PN_CPP_EXTERN std::string getStringCorrelationId();
+ PN_CPP_EXTERN void setCorrelationId(const char *p, size_t len);
+ PN_CPP_EXTERN size_t getCorrelationId(const char **p);
+
+ // FIXME aconway 2015-06-11: use Value not string to allow full range of AMQP types.
+ PN_CPP_EXTERN pn_type_t getCorrelationIdType();
+
+ PN_CPP_EXTERN void setContentType(const std::string &s);
+ PN_CPP_EXTERN std::string getContentType();
+
+ PN_CPP_EXTERN void setContentEncoding(const std::string &s);
+ PN_CPP_EXTERN std::string getContentEncoding();
+
+ PN_CPP_EXTERN void setExpiry(pn_timestamp_t t);
+ PN_CPP_EXTERN pn_timestamp_t getExpiry();
+
+ PN_CPP_EXTERN void setCreationTime(pn_timestamp_t t);
+ PN_CPP_EXTERN pn_timestamp_t getCreationTime();
+
+ PN_CPP_EXTERN void setGroupId(const std::string &s);
+ PN_CPP_EXTERN std::string getGroupId();
+
+ PN_CPP_EXTERN void setReplyToGroupId(const std::string &s);
+ PN_CPP_EXTERN std::string getReplyToGroupId();
+
+ // FIXME aconway 2015-06-11: use Values for body.
+ PN_CPP_EXTERN void setBody(const std::string &data);
+ PN_CPP_EXTERN std::string getBody();
+
+ PN_CPP_EXTERN void getBody(std::string &str);
+
+ PN_CPP_EXTERN void setBody(const char *, size_t len);
+ PN_CPP_EXTERN size_t getBody(char *, size_t len);
+ PN_CPP_EXTERN size_t getBinaryBodySize();
+
+
+ PN_CPP_EXTERN void encode(std::string &data);
+ PN_CPP_EXTERN void decode(const std::string &data);
+
+ private:
+ friend class ProtonImplRef<Message>;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_MESSAGE_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp b/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
new file mode 100644
index 0000000..7c6fa79
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/MessagingAdapter.hpp
@@ -0,0 +1,79 @@
+#ifndef PROTON_CPP_MESSAGING_ADAPTER_H
+#define PROTON_CPP_MESSAGING_ADAPTER_H
+
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "proton/ProtonHandler.hpp"
+#include "proton/MessagingHandler.hpp"
+
+#include "proton/MessagingEvent.hpp"
+#include "proton/event.h"
+#include "proton/reactor.h"
+
+namespace proton {
+namespace reactor {
+
+// Combine's Python's: EndpointStateHandler, IncomingMessageHandler, OutgoingMessageHandler
+
+
+class MessagingAdapter : public MessagingHandler
+{
+ public:
+ PN_CPP_EXTERN MessagingAdapter(MessagingHandler &delegate);
+ PN_CPP_EXTERN virtual ~MessagingAdapter();
+ PN_CPP_EXTERN virtual void onReactorInit(Event &e);
+ PN_CPP_EXTERN virtual void onLinkFlow(Event &e);
+ PN_CPP_EXTERN virtual void onDelivery(Event &e);
+ PN_CPP_EXTERN virtual void onUnhandled(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionClosed(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionClosing(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionError(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionLocalOpen(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionRemoteOpen(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionRemoteClose(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionOpened(Event &e);
+ PN_CPP_EXTERN virtual void onConnectionOpening(Event &e);
+ PN_CPP_EXTERN virtual void onSessionClosed(Event &e);
+ PN_CPP_EXTERN virtual void onSessionClosing(Event &e);
+ PN_CPP_EXTERN virtual void onSessionError(Event &e);
+ PN_CPP_EXTERN virtual void onSessionLocalOpen(Event &e);
+ PN_CPP_EXTERN virtual void onSessionRemoteOpen(Event &e);
+ PN_CPP_EXTERN virtual void onSessionRemoteClose(Event &e);
+ PN_CPP_EXTERN virtual void onSessionOpened(Event &e);
+ PN_CPP_EXTERN virtual void onSessionOpening(Event &e);
+ PN_CPP_EXTERN virtual void onLinkClosed(Event &e);
+ PN_CPP_EXTERN virtual void onLinkClosing(Event &e);
+ PN_CPP_EXTERN virtual void onLinkError(Event &e);
+ PN_CPP_EXTERN virtual void onLinkLocalOpen(Event &e);
+ PN_CPP_EXTERN virtual void onLinkRemoteOpen(Event &e);
+ PN_CPP_EXTERN virtual void onLinkRemoteClose(Event &e);
+ PN_CPP_EXTERN virtual void onLinkOpened(Event &e);
+ PN_CPP_EXTERN virtual void onLinkOpening(Event &e);
+ PN_CPP_EXTERN virtual void onTransportTailClosed(Event &e);
+ private:
+ MessagingHandler &delegate; // The handler for generated MessagingEvent's
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_MESSAGING_ADAPTER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp b/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
new file mode 100644
index 0000000..a73a7ad
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/MessagingEvent.hpp
@@ -0,0 +1,100 @@
+#ifndef PROTON_CPP_MESSAGINGEVENT_H
+#define PROTON_CPP_MESSAGINGEVENT_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/ProtonEvent.hpp"
+#include "proton/Link.hpp"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+
+typedef enum {
+ PN_MESSAGING_PROTON = 0, // Wrapped pn_event_t
+ // Covenience events for C++ MessagingHandlers
+ PN_MESSAGING_ABORT,
+ PN_MESSAGING_ACCEPTED,
+ PN_MESSAGING_COMMIT,
+ PN_MESSAGING_CONNECTION_CLOSED,
+ PN_MESSAGING_CONNECTION_CLOSING,
+ PN_MESSAGING_CONNECTION_ERROR,
+ PN_MESSAGING_CONNECTION_OPENED,
+ PN_MESSAGING_CONNECTION_OPENING,
+ PN_MESSAGING_DISCONNECTED,
+ PN_MESSAGING_FETCH,
+ PN_MESSAGING_ID_LOADED,
+ PN_MESSAGING_LINK_CLOSED,
+ PN_MESSAGING_LINK_CLOSING,
+ PN_MESSAGING_LINK_OPENED,
+ PN_MESSAGING_LINK_OPENING,
+ PN_MESSAGING_LINK_ERROR,
+ PN_MESSAGING_MESSAGE,
+ PN_MESSAGING_QUIT,
+ PN_MESSAGING_RECORD_INSERTED,
+ PN_MESSAGING_RECORDS_LOADED,
+ PN_MESSAGING_REJECTED,
+ PN_MESSAGING_RELEASED,
+ PN_MESSAGING_REQUEST,
+ PN_MESSAGING_RESPONSE,
+ PN_MESSAGING_SENDABLE,
+ PN_MESSAGING_SESSION_CLOSED,
+ PN_MESSAGING_SESSION_CLOSING,
+ PN_MESSAGING_SESSION_OPENED,
+ PN_MESSAGING_SESSION_OPENING,
+ PN_MESSAGING_SESSION_ERROR,
+ PN_MESSAGING_SETTLED,
+ PN_MESSAGING_START,
+ PN_MESSAGING_TIMER,
+ PN_MESSAGING_TRANSACTION_ABORTED,
+ PN_MESSAGING_TRANSACTION_COMMITTED,
+ PN_MESSAGING_TRANSACTION_DECLARED,
+ PN_MESSAGING_TRANSPORT_CLOSED
+} MessagingEventType_t;
+
+class MessagingEvent : public ProtonEvent
+{
+ public:
+ MessagingEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+ MessagingEvent(MessagingEventType_t t, ProtonEvent &parent);
+ ~MessagingEvent();
+ virtual PN_CPP_EXTERN void dispatch(Handler &h);
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ virtual PN_CPP_EXTERN Sender getSender();
+ virtual PN_CPP_EXTERN Receiver getReceiver();
+ virtual PN_CPP_EXTERN Link getLink();
+ virtual PN_CPP_EXTERN Message getMessage();
+ virtual PN_CPP_EXTERN void setMessage(Message &);
+ private:
+ MessagingEventType_t messagingType;
+ ProtonEvent *parentEvent;
+ Message *message;
+ MessagingEvent operator=(const MessagingEvent&);
+ MessagingEvent(const MessagingEvent&);
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_MESSAGINGEVENT_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
new file mode 100644
index 0000000..ea712a6
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/MessagingHandler.hpp
@@ -0,0 +1,97 @@
+#ifndef PROTON_CPP_MESSAGING_HANDLER_H
+#define PROTON_CPP_MESSAGING_HANDLER_H
+
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "proton/ProtonHandler.hpp"
+#include "proton/Acking.hpp"
+#include "proton/event.h"
+
+namespace proton {
+namespace reactor {
+
+class Event;
+class MessagingAdapter;
+
+class PN_CPP_EXTERN MessagingHandler : public ProtonHandler , public Acking
+{
+ public:
+ PN_CPP_EXTERN MessagingHandler(int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+ bool peerCloseIsError=false);
+ virtual ~MessagingHandler();
+
+ virtual void onAbort(Event &e);
+ virtual void onAccepted(Event &e);
+ virtual void onCommit(Event &e);
+ virtual void onConnectionClosed(Event &e);
+ virtual void onConnectionClosing(Event &e);
+ virtual void onConnectionError(Event &e);
+ virtual void onConnectionOpening(Event &e);
+ virtual void onConnectionOpened(Event &e);
+ virtual void onDisconnected(Event &e);
+ virtual void onFetch(Event &e);
+ virtual void onIdLoaded(Event &e);
+ virtual void onLinkClosed(Event &e);
+ virtual void onLinkClosing(Event &e);
+ virtual void onLinkError(Event &e);
+ virtual void onLinkOpened(Event &e);
+ virtual void onLinkOpening(Event &e);
+ virtual void onMessage(Event &e);
+ virtual void onQuit(Event &e);
+ virtual void onRecordInserted(Event &e);
+ virtual void onRecordsLoaded(Event &e);
+ virtual void onRejected(Event &e);
+ virtual void onReleased(Event &e);
+ virtual void onRequest(Event &e);
+ virtual void onResponse(Event &e);
+ virtual void onSendable(Event &e);
+ virtual void onSessionClosed(Event &e);
+ virtual void onSessionClosing(Event &e);
+ virtual void onSessionError(Event &e);
+ virtual void onSessionOpened(Event &e);
+ virtual void onSessionOpening(Event &e);
+ virtual void onSettled(Event &e);
+ virtual void onStart(Event &e);
+ virtual void onTimer(Event &e);
+ virtual void onTransactionAborted(Event &e);
+ virtual void onTransactionCommitted(Event &e);
+ virtual void onTransactionDeclared(Event &e);
+ virtual void onTransportClosed(Event &e);
+ protected:
+ int prefetch;
+ bool autoAccept;
+ bool autoSettle;
+ bool peerCloseIsError;
+ MessagingAdapter *messagingAdapter;
+ Handler *flowController;
+ PN_CPP_EXTERN MessagingHandler(bool rawHandler, int prefetch=10, bool autoAccept=true, bool autoSettle=true,
+ bool peerCloseIsError=false);
+ private:
+ friend class ContainerImpl;
+ friend class MessagingAdapter;
+ void createHelpers();
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_MESSAGING_HANDLER_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp b/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
new file mode 100644
index 0000000..88358c9
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/ProtonEvent.hpp
@@ -0,0 +1,57 @@
+#ifndef PROTON_CPP_PROTONEVENT_H
+#define PROTON_CPP_PROTONEVENT_H
+
+/*
+ *
+ * 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.
+ *
+ */
+#include "proton/Event.hpp"
+#include "proton/Link.hpp"
+
+namespace proton {
+namespace reactor {
+
+class Handler;
+class Container;
+class Connection;
+class Container;
+
+class ProtonEvent : public Event
+{
+ public:
+ virtual PN_CPP_EXTERN void dispatch(Handler &h);
+ virtual PN_CPP_EXTERN Container &getContainer();
+ virtual PN_CPP_EXTERN Connection &getConnection();
+ virtual PN_CPP_EXTERN Sender getSender();
+ virtual PN_CPP_EXTERN Receiver getReceiver();
+ virtual PN_CPP_EXTERN Link getLink();
+ PN_CPP_EXTERN int getType();
+ PN_CPP_EXTERN pn_event_t* getPnEvent();
+ protected:
+ PN_CPP_EXTERN ProtonEvent(pn_event_t *ce, pn_event_type_t t, Container &c);
+ private:
+ pn_event_t *pnEvent;
+ int type;
+ Container &container;
+};
+
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_PROTONEVENT_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38f57e9d/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
new file mode 100644
index 0000000..1170753
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/ProtonHandle.hpp
@@ -0,0 +1,68 @@
+#ifndef PROTON_CPP_PROTONHANDLE_H
+#define PROTON_CPP_PROTONHANDLE_H
+
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "proton/ImportExport.hpp"
+
+namespace proton {
+namespace reactor {
+
+template <class> class ProtonImplRef;
+
+/**
+ * See Handle.h. Similar but for lightly wrapped Proton pn_object_t targets.
+ */
+template <class T> class ProtonHandle {
+ public:
+
+ /**@return true if handle is valid, i.e. not null. */
+ PROTON_CPP_INLINE_EXTERN bool isValid() const { return impl; }
+
+ /**@return true if handle is null. It is an error to call any function on a null handle. */
+ PROTON_CPP_INLINE_EXTERN bool isNull() const { return !impl; }
+
+ /** Conversion to bool supports idiom if (handle) { handle->... } */
+ PROTON_CPP_INLINE_EXTERN operator bool() const { return impl; }
+
+ /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */
+ PROTON_CPP_INLINE_EXTERN bool operator !() const { return !impl; }
+
+ void swap(ProtonHandle<T>& h) { T* t = h.impl; h.impl = impl; impl = t; }
+
+ private:
+ // Not implemented, subclasses must implement.
+ ProtonHandle(const ProtonHandle&);
+ ProtonHandle& operator=(const ProtonHandle&);
+
+ protected:
+ typedef T Impl;
+ PROTON_CPP_INLINE_EXTERN ProtonHandle() :impl() {}
+
+ Impl* impl;
+
+ friend class ProtonImplRef<T>;
+};
+
+}} // namespace proton::reactor
+
+#endif /*!PROTON_CPP_PROTONHANDLE_H*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org