qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: PROTON-990 [C++ binding] Examples fail to link in Visual Studio 2012, 2015
Date Wed, 09 Sep 2015 21:12:45 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master c7710b4ed -> 6980703c4


PROTON-990 [C++ binding] Examples fail to link in Visual Studio 2012, 2015

Function return value types (PN_UNIQUE_PTR) were dependent on compile-settings, possible to
inconsistent settings between examples and library caused link failures. Replaced with a stable
return type (pn_unique_ptr) that converts to std::unique_ptr and std::auto_ptr.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/6980703c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/6980703c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/6980703c

Branch: refs/heads/master
Commit: 6980703c47263b9910a84411705ef2a7d6a59e90
Parents: c7710b4
Author: Alan Conway <aconway@redhat.com>
Authored: Wed Sep 9 17:02:51 2015 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Wed Sep 9 17:12:33 2015 -0400

----------------------------------------------------------------------
 examples/cpp/CMakeLists.txt                     |  2 +
 proton-c/bindings/cpp/CMakeLists.txt            | 19 +-----
 .../cpp/include/proton/blocking_connection.hpp  |  6 +-
 .../cpp/include/proton/blocking_receiver.hpp    |  8 +--
 proton-c/bindings/cpp/include/proton/config.hpp | 17 ++++--
 .../bindings/cpp/include/proton/container.hpp   |  4 +-
 proton-c/bindings/cpp/include/proton/data.hpp   | 11 ++--
 proton-c/bindings/cpp/include/proton/memory.hpp | 33 -----------
 .../bindings/cpp/include/proton/message.hpp     |  8 +--
 .../cpp/include/proton/messaging_handler.hpp    |  4 +-
 .../cpp/include/proton/pn_unique_ptr.hpp        | 62 ++++++++++++++++++++
 .../bindings/cpp/include/proton/reactor.hpp     |  4 +-
 .../include/proton/sync_request_response.hpp    | 10 ++--
 .../cpp/src/blocking_connection_impl.hpp        |  2 +-
 proton-c/bindings/cpp/src/container_impl.cpp    |  2 +-
 proton-c/bindings/cpp/src/container_impl.hpp    |  8 +--
 proton-c/bindings/cpp/src/contexts.hpp          |  4 +-
 proton-c/bindings/cpp/src/conversion_test.cpp   | 36 ++++++++----
 proton-c/bindings/cpp/src/data.cpp              |  2 +-
 proton-c/bindings/cpp/src/message.cpp           |  2 +-
 proton-c/bindings/cpp/src/reactor.cpp           |  4 +-
 21 files changed, 144 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 77cc9c5..a367710 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+include(${CMAKE_SOURCE_DIR}/cpp.cmake) # Compiler checks
+
 include_directories(
   "${CMAKE_SOURCE_DIR}/proton-c/include"
   "${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include")

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index df770fa..7a4e804 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -17,24 +17,7 @@
 # under the License.
 #
 
-include(CheckCXXSourceCompiles)
-
-# Check compiler capabilities.
-set(CMAKE_REQUIRED_FLAGS "${CXX_WARNING_FLAGS}")
-check_cxx_source_compiles("long long ll; int main(int, char**) { return 0; }" HAS_LONG_LONG)
-if (HAS_LONG_LONG)
-  add_definitions(-DPN_HAS_LONG_LONG=1)
-endif()
-check_cxx_source_compiles("#include <memory>\nstd::shared_ptr<int> i; std::unique_ptr<int>
u; int main(int, char**) { return 0; }" HAS_STD_PTR)
-if (HAS_STD_PTR)
-  add_definitions(-DPN_HAS_STD_PTR=1)
-endif()
-
-# Check for boost
-find_path(BOOST_INCLUDE_DIR boost/shared_ptr.hpp PATH_SUFFIXES include)
-if (BOOST_INCLUDE_DIR)
-  add_definitions(-DPN_HAS_BOOST=1)
-endif()
+include(${CMAKE_SOURCE_DIR}/cpp.cmake) # Compiler checks
 
 include_directories(
   "${CMAKE_SOURCE_DIR}/proton-c/include"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
index f9e2a99..d6db1e2 100644
--- a/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
+++ b/proton-c/bindings/cpp/include/proton/blocking_connection.hpp
@@ -22,10 +22,10 @@
  *
  */
 
-#include "proton/memory.hpp"
+#include "proton/pn_unique_ptr.hpp"
 #include "proton/export.hpp"
 #include "proton/duration.hpp"
-#include "proton/memory.hpp"
+#include "proton/pn_unique_ptr.hpp"
 
 #include <string>
 
@@ -49,7 +49,7 @@ class blocking_connection
     blocking_connection(const blocking_connection&);
     blocking_connection& operator=(const blocking_connection&);
 
-    PN_UNIQUE_PTR<blocking_connection_impl> impl_;
+    pn_unique_ptr<blocking_connection_impl> impl_;
 
   friend class blocking_link;
   friend class blocking_sender;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp b/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp
index 0057cef..ac4a0b4 100644
--- a/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp
+++ b/proton-c/bindings/cpp/include/proton/blocking_receiver.hpp
@@ -21,11 +21,11 @@
  * under the License.
  *
  */
-#include "proton/memory.hpp"
-#include "proton/export.hpp"
+#include "proton/blocking_link.hpp"
 #include "proton/delivery.hpp"
+#include "proton/export.hpp"
 #include "proton/message.hpp"
-#include "proton/blocking_link.hpp"
+#include "proton/pn_unique_ptr.hpp"
 
 #include <string>
 
@@ -54,7 +54,7 @@ class blocking_receiver : public blocking_link
 
     PN_CPP_EXTERN class receiver& receiver();
   private:
-    PN_UNIQUE_PTR<blocking_fetcher> fetcher_;
+    pn_unique_ptr<blocking_fetcher> fetcher_;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/config.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/config.hpp b/proton-c/bindings/cpp/include/proton/config.hpp
index 178b6db..9237138 100644
--- a/proton-c/bindings/cpp/include/proton/config.hpp
+++ b/proton-c/bindings/cpp/include/proton/config.hpp
@@ -21,11 +21,10 @@
 
 /**@file
  *
- * Configuration macros, can be set via -D compiler options or in code. 
+ * Configuration macros, can be set via -D compiler options or in code.
  *
- * - PN_HAS_BOOST - include support for boost::shared_ptr and boost::intrusive_ptr
- * - PN_HAS_STD_PTR - include support for c++11 std::shared_ptr and std::unique_ptr
- * - PN_HAS_LONG_LONG - include support for the 'long long' type.
+ * On a C++11 compliant compiler, all C++11 features are enabled by default.
+ * Otherwise they can be enabled or disabled separately with -D on the compile line.
  */
 
 #if ((defined(__cplusplus) && __cplusplus >= 201100))
@@ -44,8 +43,18 @@
 #define PN_HAS_STATIC_ASSERT 1
 #endif
 
+#ifndef PN_NOEXCEPT
+#define PN_NOEXCEPT noexcept
 #endif
 
+#else  // C++11
+
+#ifndef PN_NOEXCEPT
+#define PN_NOEXCEPT
+#endif
+
+#endif // C++11
+
 #if defined(BOOST_VERSION)
 
 #ifndef PN_HAS_BOOST

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/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
index dc87082..78d8239 100644
--- a/proton-c/bindings/cpp/include/proton/container.hpp
+++ b/proton-c/bindings/cpp/include/proton/container.hpp
@@ -23,9 +23,9 @@
  */
 #include "proton/duration.hpp"
 #include "proton/export.hpp"
+#include "proton/pn_unique_ptr.hpp"
 #include "proton/reactor.hpp"
 #include "proton/url.hpp"
-#include "proton/memory.hpp"
 
 #include <string>
 
@@ -82,7 +82,7 @@ class container
     PN_CPP_EXTERN class reactor& reactor();
 
   private:
-    PN_UNIQUE_PTR<container_impl> impl_;
+    pn_unique_ptr<container_impl> impl_;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/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
index 98d3973..f7fde1b 100644
--- a/proton-c/bindings/cpp/include/proton/data.hpp
+++ b/proton-c/bindings/cpp/include/proton/data.hpp
@@ -19,11 +19,12 @@
  * under the License.
  */
 
-#include "proton/export.hpp"
-#include "proton/facade.hpp"
 #include "proton/decoder.hpp"
 #include "proton/encoder.hpp"
-#include "proton/memory.hpp"
+#include "proton/export.hpp"
+#include "proton/facade.hpp"
+#include "proton/pn_unique_ptr.hpp"
+
 #include <iosfwd>
 
 struct pn_data_t;
@@ -38,7 +39,7 @@ class data;
  */
 class data : public facade<pn_data_t, data, comparable<data> > {
   public:
-    PN_CPP_EXTERN static PN_UNIQUE_PTR<data> create();
+    PN_CPP_EXTERN static pn_unique_ptr<data> create();
 
     PN_CPP_EXTERN data& operator=(const data&);
     template<class T> data& operator=(const T &t) {
@@ -122,7 +123,7 @@ class data_value {
       return o << *dv.data_;
   }
   private:
-    PN_UNIQUE_PTR<data> data_;
+    pn_unique_ptr<data> data_;
 };
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/memory.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/memory.hpp b/proton-c/bindings/cpp/include/proton/memory.hpp
deleted file mode 100644
index 6102831..0000000
--- a/proton-c/bindings/cpp/include/proton/memory.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef UNIQUE_PTR_HPP
-#define UNIQUE_PTR_HPP
-/*
- * 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/config.hpp"
-#include <memory>
-
-#if PN_HAS_STD_PTR
-// Simple ownership pointer, use std::unique_ptr in C++11 std::auto_ptr otherwise.
-#define PN_UNIQUE_PTR std::unique_ptr
-#else
-// Simple ownership pointer, use std::unique_ptr in C++11 std::auto_ptr otherwise.
-#define PN_UNIQUE_PTR std::auto_ptr
-#endif
-
-#endif // UNIQUE_PTR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/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
index d04ee1a..be2485f 100644
--- a/proton-c/bindings/cpp/include/proton/message.hpp
+++ b/proton-c/bindings/cpp/include/proton/message.hpp
@@ -21,10 +21,10 @@
  * under the License.
  *
  */
-#include "proton/export.hpp"
 #include "proton/data.hpp"
+#include "proton/export.hpp"
 #include "proton/facade.hpp"
-#include "proton/memory.hpp"
+#include "proton/pn_unique_ptr.hpp"
 
 #include <string>
 
@@ -39,7 +39,7 @@ class delivery;
 class message : public facade<pn_message_t, message>
 {
   public:
-    PN_CPP_EXTERN static PN_UNIQUE_PTR<message> create();
+    PN_CPP_EXTERN static pn_unique_ptr<message> create();
 
     /// Copy data from m to this.
     PN_CPP_EXTERN message& operator=(const message& m);
@@ -217,7 +217,7 @@ class message_value {
     void swap(message_value& x);
 
   private:
-    PN_UNIQUE_PTR<class message> message_;
+    pn_unique_ptr<class message> message_;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
index 389b73f..af5d78b 100644
--- a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
@@ -95,8 +95,8 @@ class messaging_handler : public proton_handler
     bool auto_accept_;
     bool auto_settle_;
     bool peer_close_iserror_;
-    PN_UNIQUE_PTR<messaging_adapter> messaging_adapter_;
-    PN_UNIQUE_PTR<handler> flow_controller_;
+    pn_unique_ptr<messaging_adapter> messaging_adapter_;
+    pn_unique_ptr<handler> flow_controller_;
     PN_CPP_EXTERN messaging_handler(
         bool raw_handler, int prefetch=10, bool auto_accept=true,
         bool auto_settle=true, bool peer_close_is_error=false);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/pn_unique_ptr.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/pn_unique_ptr.hpp b/proton-c/bindings/cpp/include/proton/pn_unique_ptr.hpp
new file mode 100644
index 0000000..b94667f
--- /dev/null
+++ b/proton-c/bindings/cpp/include/proton/pn_unique_ptr.hpp
@@ -0,0 +1,62 @@
+#ifndef UNIQUE_PTR_HPP
+#define UNIQUE_PTR_HPP
+/*
+ * 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/config.hpp"
+#include <memory>
+
+namespace proton {
+
+/**
+ * A simple unique ownership pointer, used as a return value from functions that
+ * transfer ownership to the caller.
+ *
+ * pn_unique_ptr return values should be converted immediately to
+ * std::unique_ptr if that is available or std::auto_ptr (by calling release())
+ * for older C++. You should not use pn_unique_ptr in your own code, it is a
+ * limited pointer class designed only to work around differences between C++11
+ * and C++03.
+ */
+template <class T> class pn_unique_ptr {
+  public:
+    pn_unique_ptr(T* p=0) : ptr_(p) {}
+#if PN_HAS_CPP11
+    pn_unique_ptr(pn_unique_ptr&& x) : ptr_(0)  { swap(x); }
+#else
+    pn_unique_ptr(const pn_unique_ptr& x) : ptr_() { swap(const_cast<pn_unique_ptr<T>&>(x));
}
+#endif
+    ~pn_unique_ptr() { delete(ptr_); }
+    T& operator*() const { return *ptr_; }
+    T* operator->() const { return ptr_; }
+    T* get() const { return ptr_; }
+    void swap(pn_unique_ptr<T>& x) { T *p = x.ptr_; x.ptr_ = ptr_; ptr_ = p; }
+    void reset(T* p = 0) { pn_unique_ptr<T> tmp(p); tmp.swap(*this); }
+    T* release() { T *p = ptr_; ptr_ = 0; return p; }
+
+#if PN_HAS_STD_PTR
+    operator std::unique_ptr<T>() { T *p = ptr_; ptr_ = 0; return std::unique_ptr<T>(p);
}
+#endif
+
+  private:
+    T* ptr_;
+};
+
+}
+#endif // UNIQUE_PTR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/reactor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/reactor.hpp b/proton-c/bindings/cpp/include/proton/reactor.hpp
index 37dec6e..401c7dc 100644
--- a/proton-c/bindings/cpp/include/proton/reactor.hpp
+++ b/proton-c/bindings/cpp/include/proton/reactor.hpp
@@ -21,7 +21,7 @@
 
 #include "proton/facade.hpp"
 #include "proton/duration.hpp"
-#include "proton/memory.hpp"
+#include "proton/pn_unique_ptr.hpp"
 
 struct pn_reactor_t;
 
@@ -35,7 +35,7 @@ class handler;
 class reactor : public facade<pn_reactor_t, reactor> {
  public:
     /** Create a new reactor. */
-    PN_CPP_EXTERN static PN_UNIQUE_PTR<reactor> create();
+    PN_CPP_EXTERN static pn_unique_ptr<reactor> create();
 
     /** Open a connection @see connection::open  */
     PN_CPP_EXTERN connection& connect(const proton::url&, handler *h=0);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/include/proton/sync_request_response.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/sync_request_response.hpp b/proton-c/bindings/cpp/include/proton/sync_request_response.hpp
index 8c54d64..c1f47df 100644
--- a/proton-c/bindings/cpp/include/proton/sync_request_response.hpp
+++ b/proton-c/bindings/cpp/include/proton/sync_request_response.hpp
@@ -21,11 +21,11 @@
  * under the License.
  *
  */
-#include "proton/export.hpp"
-#include "proton/messaging_handler.hpp"
 #include "proton/blocking_receiver.hpp"
 #include "proton/blocking_sender.hpp"
-#include "proton/memory.hpp"
+#include "proton/export.hpp"
+#include "proton/messaging_handler.hpp"
+#include "proton/pn_unique_ptr.hpp"
 
 #include <string>
 
@@ -53,8 +53,8 @@ class sync_request_response
   private:
     blocking_connection &connection_;
     std::string address_;
-    PN_UNIQUE_PTR<blocking_sender> sender_;
-    PN_UNIQUE_PTR<blocking_receiver> receiver_;
+    pn_unique_ptr<blocking_sender> sender_;
+    pn_unique_ptr<blocking_receiver> receiver_;
     amqp_ulong correlation_id_;
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/blocking_connection_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/blocking_connection_impl.hpp b/proton-c/bindings/cpp/src/blocking_connection_impl.hpp
index d3570b9..319b544 100644
--- a/proton-c/bindings/cpp/src/blocking_connection_impl.hpp
+++ b/proton-c/bindings/cpp/src/blocking_connection_impl.hpp
@@ -50,7 +50,7 @@ class blocking_connection_impl : public messaging_handler
 
     void wait(const condition&, const std::string & ="", duration=duration(-1));
 
-    PN_UNIQUE_PTR<container> container_;
+    pn_unique_ptr<container> container_;
     counted_ptr<connection> connection_;
 };
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp
index 75293f1..a13d961 100644
--- a/proton-c/bindings/cpp/src/container_impl.cpp
+++ b/proton-c/bindings/cpp/src/container_impl.cpp
@@ -133,7 +133,7 @@ connection& container_impl::connect(const proton::url &url, handler
*h) {
     counted_ptr<pn_handler_t> chandler = h ? cpp_handler(h) : counted_ptr<pn_handler_t>();
     connection& conn(           // Reactor owns the reference.
         *connection::cast(pn_reactor_connection(pn_cast(reactor_.get()), chandler.get())));
-    PN_UNIQUE_PTR<connector> ctor(new connector(conn));
+    pn_unique_ptr<connector> ctor(new connector(conn));
     ctor->address(url);  // TODO: url vector
     connection_context& cc(connection_context::get(pn_cast(&conn)));
     cc.container_impl = this;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/container_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.hpp b/proton-c/bindings/cpp/src/container_impl.hpp
index f02e36e..dda41e7 100644
--- a/proton-c/bindings/cpp/src/container_impl.hpp
+++ b/proton-c/bindings/cpp/src/container_impl.hpp
@@ -60,11 +60,11 @@ class container_impl
   private:
 
     container& container_;
-    PN_UNIQUE_PTR<reactor> reactor_;
+    pn_unique_ptr<reactor> reactor_;
     handler *handler_;
-    PN_UNIQUE_PTR<messaging_adapter> messaging_adapter_;
-    PN_UNIQUE_PTR<handler> override_handler_;
-    PN_UNIQUE_PTR<handler> flow_controller_;
+    pn_unique_ptr<messaging_adapter> messaging_adapter_;
+    pn_unique_ptr<handler> override_handler_;
+    pn_unique_ptr<handler> flow_controller_;
     std::string container_id_;
     uint64_t link_id_;
     std::string prefix_;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/contexts.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/contexts.hpp b/proton-c/bindings/cpp/src/contexts.hpp
index 2285245..80e3d00 100644
--- a/proton-c/bindings/cpp/src/contexts.hpp
+++ b/proton-c/bindings/cpp/src/contexts.hpp
@@ -23,8 +23,8 @@
  */
 
 #include "proton/counted.hpp"
+#include "proton/pn_unique_ptr.hpp"
 #include "proton/reactor.h"
-#include "proton/memory.hpp"
 #include "proton/session.hpp"
 
 #include <proton/message.h>
@@ -44,7 +44,7 @@ struct connection_context : public counted {
     connection_context();
     ~connection_context();
 
-    PN_UNIQUE_PTR<class handler> handler;
+    pn_unique_ptr<class handler> handler;
     session* default_session;   // Owned by connection
     class container_impl* container_impl;
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/conversion_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/conversion_test.cpp b/proton-c/bindings/cpp/src/conversion_test.cpp
index 84c96f4..904c6e8 100644
--- a/proton-c/bindings/cpp/src/conversion_test.cpp
+++ b/proton-c/bindings/cpp/src/conversion_test.cpp
@@ -51,24 +51,40 @@ void test_auto() {
     std::auto_ptr<session> p(s.ptr().release());
 }
 
+void test_pn_unique() {
+    std::auto_ptr<message> a(message::create().release());
+    a->clear();
+#if PN_HAS_STD_PTR
+    std::unique_ptr<message> u = message::create();
+    u->clear();
+#endif
+}
+
 int main(int argc, char** argv) {
     int failed = 0;
     failed += run_test(&test_counted<counted_ptr<connection>,
                        counted_ptr<session> >, "counted");
 
-    
-
 #if PN_HAS_STD_PTR
-    failed += run_test(&test_owning<std::shared_ptr<connection>,
-                       std::shared_ptr<session> >, "std::shared");
-    failed += run_test(&test_owning<std::unique_ptr<connection>,
-                       std::unique_ptr<session> >, "std::unique");
+    failed += run_test(&test_owning<
+                       std::shared_ptr<connection>,
+                       std::shared_ptr<session> >,
+                       "std::shared");
+    failed += run_test(&test_owning<
+                       std::unique_ptr<connection>,
+                       std::unique_ptr<session> >,
+                       "std::unique");
 #endif
 #if PN_HAS_BOOST
-    failed += run_test(&test_owning<boost::shared_ptr<connection>,
-                       boost::shared_ptr<session> >, "boost::shared");
-    failed += run_test(&test_counted<boost::intrusive_ptr<connection>,
-                       boost::intrusive_ptr<session> >, "boost::intrusive");
+    failed += run_test(&test_owning<
+                       boost::shared_ptr<connection>,
+                       boost::shared_ptr<session> >,
+                       "boost::shared");
+    failed += run_test(&test_counted<
+                       boost::intrusive_ptr<connection>,
+                       boost::intrusive_ptr<session> >,
+                       "boost::intrusive");
 #endif
+    failed += run_test(&test_pn_unique, "pn_unique_ptr");
     return failed;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/data.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/data.cpp b/proton-c/bindings/cpp/src/data.cpp
index fd11eaa..2cc9279 100644
--- a/proton-c/bindings/cpp/src/data.cpp
+++ b/proton-c/bindings/cpp/src/data.cpp
@@ -34,7 +34,7 @@ bool data::empty() const { return ::pn_data_size(pn_cast(this)) == 0; }
 
 std::ostream& operator<<(std::ostream& o, const data& d) { return o <<
inspectable(pn_cast(&d)); }
 
-PN_UNIQUE_PTR<data> data::create() { return PN_UNIQUE_PTR<data>(cast(::pn_data(0)));
}
+pn_unique_ptr<data> data::create() { return pn_unique_ptr<data>(cast(::pn_data(0)));
}
 
 encoder& data::encoder() { return reinterpret_cast<class encoder&>(*this);
}
 decoder& data::decoder() { return reinterpret_cast<class decoder&>(*this);
}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/message.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/message.cpp b/proton-c/bindings/cpp/src/message.cpp
index 9b26bac..a68addf 100644
--- a/proton-c/bindings/cpp/src/message.cpp
+++ b/proton-c/bindings/cpp/src/message.cpp
@@ -37,7 +37,7 @@ namespace proton {
 
 void message::operator delete(void *p) { ::pn_message_free(reinterpret_cast<pn_message_t*>(p));
}
 
-PN_UNIQUE_PTR<message> message::create() { return PN_UNIQUE_PTR<message>(cast(::pn_message()));
}
+pn_unique_ptr<message> message::create() { return pn_unique_ptr<message>(cast(::pn_message()));
}
 
 message& message::operator=(const message& m) {
     // TODO aconway 2015-08-10: need more efficient pn_message_copy function

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6980703c/proton-c/bindings/cpp/src/reactor.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/reactor.cpp b/proton-c/bindings/cpp/src/reactor.cpp
index d68535d..fcef673 100644
--- a/proton-c/bindings/cpp/src/reactor.cpp
+++ b/proton-c/bindings/cpp/src/reactor.cpp
@@ -23,8 +23,8 @@
 
 namespace proton {
 
-PN_UNIQUE_PTR<reactor> reactor::create() {
-    return PN_UNIQUE_PTR<reactor>(reactor::cast(pn_reactor()));
+pn_unique_ptr<reactor> reactor::create() {
+    return pn_unique_ptr<reactor>(reactor::cast(pn_reactor()));
 }
 
 void reactor::run() { pn_reactor_run(pn_cast(this)); }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message