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 2016/11/02 02:53:52 UTC

[32/50] [abbrv] qpid-proton git commit: PROTON-1319: C++ SunStudo: Move internal header files of cpp bindings

PROTON-1319: C++ SunStudo: Move internal header files of cpp bindings

Sun compiler searches all include paths to build template-DB, creates problems
if from src files are in the path.

Signed-off-by: aboutros <ad...@murex.com>


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

Branch: refs/heads/go1
Commit: 8c3aa3a5155432b5a94ff830481f0663caddce89
Parents: 7952786
Author: aboutros <ad...@murex.com>
Authored: Fri Oct 7 12:26:10 2016 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Oct 20 08:13:52 2016 -0400

----------------------------------------------------------------------
 proton-c/bindings/cpp/CMakeLists.txt            |   2 +-
 proton-c/bindings/cpp/src/acceptor.hpp          |  62 ----
 proton-c/bindings/cpp/src/connector.hpp         |  65 ----
 proton-c/bindings/cpp/src/container_impl.hpp    | 124 --------
 proton-c/bindings/cpp/src/contexts.hpp          | 137 ---------
 proton-c/bindings/cpp/src/include/acceptor.hpp  |  62 ++++
 proton-c/bindings/cpp/src/include/connector.hpp |  65 ++++
 .../bindings/cpp/src/include/container_impl.hpp | 124 ++++++++
 proton-c/bindings/cpp/src/include/contexts.hpp  | 137 +++++++++
 .../cpp/src/include/messaging_adapter.hpp       |  62 ++++
 proton-c/bindings/cpp/src/include/msg.hpp       |  58 ++++
 .../bindings/cpp/src/include/proton_bits.hpp    | 149 ++++++++++
 .../bindings/cpp/src/include/proton_event.hpp   | 293 +++++++++++++++++++
 .../bindings/cpp/src/include/proton_handler.hpp |  92 ++++++
 proton-c/bindings/cpp/src/include/reactor.hpp   | 106 +++++++
 .../bindings/cpp/src/include/scalar_test.hpp    | 209 +++++++++++++
 proton-c/bindings/cpp/src/include/test_bits.hpp | 136 +++++++++
 .../cpp/src/include/test_dummy_container.hpp    |  83 ++++++
 .../bindings/cpp/src/include/types_internal.hpp |  74 +++++
 proton-c/bindings/cpp/src/messaging_adapter.hpp |  62 ----
 proton-c/bindings/cpp/src/msg.hpp               |  58 ----
 proton-c/bindings/cpp/src/proton_bits.hpp       | 149 ----------
 proton-c/bindings/cpp/src/proton_event.hpp      | 293 -------------------
 proton-c/bindings/cpp/src/proton_handler.hpp    |  92 ------
 proton-c/bindings/cpp/src/reactor.hpp           | 106 -------
 proton-c/bindings/cpp/src/scalar_test.hpp       | 209 -------------
 proton-c/bindings/cpp/src/test_bits.hpp         | 136 ---------
 .../bindings/cpp/src/test_dummy_container.hpp   |  83 ------
 proton-c/bindings/cpp/src/types_internal.hpp    |  74 -----
 29 files changed, 1651 insertions(+), 1651 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 7709bae..ed969eb 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -22,7 +22,7 @@ include(cpp.cmake) # Compiler checks
 include_directories(
   "${CMAKE_SOURCE_DIR}/proton-c/include"
   "${CMAKE_CURRENT_SOURCE_DIR}/include"
-  "${CMAKE_CURRENT_SOURCE_DIR}/src")
+  "${CMAKE_CURRENT_SOURCE_DIR}/src/include")
 
 add_definitions(${CXX_WARNING_FLAGS})
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/acceptor.hpp b/proton-c/bindings/cpp/src/acceptor.hpp
deleted file mode 100644
index 9a25592..0000000
--- a/proton-c/bindings/cpp/src/acceptor.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef PROTON_ACCEPTOR_HPP
-#define PROTON_ACCEPTOR_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/internal/export.hpp"
-#include "proton/internal/object.hpp"
-
-#include <proton/reactor.h>
-
-struct pn_acceptor_t;
-
-namespace proton {
-
-/// A context for accepting inbound connections.
-///
-/// @see container::listen
-class acceptor : public internal::object<pn_acceptor_t> {
-    /// @cond INTERNAL
-    acceptor(pn_acceptor_t* a) : internal::object<pn_acceptor_t>(a) {}
-    /// @endcond
-
-  public:
-    acceptor() : internal::object<pn_acceptor_t>(0) {}
-
-    /// Close the acceptor.
-    PN_CPP_EXTERN void close();
-
-    /// Return the current set of connection options applied to
-    /// inbound connectons by the acceptor.
-    ///
-    /// Note that changes made to the connection options only affect
-    /// connections accepted after this call returns.
-    PN_CPP_EXTERN class connection_options &connection_options();
-
-    /// @cond INTERNAL
-  friend class internal::factory<acceptor>;
-    /// @endcond
-};
-
-} // proton
-
-#endif // PROTON_ACCEPTOR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/connector.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/connector.hpp b/proton-c/bindings/cpp/src/connector.hpp
deleted file mode 100644
index 5b6707a..0000000
--- a/proton-c/bindings/cpp/src/connector.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef PROTON_CPP_CONNECTOR_HANDLER_H
-#define PROTON_CPP_CONNECTOR_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/connection.hpp"
-#include "proton/connection_options.hpp"
-#include <proton/event.h>
-#include <proton/reactor.h>
-#include "proton/url.hpp"
-
-#include "proton_handler.hpp"
-
-#include <string>
-
-
-namespace proton {
-
-class reconnect_timer;
-
-class connector : public proton_handler
-{
-  public:
-    connector(connection &c, const connection_options &options, const url&);
-    ~connector();
-    const url &address() const { return address_; }
-    void connect();
-    void reconnect_timer(const class reconnect_timer &);
-    virtual void on_connection_local_open(proton_event &e);
-    virtual void on_connection_remote_open(proton_event &e);
-    virtual void on_connection_init(proton_event &e);
-    virtual void on_transport_closed(proton_event &e);
-    virtual void on_transport_tail_closed(proton_event &e);
-    virtual void on_timer_task(proton_event &e);
-
-  private:
-    connection connection_;
-    const connection_options options_;
-    const url address_;
-    class reconnect_timer *reconnect_timer_;
-};
-
-
-}
-
-#endif  /*!PROTON_CPP_CONNECTOR_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/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
deleted file mode 100644
index 97f6be2..0000000
--- a/proton-c/bindings/cpp/src/container_impl.hpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef PROTON_CPP_CONTAINERIMPL_H
-#define PROTON_CPP_CONTAINERIMPL_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/io/link_namer.hpp"
-
-#include "proton/container.hpp"
-#include "proton/connection.hpp"
-#include "proton/connection_options.hpp"
-#include "proton/duration.hpp"
-#include "proton/sender.hpp"
-#include "proton/receiver.hpp"
-
-#include "messaging_adapter.hpp"
-#include "reactor.hpp"
-#include "proton_bits.hpp"
-#include "proton_handler.hpp"
-
-#include <list>
-#include <map>
-#include <string>
-
-namespace proton {
-
-class dispatch_helper;
-class connection;
-class connector;
-class acceptor;
-class container;
-class url;
-class task;
-class listen_handler;
-
-class container_impl : public standard_container {
-  public:
-    // Pull in base class functions here so that name search finds all the overloads
-    using standard_container::stop;
-    using standard_container::connect;
-    using standard_container::listen;
-    using standard_container::open_receiver;
-    using standard_container::open_sender;
-
-    container_impl(const std::string& id, messaging_handler* = 0);
-    ~container_impl();
-    std::string id() const PN_CPP_OVERRIDE { return id_; }
-    returned<connection> connect(const std::string&, const connection_options&) PN_CPP_OVERRIDE;
-    returned<sender> open_sender(
-        const std::string&, const proton::sender_options &, const connection_options &) PN_CPP_OVERRIDE;
-    returned<receiver> open_receiver(
-        const std::string&, const proton::receiver_options &, const connection_options &) PN_CPP_OVERRIDE;
-    listener listen(const std::string&, listen_handler& lh) PN_CPP_OVERRIDE;
-    void stop_listening(const std::string&) PN_CPP_OVERRIDE;
-    void client_connection_options(const connection_options &) PN_CPP_OVERRIDE;
-    connection_options client_connection_options() const PN_CPP_OVERRIDE { return client_connection_options_; }
-    void server_connection_options(const connection_options &) PN_CPP_OVERRIDE;
-    connection_options server_connection_options() const PN_CPP_OVERRIDE { return server_connection_options_; }
-    void sender_options(const proton::sender_options&) PN_CPP_OVERRIDE;
-    class sender_options sender_options() const PN_CPP_OVERRIDE { return sender_options_; }
-    void receiver_options(const proton::receiver_options&) PN_CPP_OVERRIDE;
-    class receiver_options receiver_options() const PN_CPP_OVERRIDE { return receiver_options_; }
-    void run() PN_CPP_OVERRIDE;
-    void stop(const error_condition& err) PN_CPP_OVERRIDE;
-    void auto_stop(bool set) PN_CPP_OVERRIDE;
-#if PN_CPP_HAS_STD_FUNCTION
-    void schedule(duration, std::function<void()>) PN_CPP_OVERRIDE;
-#endif
-    void schedule(duration, void_function0&) PN_CPP_OVERRIDE;
-
-    // non-interface functions
-    void configure_server_connection(connection &c);
-    static task schedule(container& c, int delay, proton_handler *h);
-    template <class T> static void set_handler(T s, messaging_handler* h);
-
-  private:
-    internal::pn_ptr<pn_handler_t> cpp_handler(proton_handler *h);
-
-    typedef std::map<std::string, acceptor> acceptors;
-
-    reactor reactor_;
-    // Keep a list of all the handlers used by the container so they last as long as the container
-    std::list<internal::pn_unique_ptr<proton_handler> > handlers_;
-    std::string id_;
-    connection_options client_connection_options_;
-    connection_options server_connection_options_;
-    proton::sender_options sender_options_;
-    proton::receiver_options receiver_options_;
-    bool auto_stop_;
-    acceptors acceptors_;
-
-  friend class messaging_adapter;
-};
-
-template <class T>
-void container_impl::set_handler(T s, messaging_handler* mh) {
-    pn_record_t *record = internal::get_attachments(unwrap(s));
-    proton_handler* h = new messaging_adapter(*mh);
-    container_impl& ci = static_cast<container_impl&>(s.container());
-    ci.handlers_.push_back(h);
-    pn_record_set_handler(record, ci.cpp_handler(h).get());
-}
-
-}
-
-#endif  /*!PROTON_CPP_CONTAINERIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/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
deleted file mode 100644
index 74a763c..0000000
--- a/proton-c/bindings/cpp/src/contexts.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef PROTON_CPP_CONTEXTS_H
-#define PROTON_CPP_CONTEXTS_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/connection.hpp"
-#include "proton/container.hpp"
-#include "proton/io/connection_engine.hpp"
-#include "proton/event_loop.hpp"
-#include "proton/listen_handler.hpp"
-#include "proton/message.hpp"
-#include "proton/internal/pn_unique_ptr.hpp"
-
-#include "proton/io/link_namer.hpp"
-
-#include "proton_handler.hpp"
-
-struct pn_session_t;
-struct pn_event_t;
-struct pn_reactor_t;
-struct pn_record_t;
-struct pn_acceptor_t;
-
-namespace proton {
-
-class proton_handler;
-class reactor;
-
-// Base class for C++ classes that are used as proton contexts.
-// Contexts are pn_objects managed by pn reference counts, the C++ value is allocated in-place.
-class context {
-  public:
-    // identifies a context, contains a record pointer and a handle.
-    typedef std::pair<pn_record_t*, pn_handle_t> id;
-
-    virtual ~context();
-
-    // Allocate a default-constructed T as a proton object.
-    // T must be a subclass of context.
-    template <class T> static T *create() { return new(alloc(sizeof(T))) T(); }
-
-    // The pn_class for a context
-    static pn_class_t* pn_class();
-
-    // Get the context identified by id as a C++ T*, return null pointer if not present.
-    template <class T> static T* ptr(id id_) {
-        return reinterpret_cast<T*>(pn_record_get(id_.first, id_.second));
-    }
-
-    // If the context is not present, create it with value x.
-    template <class T> static T& ref(id id_) {
-        T* ctx = context::ptr<T>(id_);
-        if (!ctx) {
-            ctx = create<T>();
-            pn_record_def(id_.first, id_.second, pn_class());
-            pn_record_set(id_.first, id_.second, ctx);
-            pn_decref(ctx);
-        }
-        return *ctx;
-    }
-
-  private:
-    static void *alloc(size_t n);
-};
-
-// Connection context used by all connections.
-class connection_context : public context {
-  public:
-    connection_context() : container(0), default_session(0), link_gen(0), collector(0) {}
-
-    class container* container;
-    pn_session_t *default_session; // Owned by connection.
-    message event_message;      // re-used by messaging_adapter for performance.
-    io::link_namer* link_gen;      // Link name generator.
-    pn_collector_t* collector;
-
-    internal::pn_unique_ptr<proton_handler> handler;
-    internal::pn_unique_ptr<class event_loop> event_loop;
-
-    static connection_context& get(pn_connection_t *c) { return ref<connection_context>(id(c)); }
-    static connection_context& get(const connection& c) { return ref<connection_context>(id(c)); }
-
-  protected:
-    static context::id id(pn_connection_t*);
-    static context::id id(const connection& c);
-};
-
-void container_context(const reactor&, container&);
-
-class container_context {
-  public:
-    static void set(const reactor& r, container& c);
-    static container& get(pn_reactor_t*);
-};
-
-class listener_context : public context {
-  public:
-    static listener_context& get(pn_acceptor_t* c);
-    listener_context() : listen_handler_(0), ssl(false) {}
-    connection_options  get_options() { return listen_handler_->on_accept(); }
-    class listen_handler* listen_handler_;
-    bool ssl;
-};
-
-class link_context : public context {
-  public:
-    static link_context& get(pn_link_t* l);
-    link_context() : credit_window(10), auto_accept(true), auto_settle(true), draining(false), pending_credit(0) {}
-    int credit_window;
-    bool auto_accept;
-    bool auto_settle;
-    bool draining;
-    uint32_t pending_credit;
-};
-
-}
-
-#endif  /*!PROTON_CPP_CONTEXTS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/acceptor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/acceptor.hpp b/proton-c/bindings/cpp/src/include/acceptor.hpp
new file mode 100644
index 0000000..9a25592
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/acceptor.hpp
@@ -0,0 +1,62 @@
+#ifndef PROTON_ACCEPTOR_HPP
+#define PROTON_ACCEPTOR_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/internal/export.hpp"
+#include "proton/internal/object.hpp"
+
+#include <proton/reactor.h>
+
+struct pn_acceptor_t;
+
+namespace proton {
+
+/// A context for accepting inbound connections.
+///
+/// @see container::listen
+class acceptor : public internal::object<pn_acceptor_t> {
+    /// @cond INTERNAL
+    acceptor(pn_acceptor_t* a) : internal::object<pn_acceptor_t>(a) {}
+    /// @endcond
+
+  public:
+    acceptor() : internal::object<pn_acceptor_t>(0) {}
+
+    /// Close the acceptor.
+    PN_CPP_EXTERN void close();
+
+    /// Return the current set of connection options applied to
+    /// inbound connectons by the acceptor.
+    ///
+    /// Note that changes made to the connection options only affect
+    /// connections accepted after this call returns.
+    PN_CPP_EXTERN class connection_options &connection_options();
+
+    /// @cond INTERNAL
+  friend class internal::factory<acceptor>;
+    /// @endcond
+};
+
+} // proton
+
+#endif // PROTON_ACCEPTOR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/connector.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/connector.hpp b/proton-c/bindings/cpp/src/include/connector.hpp
new file mode 100644
index 0000000..5b6707a
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/connector.hpp
@@ -0,0 +1,65 @@
+#ifndef PROTON_CPP_CONNECTOR_HANDLER_H
+#define PROTON_CPP_CONNECTOR_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/connection.hpp"
+#include "proton/connection_options.hpp"
+#include <proton/event.h>
+#include <proton/reactor.h>
+#include "proton/url.hpp"
+
+#include "proton_handler.hpp"
+
+#include <string>
+
+
+namespace proton {
+
+class reconnect_timer;
+
+class connector : public proton_handler
+{
+  public:
+    connector(connection &c, const connection_options &options, const url&);
+    ~connector();
+    const url &address() const { return address_; }
+    void connect();
+    void reconnect_timer(const class reconnect_timer &);
+    virtual void on_connection_local_open(proton_event &e);
+    virtual void on_connection_remote_open(proton_event &e);
+    virtual void on_connection_init(proton_event &e);
+    virtual void on_transport_closed(proton_event &e);
+    virtual void on_transport_tail_closed(proton_event &e);
+    virtual void on_timer_task(proton_event &e);
+
+  private:
+    connection connection_;
+    const connection_options options_;
+    const url address_;
+    class reconnect_timer *reconnect_timer_;
+};
+
+
+}
+
+#endif  /*!PROTON_CPP_CONNECTOR_HANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/container_impl.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/container_impl.hpp b/proton-c/bindings/cpp/src/include/container_impl.hpp
new file mode 100644
index 0000000..97f6be2
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/container_impl.hpp
@@ -0,0 +1,124 @@
+#ifndef PROTON_CPP_CONTAINERIMPL_H
+#define PROTON_CPP_CONTAINERIMPL_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/io/link_namer.hpp"
+
+#include "proton/container.hpp"
+#include "proton/connection.hpp"
+#include "proton/connection_options.hpp"
+#include "proton/duration.hpp"
+#include "proton/sender.hpp"
+#include "proton/receiver.hpp"
+
+#include "messaging_adapter.hpp"
+#include "reactor.hpp"
+#include "proton_bits.hpp"
+#include "proton_handler.hpp"
+
+#include <list>
+#include <map>
+#include <string>
+
+namespace proton {
+
+class dispatch_helper;
+class connection;
+class connector;
+class acceptor;
+class container;
+class url;
+class task;
+class listen_handler;
+
+class container_impl : public standard_container {
+  public:
+    // Pull in base class functions here so that name search finds all the overloads
+    using standard_container::stop;
+    using standard_container::connect;
+    using standard_container::listen;
+    using standard_container::open_receiver;
+    using standard_container::open_sender;
+
+    container_impl(const std::string& id, messaging_handler* = 0);
+    ~container_impl();
+    std::string id() const PN_CPP_OVERRIDE { return id_; }
+    returned<connection> connect(const std::string&, const connection_options&) PN_CPP_OVERRIDE;
+    returned<sender> open_sender(
+        const std::string&, const proton::sender_options &, const connection_options &) PN_CPP_OVERRIDE;
+    returned<receiver> open_receiver(
+        const std::string&, const proton::receiver_options &, const connection_options &) PN_CPP_OVERRIDE;
+    listener listen(const std::string&, listen_handler& lh) PN_CPP_OVERRIDE;
+    void stop_listening(const std::string&) PN_CPP_OVERRIDE;
+    void client_connection_options(const connection_options &) PN_CPP_OVERRIDE;
+    connection_options client_connection_options() const PN_CPP_OVERRIDE { return client_connection_options_; }
+    void server_connection_options(const connection_options &) PN_CPP_OVERRIDE;
+    connection_options server_connection_options() const PN_CPP_OVERRIDE { return server_connection_options_; }
+    void sender_options(const proton::sender_options&) PN_CPP_OVERRIDE;
+    class sender_options sender_options() const PN_CPP_OVERRIDE { return sender_options_; }
+    void receiver_options(const proton::receiver_options&) PN_CPP_OVERRIDE;
+    class receiver_options receiver_options() const PN_CPP_OVERRIDE { return receiver_options_; }
+    void run() PN_CPP_OVERRIDE;
+    void stop(const error_condition& err) PN_CPP_OVERRIDE;
+    void auto_stop(bool set) PN_CPP_OVERRIDE;
+#if PN_CPP_HAS_STD_FUNCTION
+    void schedule(duration, std::function<void()>) PN_CPP_OVERRIDE;
+#endif
+    void schedule(duration, void_function0&) PN_CPP_OVERRIDE;
+
+    // non-interface functions
+    void configure_server_connection(connection &c);
+    static task schedule(container& c, int delay, proton_handler *h);
+    template <class T> static void set_handler(T s, messaging_handler* h);
+
+  private:
+    internal::pn_ptr<pn_handler_t> cpp_handler(proton_handler *h);
+
+    typedef std::map<std::string, acceptor> acceptors;
+
+    reactor reactor_;
+    // Keep a list of all the handlers used by the container so they last as long as the container
+    std::list<internal::pn_unique_ptr<proton_handler> > handlers_;
+    std::string id_;
+    connection_options client_connection_options_;
+    connection_options server_connection_options_;
+    proton::sender_options sender_options_;
+    proton::receiver_options receiver_options_;
+    bool auto_stop_;
+    acceptors acceptors_;
+
+  friend class messaging_adapter;
+};
+
+template <class T>
+void container_impl::set_handler(T s, messaging_handler* mh) {
+    pn_record_t *record = internal::get_attachments(unwrap(s));
+    proton_handler* h = new messaging_adapter(*mh);
+    container_impl& ci = static_cast<container_impl&>(s.container());
+    ci.handlers_.push_back(h);
+    pn_record_set_handler(record, ci.cpp_handler(h).get());
+}
+
+}
+
+#endif  /*!PROTON_CPP_CONTAINERIMPL_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/contexts.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/contexts.hpp b/proton-c/bindings/cpp/src/include/contexts.hpp
new file mode 100644
index 0000000..74a763c
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/contexts.hpp
@@ -0,0 +1,137 @@
+#ifndef PROTON_CPP_CONTEXTS_H
+#define PROTON_CPP_CONTEXTS_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/connection.hpp"
+#include "proton/container.hpp"
+#include "proton/io/connection_engine.hpp"
+#include "proton/event_loop.hpp"
+#include "proton/listen_handler.hpp"
+#include "proton/message.hpp"
+#include "proton/internal/pn_unique_ptr.hpp"
+
+#include "proton/io/link_namer.hpp"
+
+#include "proton_handler.hpp"
+
+struct pn_session_t;
+struct pn_event_t;
+struct pn_reactor_t;
+struct pn_record_t;
+struct pn_acceptor_t;
+
+namespace proton {
+
+class proton_handler;
+class reactor;
+
+// Base class for C++ classes that are used as proton contexts.
+// Contexts are pn_objects managed by pn reference counts, the C++ value is allocated in-place.
+class context {
+  public:
+    // identifies a context, contains a record pointer and a handle.
+    typedef std::pair<pn_record_t*, pn_handle_t> id;
+
+    virtual ~context();
+
+    // Allocate a default-constructed T as a proton object.
+    // T must be a subclass of context.
+    template <class T> static T *create() { return new(alloc(sizeof(T))) T(); }
+
+    // The pn_class for a context
+    static pn_class_t* pn_class();
+
+    // Get the context identified by id as a C++ T*, return null pointer if not present.
+    template <class T> static T* ptr(id id_) {
+        return reinterpret_cast<T*>(pn_record_get(id_.first, id_.second));
+    }
+
+    // If the context is not present, create it with value x.
+    template <class T> static T& ref(id id_) {
+        T* ctx = context::ptr<T>(id_);
+        if (!ctx) {
+            ctx = create<T>();
+            pn_record_def(id_.first, id_.second, pn_class());
+            pn_record_set(id_.first, id_.second, ctx);
+            pn_decref(ctx);
+        }
+        return *ctx;
+    }
+
+  private:
+    static void *alloc(size_t n);
+};
+
+// Connection context used by all connections.
+class connection_context : public context {
+  public:
+    connection_context() : container(0), default_session(0), link_gen(0), collector(0) {}
+
+    class container* container;
+    pn_session_t *default_session; // Owned by connection.
+    message event_message;      // re-used by messaging_adapter for performance.
+    io::link_namer* link_gen;      // Link name generator.
+    pn_collector_t* collector;
+
+    internal::pn_unique_ptr<proton_handler> handler;
+    internal::pn_unique_ptr<class event_loop> event_loop;
+
+    static connection_context& get(pn_connection_t *c) { return ref<connection_context>(id(c)); }
+    static connection_context& get(const connection& c) { return ref<connection_context>(id(c)); }
+
+  protected:
+    static context::id id(pn_connection_t*);
+    static context::id id(const connection& c);
+};
+
+void container_context(const reactor&, container&);
+
+class container_context {
+  public:
+    static void set(const reactor& r, container& c);
+    static container& get(pn_reactor_t*);
+};
+
+class listener_context : public context {
+  public:
+    static listener_context& get(pn_acceptor_t* c);
+    listener_context() : listen_handler_(0), ssl(false) {}
+    connection_options  get_options() { return listen_handler_->on_accept(); }
+    class listen_handler* listen_handler_;
+    bool ssl;
+};
+
+class link_context : public context {
+  public:
+    static link_context& get(pn_link_t* l);
+    link_context() : credit_window(10), auto_accept(true), auto_settle(true), draining(false), pending_credit(0) {}
+    int credit_window;
+    bool auto_accept;
+    bool auto_settle;
+    bool draining;
+    uint32_t pending_credit;
+};
+
+}
+
+#endif  /*!PROTON_CPP_CONTEXTS_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/messaging_adapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/messaging_adapter.hpp b/proton-c/bindings/cpp/src/include/messaging_adapter.hpp
new file mode 100644
index 0000000..5371eec
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/messaging_adapter.hpp
@@ -0,0 +1,62 @@
+#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/messaging_handler.hpp"
+
+#include "proton_handler.hpp"
+
+#include <proton/event.h>
+#include <proton/reactor.h>
+
+///@cond INTERNAL
+
+namespace proton {
+
+/// Convert the low level proton-c events to the higher level proton::messaging_handler calls
+class messaging_adapter : public proton_handler
+{
+  public:
+    messaging_adapter(messaging_handler &delegate) : delegate_(delegate) {}
+
+    void on_reactor_init(proton_event &e);
+    void on_reactor_final(proton_event & e);
+    void on_link_flow(proton_event &e);
+    void on_delivery(proton_event &e);
+    void on_connection_remote_open(proton_event &e);
+    void on_connection_remote_close(proton_event &e);
+    void on_session_remote_open(proton_event &e);
+    void on_session_remote_close(proton_event &e);
+    void on_link_local_open(proton_event &e);
+    void on_link_remote_open(proton_event &e);
+    void on_link_remote_detach(proton_event & e);
+    void on_link_remote_close(proton_event &e);
+    void on_transport_closed(proton_event &e);
+
+  private:
+    messaging_handler &delegate_;  // The handler for generated messaging_event's
+};
+
+}
+///@endcond INTERNAL
+#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/msg.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/msg.hpp b/proton-c/bindings/cpp/src/include/msg.hpp
new file mode 100644
index 0000000..b24b25c
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/msg.hpp
@@ -0,0 +1,58 @@
+#ifndef PROTON_MSG_H
+#define PROTON_MSG_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 <sstream>
+#include <iostream>
+
+namespace proton {
+
+/** A simple facade for std::ostringstream that allows
+ * in place construction of a message and automatic conversion
+ * to string.
+ * E.g.
+ *@code
+ * void foo(const std::string&);
+ * foo(msg() << "hello " << 32);
+ *@endcode
+ * Will construct the string "hello 32" and pass it to foo()
+ */
+struct msg {
+    std::ostringstream os;
+    msg() {}
+    msg(const msg& m) : os(m.str()) {}
+    std::string str() const { return os.str(); }
+    operator std::string() const { return str(); }
+    template <class T> msg& operator<<(const T& t) { os << t; return *this; }
+};
+
+inline std::ostream& operator<<(std::ostream& o, const msg& m) { return o << m.str(); }
+
+/** Construct a message using operator << and append (file:line) */
+#define QUOTe_(x) #x
+#define QUOTE(x) QUOTe_(x)
+#define MSG(message) (::proton::msg() << message)
+
+}
+
+#endif  /*!PROTON_MSG_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/proton_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/proton_bits.hpp b/proton-c/bindings/cpp/src/include/proton_bits.hpp
new file mode 100644
index 0000000..97d4bee
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/proton_bits.hpp
@@ -0,0 +1,149 @@
+#ifndef PROTON_BITS_HPP
+#define PROTON_BITS_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/link.h>
+#include <proton/session.h>
+
+#include <string>
+#include <iosfwd>
+
+/**@file
+ *
+ * Assorted internal proton utilities.
+ */
+
+struct pn_error_t;
+
+struct pn_data_t;
+struct pn_transport_t;
+struct pn_sasl_t;
+struct pn_ssl_t;
+struct pn_connection_t;
+struct pn_session_t;
+struct pn_link_t;
+struct pn_delivery_t;
+struct pn_condition_t;
+struct pn_acceptor_t;
+struct pn_terminus_t;
+struct pn_reactor_t;
+struct pn_record_t;
+
+namespace proton {
+
+namespace internal { class data; }
+class transport;
+class sasl;
+class ssl;
+class connection;
+class session;
+class link;
+class sender;
+class receiver;
+class transfer;
+class tracker;
+class delivery;
+class error_condition;
+class acceptor;
+class terminus;
+class source;
+class target;
+class reactor;
+
+std::string error_str(long code);
+
+/** Print the error string from pn_error_t, or from code if pn_error_t has no error. */
+std::string error_str(pn_error_t*, long code=0);
+
+/** Make a void* inspectable via operator <<. */
+struct inspectable { void* value; inspectable(void* o) : value(o) {} };
+
+/** Stream a proton object via pn_inspect. */
+std::ostream& operator<<(std::ostream& o, const inspectable& object);
+
+void set_error_condition(const error_condition&, pn_condition_t*);
+
+/// Convert a const char* to std::string, convert NULL to the empty string.
+inline std::string str(const char* s) { return s ? s : std::string(); }
+
+namespace internal {
+
+// These traits relate the wrapped and wrapper classes for the templated factories below
+template <class T> struct wrapped {};
+template <> struct wrapped<internal::data> { typedef pn_data_t type; };
+template <> struct wrapped<transport> { typedef pn_transport_t type; };
+template <> struct wrapped<sasl> { typedef pn_sasl_t type; };
+template <> struct wrapped<ssl> { typedef pn_ssl_t type; };
+template <> struct wrapped<connection> { typedef pn_connection_t type; };
+template <> struct wrapped<session> { typedef pn_session_t type; };
+template <> struct wrapped<link> { typedef pn_link_t type; };
+template <> struct wrapped<sender> { typedef pn_link_t type; };
+template <> struct wrapped<receiver> { typedef pn_link_t type; };
+template <> struct wrapped<transfer> { typedef pn_delivery_t type; };
+template <> struct wrapped<tracker> { typedef pn_delivery_t type; };
+template <> struct wrapped<delivery> { typedef pn_delivery_t type; };
+template <> struct wrapped<error_condition> { typedef pn_condition_t type; };
+template <> struct wrapped<acceptor> { typedef pn_acceptor_t type; }; // TODO aconway 2016-05-13: reactor only
+template <> struct wrapped<terminus> { typedef pn_terminus_t type; };
+template <> struct wrapped<source> { typedef pn_terminus_t type; };
+template <> struct wrapped<target> { typedef pn_terminus_t type; };
+template <> struct wrapped<reactor> { typedef pn_reactor_t type; };
+
+template <class T> struct wrapper {};
+template <> struct wrapper<pn_data_t> { typedef internal::data type; };
+template <> struct wrapper<pn_transport_t> { typedef transport type; };
+template <> struct wrapper<pn_sasl_t> { typedef sasl type; };
+template <> struct wrapper<pn_ssl_t> { typedef ssl type; };
+template <> struct wrapper<pn_connection_t> { typedef connection type; };
+template <> struct wrapper<pn_session_t> { typedef session type; };
+template <> struct wrapper<pn_link_t> { typedef link type; };
+template <> struct wrapper<pn_delivery_t> { typedef transfer type; };
+template <> struct wrapper<pn_condition_t> { typedef error_condition type; };
+template <> struct wrapper<pn_acceptor_t> { typedef acceptor type; };
+template <> struct wrapper<pn_terminus_t> { typedef terminus type; };
+template <> struct wrapper<pn_reactor_t> { typedef reactor type; };
+
+// Factory for wrapper types
+template <class T>
+class factory {
+public:
+    static T wrap(typename wrapped<T>::type* t) { return t; }
+    static typename wrapped<T>::type* unwrap(T t) { return t.pn_object(); }
+};
+
+// Get attachments for various proton-c types
+template <class T>
+inline pn_record_t* get_attachments(T*);
+
+template <> inline pn_record_t* get_attachments(pn_session_t* s) { return pn_session_attachments(s); }
+template <> inline pn_record_t* get_attachments(pn_link_t* l) { return pn_link_attachments(l); }
+}
+
+template <class T>
+typename internal::wrapper<T>::type make_wrapper(T* t) { return internal::factory<typename internal::wrapper<T>::type>::wrap(t); }
+
+template <class U>
+U make_wrapper(typename internal::wrapped<U>::type* t) { return internal::factory<U>::wrap(t); }
+
+template <class T>
+typename internal::wrapped<T>::type* unwrap(T t) {return internal::factory<T>::unwrap(t); }
+
+}
+
+#endif // PROTON_BITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/proton_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/proton_event.hpp b/proton-c/bindings/cpp/src/include/proton_event.hpp
new file mode 100644
index 0000000..9b33701
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/proton_event.hpp
@@ -0,0 +1,293 @@
+#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/error.hpp"
+
+#include <proton/event.h>
+
+namespace proton {
+
+class proton_handler;
+class container;
+
+/** Event information for a proton::proton_handler */
+class proton_event
+{
+  public:
+    /// The type of an event
+    enum event_type {
+    ///@name Event types
+    ///@{
+
+      /**
+      * Defined as a programming convenience. No event of this type will
+      * ever be generated.
+      */
+      EVENT_NONE=PN_EVENT_NONE,
+
+      /**
+      * A reactor has been started. Events of this type point to the reactor.
+      */
+      REACTOR_INIT=PN_REACTOR_INIT,
+
+      /**
+      * A reactor has no more events to process. Events of this type
+      * point to the reactor.
+      */
+      REACTOR_QUIESCED=PN_REACTOR_QUIESCED,
+
+      /**
+      * A reactor has been stopped. Events of this type point to the reactor.
+      */
+      REACTOR_FINAL=PN_REACTOR_FINAL,
+
+      /**
+      * A timer event has occurred.
+      */
+      TIMER_TASK=PN_TIMER_TASK,
+
+      /**
+      * The connection has been created. This is the first event that
+      * will ever be issued for a connection. Events of this type point
+      * to the relevant connection.
+      */
+      CONNECTION_INIT=PN_CONNECTION_INIT,
+
+      /**
+      * The connection has been bound to a transport. This event is
+      * issued when the transport::bind() is called.
+      */
+      CONNECTION_BOUND=PN_CONNECTION_BOUND,
+
+      /**
+      * The connection has been unbound from its transport. This event is
+      * issued when transport::unbind() is called.
+      */
+      CONNECTION_UNBOUND=PN_CONNECTION_UNBOUND,
+
+      /**
+      * The local connection endpoint has been closed. Events of this
+      * type point to the relevant connection.
+      */
+      CONNECTION_LOCAL_OPEN=PN_CONNECTION_LOCAL_OPEN,
+
+      /**
+      * The remote endpoint has opened the connection. Events of this
+      * type point to the relevant connection.
+      */
+      CONNECTION_REMOTE_OPEN=PN_CONNECTION_REMOTE_OPEN,
+
+      /**
+      * The local connection endpoint has been closed. Events of this
+      * type point to the relevant connection.
+      */
+      CONNECTION_LOCAL_CLOSE=PN_CONNECTION_LOCAL_CLOSE,
+
+      /**
+      *  The remote endpoint has closed the connection. Events of this
+      *  type point to the relevant connection.
+      */
+      CONNECTION_REMOTE_CLOSE=PN_CONNECTION_REMOTE_CLOSE,
+
+      /**
+      * The connection has been freed and any outstanding processing has
+      * been completed. This is the final event that will ever be issued
+      * for a connection.
+      */
+      CONNECTION_FINAL=PN_CONNECTION_FINAL,
+
+      /**
+      * The session has been created. This is the first event that will
+      * ever be issued for a session.
+      */
+      SESSION_INIT=PN_SESSION_INIT,
+
+      /**
+      * The local session endpoint has been opened. Events of this type
+      * point to the relevant session.
+      */
+      SESSION_LOCAL_OPEN=PN_SESSION_LOCAL_OPEN,
+
+      /**
+      * The remote endpoint has opened the session. Events of this type
+      * point to the relevant session.
+      */
+      SESSION_REMOTE_OPEN=PN_SESSION_REMOTE_OPEN,
+
+      /**
+      * The local session endpoint has been closed. Events of this type
+      * point ot the relevant session.
+      */
+      SESSION_LOCAL_CLOSE=PN_SESSION_LOCAL_CLOSE,
+
+      /**
+      * The remote endpoint has closed the session. Events of this type
+      * point to the relevant session.
+      */
+      SESSION_REMOTE_CLOSE=PN_SESSION_REMOTE_CLOSE,
+
+      /**
+      * The session has been freed and any outstanding processing has
+      * been completed. This is the final event that will ever be issued
+      * for a session.
+      */
+      SESSION_FINAL=PN_SESSION_FINAL,
+
+      /**
+      * The link has been created. This is the first event that will ever
+      * be issued for a link.
+      */
+      LINK_INIT=PN_LINK_INIT,
+
+      /**
+      * The local link endpoint has been opened. Events of this type
+      * point ot the relevant link.
+      */
+      LINK_LOCAL_OPEN=PN_LINK_LOCAL_OPEN,
+
+      /**
+      * The remote endpoint has opened the link. Events of this type
+      * point to the relevant link.
+      */
+      LINK_REMOTE_OPEN=PN_LINK_REMOTE_OPEN,
+
+      /**
+      * The local link endpoint has been closed. Events of this type
+      * point ot the relevant link.
+      */
+      LINK_LOCAL_CLOSE=PN_LINK_LOCAL_CLOSE,
+
+      /**
+      * The remote endpoint has closed the link. Events of this type
+      * point to the relevant link.
+      */
+      LINK_REMOTE_CLOSE=PN_LINK_REMOTE_CLOSE,
+
+      /**
+      * The local link endpoint has been detached. Events of this type
+      * point to the relevant link.
+      */
+      LINK_LOCAL_DETACH=PN_LINK_LOCAL_DETACH,
+
+      /**
+      * The remote endpoint has detached the link. Events of this type
+      * point to the relevant link.
+      */
+      LINK_REMOTE_DETACH=PN_LINK_REMOTE_DETACH,
+
+      /**
+      * The flow control state for a link has changed. Events of this
+      * type point to the relevant link.
+      */
+      LINK_FLOW=PN_LINK_FLOW,
+
+      /**
+      * The link has been freed and any outstanding processing has been
+      * completed. This is the final event that will ever be issued for a
+      * link. Events of this type point to the relevant link.
+      */
+      LINK_FINAL=PN_LINK_FINAL,
+
+      /**
+      * A delivery has been created or updated. Events of this type point
+      * to the relevant delivery.
+      */
+      DELIVERY=PN_DELIVERY,
+
+      /**
+      * The transport has new data to read and/or write. Events of this
+      * type point to the relevant transport.
+      */
+      TRANSPORT=PN_TRANSPORT,
+
+      /**
+      * The transport has authenticated, if this is received by a server
+      * the associated transport has authenticated an incoming connection
+      * and transport::user() can be used to obtain the authenticated
+      * user.
+      */
+      TRANSPORT_AUTHENTICATED=PN_TRANSPORT_AUTHENTICATED,
+
+      /**
+      * Indicates that a transport error has occurred. Use
+      * transport::condition() to access the details of the error
+      * from the associated transport.
+      */
+      TRANSPORT_ERROR=PN_TRANSPORT_ERROR,
+
+      /**
+      * Indicates that the head of the transport has been closed. This
+      * means the transport will never produce more bytes for output to
+      * the network. Events of this type point to the relevant transport.
+      */
+      TRANSPORT_HEAD_CLOSED=PN_TRANSPORT_HEAD_CLOSED,
+
+      /**
+      * Indicates that the tail of the transport has been closed. This
+      * means the transport will never be able to process more bytes from
+      * the network. Events of this type point to the relevant transport.
+      */
+      TRANSPORT_TAIL_CLOSED=PN_TRANSPORT_TAIL_CLOSED,
+
+      /**
+      * Indicates that the both the head and tail of the transport are
+      * closed. Events of this type point to the relevant transport.
+      */
+      TRANSPORT_CLOSED=PN_TRANSPORT_CLOSED,
+
+      SELECTABLE_INIT=PN_SELECTABLE_INIT,
+      SELECTABLE_UPDATED=PN_SELECTABLE_UPDATED,
+      SELECTABLE_READABLE=PN_SELECTABLE_READABLE,
+      SELECTABLE_WRITABLE=PN_SELECTABLE_WRITABLE,
+      SELECTABLE_ERROR=PN_SELECTABLE_ERROR,
+      SELECTABLE_EXPIRED=PN_SELECTABLE_EXPIRED,
+      SELECTABLE_FINAL=PN_SELECTABLE_FINAL
+    };
+    ///@}
+
+    proton_event(pn_event_t *ce, class container* cont) :
+      pn_event_(ce),
+      container_(cont)
+    {}
+
+    pn_event_t* pn_event() const { return pn_event_; }
+    class container& container() const {
+        if (!container_)
+            throw proton::error("event does not have a container");
+        return *container_;
+    }
+
+    /// Get type of event
+    event_type type() const { return event_type(pn_event_type(pn_event_)); }
+
+    void dispatch(proton_handler& h);
+
+  private:
+    pn_event_t *pn_event_;
+    class container* container_;
+};
+
+}
+
+#endif  /*!PROTON_CPP_PROTONEVENT_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/proton_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/proton_handler.hpp b/proton-c/bindings/cpp/src/include/proton_handler.hpp
new file mode 100644
index 0000000..9941396
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/proton_handler.hpp
@@ -0,0 +1,92 @@
+#ifndef PROTON_CPP_PROTONHANDLER_H
+#define PROTON_CPP_PROTONHANDLER_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/internal/object.hpp"
+
+#include <vector>
+
+struct pn_handler_t;
+
+namespace proton {
+
+class event;
+class proton_event;
+
+/// Handler base class, subclass and over-ride event handling member functions.
+/// @see proton::proton_event for meaning of events.
+class proton_handler
+{
+  public:
+    proton_handler();
+    virtual ~proton_handler();
+
+    ///@name Over-ride these member functions to handle events
+    ///@{
+    virtual void on_reactor_init(proton_event &e);
+    virtual void on_reactor_quiesced(proton_event &e);
+    virtual void on_reactor_final(proton_event &e);
+    virtual void on_timer_task(proton_event &e);
+    virtual void on_connection_init(proton_event &e);
+    virtual void on_connection_bound(proton_event &e);
+    virtual void on_connection_unbound(proton_event &e);
+    virtual void on_connection_local_open(proton_event &e);
+    virtual void on_connection_local_close(proton_event &e);
+    virtual void on_connection_remote_open(proton_event &e);
+    virtual void on_connection_remote_close(proton_event &e);
+    virtual void on_connection_final(proton_event &e);
+    virtual void on_session_init(proton_event &e);
+    virtual void on_session_local_open(proton_event &e);
+    virtual void on_session_local_close(proton_event &e);
+    virtual void on_session_remote_open(proton_event &e);
+    virtual void on_session_remote_close(proton_event &e);
+    virtual void on_session_final(proton_event &e);
+    virtual void on_link_init(proton_event &e);
+    virtual void on_link_local_open(proton_event &e);
+    virtual void on_link_local_close(proton_event &e);
+    virtual void on_link_local_detach(proton_event &e);
+    virtual void on_link_remote_open(proton_event &e);
+    virtual void on_link_remote_close(proton_event &e);
+    virtual void on_link_remote_detach(proton_event &e);
+    virtual void on_link_flow(proton_event &e);
+    virtual void on_link_final(proton_event &e);
+    virtual void on_delivery(proton_event &e);
+    virtual void on_transport(proton_event &e);
+    virtual void on_transport_error(proton_event &e);
+    virtual void on_transport_head_closed(proton_event &e);
+    virtual void on_transport_tail_closed(proton_event &e);
+    virtual void on_transport_closed(proton_event &e);
+    virtual void on_selectable_init(proton_event &e);
+    virtual void on_selectable_updated(proton_event &e);
+    virtual void on_selectable_readable(proton_event &e);
+    virtual void on_selectable_writable(proton_event &e);
+    virtual void on_selectable_expired(proton_event &e);
+    virtual void on_selectable_error(proton_event &e);
+    virtual void on_selectable_final(proton_event &e);
+    virtual void on_unhandled(proton_event &e);
+    ///@}
+};
+
+}
+
+#endif  /*!PROTON_CPP_PROTONHANDLER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/reactor.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/reactor.hpp b/proton-c/bindings/cpp/src/include/reactor.hpp
new file mode 100644
index 0000000..c7ab915
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/reactor.hpp
@@ -0,0 +1,106 @@
+#ifndef REACTOR_HPP
+#define REACTOR_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.
+ */
+
+/// @cond INTERNAL
+/// XXX remove
+
+#include "proton/internal/object.hpp"
+#include "proton/duration.hpp"
+#include "proton/timestamp.hpp"
+
+struct pn_reactor_t;
+struct pn_handler_t;
+struct pn_io_t;
+
+namespace proton {
+
+class connection;
+class container;
+class acceptor;
+class url;
+class messaging_handler;
+class task;
+
+class reactor : public internal::object<pn_reactor_t> {
+  public:
+    reactor(pn_reactor_t* r = 0) : internal::object<pn_reactor_t>(r) {}
+
+    /** Create a new reactor. */
+    static reactor create();
+
+    /** Open a connection to url and create a receiver with source=url.path() */
+    acceptor listen(const proton::url &);
+
+    /** Run the event loop, return when all connections and acceptors are closed. */
+    void run();
+
+    /** Start the reactor, you must call process() to process events */
+    void start();
+
+    /** Process events, return true if there are more events to process. */
+    bool process();
+
+    /** Stop the reactor, causes run() to return and process() to return false. */
+    void stop();
+
+    /// Identifier for the container
+    std::string id() const;
+
+    /// Get timeout, process() will return if there is no activity within the timeout.
+    duration timeout();
+
+    /// Set timeout, process() will return if there is no activity within the timeout.
+    void timeout(duration timeout);
+
+    timestamp mark();
+    timestamp now();
+
+    task schedule(int, pn_handler_t*);
+
+    class connection connection(pn_handler_t*) const;
+
+    class connection connection_to_host(const std::string &host, const std::string &port, pn_handler_t*) const;
+
+    pn_handler_t* pn_handler() const;
+
+    void pn_handler(pn_handler_t* );
+
+    pn_handler_t* pn_global_handler() const;
+
+    void pn_global_handler(pn_handler_t* );
+
+    pn_io_t* pn_io() const;
+
+    void wakeup();
+    bool quiesced();
+    void yield();
+
+  friend class container_impl;
+  friend class container_context;
+  friend class internal::factory<reactor>;
+};
+
+}
+
+/// @endcond
+
+#endif // REACTOR_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/scalar_test.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/scalar_test.hpp b/proton-c/bindings/cpp/src/include/scalar_test.hpp
new file mode 100644
index 0000000..b075c98
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/scalar_test.hpp
@@ -0,0 +1,209 @@
+#ifndef SCALAR_TEST_HPP
+#define SCALAR_TEST_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.
+ */
+
+// Template tests used by both scalar_test.cpp and value_test.hpp to test conversion
+// of scalar values via a proton::scalar or a proton::value.
+
+#include "test_bits.hpp"
+
+#include "proton/types.hpp"
+#include "proton/error.hpp"
+
+#include <sstream>
+
+
+namespace test {
+
+using namespace proton;
+
+// Inserting and extracting simple C++ values using same-type get<T> and coerce<T>
+template <class V, class T> void simple_type_test(T x, type_id tid, const std::string& s, T y) {
+    V vx(x);                    // Construct from C++ value
+    ASSERT_EQUAL(tid, vx.type());
+    ASSERT(!vx.empty());
+    ASSERT_EQUAL(x, get<T>(vx));
+    ASSERT_EQUAL(x, coerce<T>(vx));
+
+    V vxa = x;                  // Assign from C++ value
+    ASSERT_EQUAL(tid, vxa.type());
+    ASSERT(!vx.empty());
+    ASSERT_EQUAL(vx, vxa);
+    ASSERT_EQUAL(x, get<T>(vxa));
+    ASSERT_EQUAL(x, coerce<T>(vxa));
+
+    V v2;                       // Default construct
+    ASSERT(v2.type() == NULL_TYPE);
+    ASSERT(v2.empty());
+    v2 = x;                     // Assign from C++ value
+    ASSERT_EQUAL(tid, v2.type());
+    ASSERT_EQUAL(vx, v2);
+    ASSERT_EQUAL(x, get<T>(v2));
+    ASSERT_EQUAL(x, coerce<T>(v2));
+
+    V v3(vx);                   // Copy construct
+    ASSERT_EQUAL(tid, v3.type());
+    ASSERT_EQUAL(vx, v3);
+    ASSERT_EQUAL(x, get<T>(v3));
+    ASSERT_EQUAL(x, coerce<T>(v3));
+
+    V v4 = vx;                  // Copy assign
+    ASSERT_EQUAL(tid, v4.type());
+    ASSERT_EQUAL(x, get<T>(v4));
+    ASSERT_EQUAL(x, coerce<T>(v4));
+
+    ASSERT_EQUAL(s, to_string(vx));   // Stringify
+    V vy(y);
+    ASSERT(vx != vy);           // Compare
+    ASSERT(vx < vy);
+    ASSERT(vy > vx);
+}
+
+// Test native C/C++ integer types via their mapped integer type ([u]int_x_t)
+template <class V, class T> void simple_integral_test() {
+    typedef typename internal::integer_type<sizeof(T), internal::is_signed<T>::value>::type int_type;
+    simple_type_test<V>(T(3), internal::type_id_of<int_type>::value, "3", T(4));
+}
+
+// Test invalid gets, valid same-type get<T> is tested by simple_type_test
+// Templated to test both scalar and value.
+template<class V>  void bad_get_test() {
+    try { get<bool>(V(int8_t(1))); FAIL("byte as bool"); } catch (conversion_error) {}
+    try { get<uint8_t>(V(true)); FAIL("bool as uint8_t"); } catch (conversion_error) {}
+    try { get<uint8_t>(V(int8_t(1))); FAIL("int8 as uint8"); } catch (conversion_error) {}
+    try { get<int16_t>(V(uint16_t(1))); FAIL("uint16 as int16"); } catch (conversion_error) {}
+    try { get<int16_t>(V(int32_t(1))); FAIL("int32 as int16"); } catch (conversion_error) {}
+    try { get<symbol>(V(std::string())); FAIL("string as symbol"); } catch (conversion_error) {}
+    try { get<std::string>(V(binary())); FAIL("binary as string"); } catch (conversion_error) {}
+    try { get<binary>(V(symbol())); FAIL("symbol as binary"); } catch (conversion_error) {}
+    try { get<binary>(V(timestamp())); FAIL("timestamp as binary"); } catch (conversion_error) {}
+    try { get<int>(V(timestamp())); FAIL("timestamp as int"); } catch (conversion_error) {}
+    try { get<timestamp>(V(0)); FAIL("int as timestamp"); } catch (conversion_error) {}
+    try { get<timestamp>(V(std::string())); FAIL("string as timestamp"); } catch (conversion_error) {}
+}
+
+// Test some valid coercions and some bad ones with mixed types.
+// Templated to test both scalar and value.
+template<class V> void coerce_test() {
+    // Valid C++ conversions should work with coerce.
+    ASSERT_EQUAL(false, coerce<bool>(V(0)));
+    ASSERT_EQUAL(true, coerce<bool>(V(-1)));
+    ASSERT_EQUAL(true, coerce<bool>(V(int64_t(0xFFFF0000))));
+
+    ASSERT_EQUAL(1, coerce<uint8_t>(V(uint64_t(1)))); // In range.
+    ASSERT_EQUAL(1, coerce<uint8_t>(V(uint32_t(0xFF01)))); // int truncate.
+    ASSERT_EQUAL(0xFFFF, coerce<uint16_t>(V(int8_t(-1)))); // Sign extend.
+    ASSERT_EQUAL(-1, coerce<int32_t>(V(uint64_t(0xFFFFFFFFul)))); // 2s complement
+
+    ASSERT_EQUALISH(1.2f, coerce<float>(V(double(1.2))), 0.001f);
+    ASSERT_EQUALISH(3.4, coerce<double>(V(float(3.4))), 0.001);
+    ASSERT_EQUALISH(23.0, coerce<double>(V(uint64_t(23))), 0.001); // int to double.
+    ASSERT_EQUAL(-1945, coerce<int>(V(float(-1945.123))));    // round to int.
+
+    // String-like conversions.
+    ASSERT_EQUAL(std::string("foo"), coerce<std::string>(V(symbol("foo"))));
+    ASSERT_EQUAL(std::string("foo"), coerce<std::string>(V(binary("foo"))));
+
+    // Bad coercions, types are not `is_convertible`
+    V s("foo");
+    try { coerce<bool>(s); FAIL("string as bool"); } catch (conversion_error) {}
+    try { coerce<int>(s); FAIL("string as int"); } catch (conversion_error) {}
+    try { coerce<double>(s); FAIL("string as double"); } catch (conversion_error) {}
+
+    try { coerce<std::string>(V(0)); FAIL("int as string"); } catch (conversion_error) {}
+    try { coerce<symbol>(V(true)); FAIL("bool as symbol"); } catch (conversion_error) {}
+    try { coerce<binary>(V(0.0)); FAIL("double as binary"); } catch (conversion_error) {}
+    try { coerce<symbol>(V(binary())); FAIL("binary as symbol"); } catch (conversion_error) {}
+    try { coerce<binary>(V(symbol())); FAIL("symbol as binary"); } catch (conversion_error) {}
+    try { coerce<binary>(s); } catch (conversion_error) {}
+    try { coerce<symbol>(s); } catch (conversion_error) {}
+}
+
+template <class V> void null_test() {
+    V v;
+    ASSERT(v.empty());
+    ASSERT_EQUAL(NULL_TYPE, v.type());
+    get<null>(v);
+    null n;
+    get(v, n);
+    V v2(n);
+    ASSERT(v.empty());
+    ASSERT_EQUAL(NULL_TYPE, v.type());
+    v = "foo";
+    ASSERT_EQUAL(STRING, v.type());
+    try { get<null>(v); FAIL("Expected conversion_error"); } catch (conversion_error) {}
+    v = null();
+    get<null>(v);
+}
+
+// Nasty hack for uninterpreted decimal<> types.
+template <class T> T make(const char c) { T x; std::fill(x.begin(), x.end(), c); return x; }
+
+template <class V> void scalar_test_group(int& failed) {
+    // Direct AMQP-mapped types.
+    RUN_TEST(failed, simple_type_test<V>(false, BOOLEAN, "false", true));
+    RUN_TEST(failed, simple_type_test<V>(uint8_t(42), UBYTE, "42", uint8_t(50)));
+    RUN_TEST(failed, simple_type_test<V>(int8_t(-42), BYTE, "-42", int8_t(-40)));
+    RUN_TEST(failed, simple_type_test<V>(uint16_t(4242), USHORT, "4242", uint16_t(5252)));
+    RUN_TEST(failed, simple_type_test<V>(int16_t(-4242), SHORT, "-4242", int16_t(3)));
+    RUN_TEST(failed, simple_type_test<V>(uint32_t(4242), UINT, "4242", uint32_t(5252)));
+    RUN_TEST(failed, simple_type_test<V>(int32_t(-4242), INT, "-4242", int32_t(3)));
+    RUN_TEST(failed, simple_type_test<V>(uint64_t(4242), ULONG, "4242", uint64_t(5252)));
+    RUN_TEST(failed, simple_type_test<V>(int64_t(-4242), LONG, "-4242", int64_t(3)));
+    RUN_TEST(failed, simple_type_test<V>(wchar_t('X'), CHAR, "88", wchar_t('Y')));
+    RUN_TEST(failed, simple_type_test<V>(float(1.234), FLOAT, "1.234", float(2.345)));
+    RUN_TEST(failed, simple_type_test<V>(double(11.2233), DOUBLE, "11.2233", double(12)));
+    RUN_TEST(failed, simple_type_test<V>(timestamp(1234), TIMESTAMP, "1234", timestamp(12345)));
+    RUN_TEST(failed, simple_type_test<V>(make<decimal32>(1), DECIMAL32, "decimal32(0x01010101)", make<decimal32>(2)));
+    RUN_TEST(failed, simple_type_test<V>(make<decimal64>(3), DECIMAL64, "decimal64(0x0303030303030303)", make<decimal64>(4)));
+    RUN_TEST(failed, simple_type_test<V>(make<decimal128>(5), DECIMAL128, "decimal128(0x05050505050505050505050505050505)", make<decimal128>(6)));
+    RUN_TEST(failed, simple_type_test<V>(
+                 uuid::copy("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"),
+                 UUID, "00112233-4455-6677-8899-aabbccddeeff",
+                 uuid::copy("\xff\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff")));
+    RUN_TEST(failed, simple_type_test<V>(std::string("xxx"), STRING, "xxx", std::string("yyy")));
+    RUN_TEST(failed, simple_type_test<V>(symbol("aaa"), SYMBOL, "aaa", symbol("aaaa")));
+    RUN_TEST(failed, simple_type_test<V>(binary("\010aaa"), BINARY, "b\"\\x08aaa\"", binary("aaaa")));
+
+    // Test native C++ integral types.
+    RUN_TEST(failed, (simple_integral_test<V, char>()));
+    RUN_TEST(failed, (simple_integral_test<V, signed char>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned char>()));
+    RUN_TEST(failed, (simple_integral_test<V, short>()));
+    RUN_TEST(failed, (simple_integral_test<V, int>()));
+    RUN_TEST(failed, (simple_integral_test<V, long>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned short>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned int>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned long>()));
+#if PN_CPP_HAS_LONG_LONG
+    RUN_TEST(failed, (simple_integral_test<V, long long>()));
+    RUN_TEST(failed, (simple_integral_test<V, unsigned long long>()));
+#endif
+
+
+    RUN_TEST(failed, (coerce_test<V>()));
+    RUN_TEST(failed, (null_test<V>()));
+    RUN_TEST(failed, (bad_get_test<V>()));
+}
+
+}
+
+#endif // SCALAR_TEST_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/test_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/test_bits.hpp b/proton-c/bindings/cpp/src/include/test_bits.hpp
new file mode 100644
index 0000000..0cfbe1f
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/test_bits.hpp
@@ -0,0 +1,136 @@
+#ifndef TEST_BITS_HPP
+#define TEST_BITS_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 "msg.hpp"
+#include "proton/types.hpp"
+
+#include <stdexcept>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <math.h>
+
+namespace test {
+
+struct fail : public std::logic_error {
+    fail(const std::string& what) : logic_error(what) {}
+};
+
+template <class T, class U>
+void assert_equal(const T& want, const U& got, const std::string& what) {
+    if (!(want == got))
+        throw fail(MSG(what << " " << want << " != " << got));
+}
+
+template <class T>
+inline void assert_equalish(T want, T got, T delta, const std::string& what)
+{
+    if (!(fabs(want-got) <= delta))
+        throw fail(MSG(what << " " << want << " !=~ " << got));
+}
+
+#define FAIL_MSG(WHAT) (MSG(__FILE__ << ":" << __LINE__ << ": " << WHAT).str())
+#define FAIL(WHAT) throw test::fail(FAIL_MSG(WHAT))
+#define ASSERT(TEST) do { if (!(TEST)) FAIL("failed ASSERT(" #TEST ")"); } while(false)
+#define ASSERT_EQUAL(WANT, GOT) \
+    test::assert_equal((WANT), (GOT), FAIL_MSG("failed ASSERT_EQUAL(" #WANT ", " #GOT ")"))
+#define ASSERT_EQUALISH(WANT, GOT, DELTA) \
+    test::assert_equalish((WANT), (GOT), (DELTA), FAIL_MSG("failed ASSERT_EQUALISH(" #WANT ", " #GOT ")"))
+
+#define RUN_TEST(BAD_COUNT, TEST)                                       \
+    do {                                                                \
+        try {                                                           \
+            TEST;                                                       \
+            break;                                                      \
+        } catch(const test::fail& e) {                                        \
+            std::cout << "FAIL " << #TEST << std::endl << e.what() << std::endl; \
+        } catch(const std::exception& e) {                              \
+            std::cout << "ERROR " << #TEST << std::endl << __FILE__ << ":" << __LINE__ << ": " << e.what() << std::endl; \
+        }                                                               \
+            ++BAD_COUNT;                                                \
+    } while(0)
+
+template<class T> std::string str(const T& x) {
+    std::ostringstream s; s << std::boolalpha << x; return s.str();
+}
+
+// A way to easily create literal collections that can be compared to std:: collections
+// and to print std collections
+// e.g.
+//     std::vector<string> v = ...;
+//     ASSERT_EQUAL(many<string>() + "a" + "b" + "c", v);
+template <class T> struct many : public std::vector<T> {
+    many() {}
+    template<class S> explicit many(const S& s) : std::vector<T>(s.begin(), s.end()) {}
+    many& operator+=(const T& t) { this->push_back(t); return *this; }
+    many& operator<<(const T& t) { return *this += t; }
+    many operator+(const T& t) { many<T> l(*this); return l += t; }
+};
+
+template <class T, class S> bool operator==(const many<T>& m, const S& s) {
+    return m.size() == s.size() && S(m.begin(), m.end()) == s;
+}
+
+template <class T, class S> bool operator==(const S& s, const many<T>& m) {
+    return m.size() == s.size() && S(m.begin(), m.end()) == s;
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const many<T>& m) {
+    std::ostream_iterator<T> oi(o, " ");
+    std::copy(m.begin(), m.end(), oi);
+    return o;
+}
+
+}
+
+namespace std {
+template <class T> std::ostream& operator<<(std::ostream& o, const std::vector<T>& s) {
+    return o << test::many<T>(s);
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const std::deque<T>& s) {
+    return o << test::many<T>(s);
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const std::list<T>& s) {
+    return o << test::many<T>(s);
+}
+
+template <class K, class T> std::ostream& operator<<(std::ostream& o, const std::map<K, T>& x) {
+    return o << test::many<std::pair<K, T> >(x);
+}
+
+template <class U, class V> std::ostream& operator<<(std::ostream& o, const std::pair<U, V>& p) {
+    return o << "( " << p.first << " , " << p.second << " )";
+}
+
+#if PN_CPP_HAS_CPP11
+template <class K, class T> std::ostream& operator<<(std::ostream& o, const std::unordered_map<K, T>& x) {
+    return o << test::many<std::pair<const K, T> >(x);
+}
+
+template <class T> std::ostream& operator<<(std::ostream& o, const std::forward_list<T>& s) {
+    return o << test::many<T>(s);
+}
+#endif
+}
+
+#endif // TEST_BITS_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/test_dummy_container.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/test_dummy_container.hpp b/proton-c/bindings/cpp/src/include/test_dummy_container.hpp
new file mode 100644
index 0000000..4af432a
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/test_dummy_container.hpp
@@ -0,0 +1,83 @@
+#ifndef TEST_DUMMY_CONTAINER_HPP
+#define TEST_DUMMY_CONTAINER_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/container.hpp"
+#include "proton/event_loop.hpp"
+#include "proton/thread_safe.hpp"
+
+namespace test {
+
+using namespace proton;
+
+
+class dummy_container : public standard_container {
+  public:
+    dummy_container(const std::string cid="") :
+        id_(cid), fail("not implemented for dummy_container") {}
+
+    // Pull in base class functions here so that name search finds all the overloads
+    using standard_container::stop;
+    using standard_container::connect;
+    using standard_container::listen;
+    using standard_container::open_receiver;
+    using standard_container::open_sender;
+
+    returned<connection> connect(const std::string&, const connection_options&) { throw fail; }
+    listener listen(const std::string& , listen_handler& ) { throw fail; }
+    void stop_listening(const std::string&) { throw fail; }
+    void run() { throw fail; }
+    void auto_stop(bool) { throw fail; }
+    void stop(const proton::error_condition& ) { throw fail; }
+    returned<sender> open_sender(const std::string &, const proton::sender_options &, const connection_options&) { throw fail; }
+    returned<receiver> open_receiver( const std::string &, const proton::receiver_options &, const connection_options &) { throw fail; }
+    std::string id() const { return id_; }
+    void client_connection_options(const connection_options &o) { ccopts_ = o; }
+    connection_options client_connection_options() const { return ccopts_; }
+    void server_connection_options(const connection_options &o) { scopts_ = o; }
+    connection_options server_connection_options() const { return scopts_; }
+    void sender_options(const class sender_options &o) { sopts_ = o; }
+    class sender_options sender_options() const { return sopts_; }
+    void receiver_options(const class receiver_options &o) { ropts_ = o; }
+    class receiver_options receiver_options() const { return ropts_; }
+#if PN_CPP_HAS_STD_FUNCTION
+    void schedule(duration, std::function<void()>) { throw fail; }
+#endif
+    void schedule(duration, void_function0&) { throw fail; }
+
+  private:
+    std::string id_;
+    connection_options ccopts_, scopts_;
+    class sender_options sopts_;
+    class receiver_options ropts_;
+    std::runtime_error fail;
+};
+
+class dummy_event_loop : public event_loop {
+#if PN_CPP_HAS_CPP11
+    bool inject(std::function<void()> f) PN_CPP_OVERRIDE { f(); return true; }
+#endif
+    bool inject(proton::void_function0& h) PN_CPP_OVERRIDE { h(); return true; }
+};
+
+}
+
+#endif // TEST_DUMMY_CONTAINER_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/include/types_internal.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/include/types_internal.hpp b/proton-c/bindings/cpp/src/include/types_internal.hpp
new file mode 100644
index 0000000..bff93a0
--- /dev/null
+++ b/proton-c/bindings/cpp/src/include/types_internal.hpp
@@ -0,0 +1,74 @@
+#ifndef TYPES_INTERNAL_HPP
+#define TYPES_INTERNAL_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/internal/type_traits.hpp"
+#include "proton/error.hpp"
+#include "proton/binary.hpp"
+#include <sstream>
+
+///@file
+/// Inline helpers for encode/decode/type conversion/ostream operators.
+
+namespace proton {
+
+/// Byte copy between two objects, only enabled if their sizes are equal.
+template <class T, class U>
+typename internal::enable_if<sizeof(T) == sizeof(U)>::type byte_copy(T &to, const U &from) {
+    const char *p = reinterpret_cast<const char*>(&from);
+    std::copy(p, p + sizeof(T), reinterpret_cast<char*>(&to));
+}
+
+inline conversion_error
+make_conversion_error(type_id want, type_id got, const std::string& msg=std::string()) {
+    std::ostringstream s;
+    s << "unexpected type, want: " << want << " got: " << got;
+    if (!msg.empty()) s << ": " << msg;
+    return conversion_error(s.str());
+}
+
+/// Convert std::string to pn_bytes_t
+inline pn_bytes_t pn_bytes(const std::string& s) {
+    pn_bytes_t b = { s.size(), s.empty() ? 0 : const_cast<char*>(&s[0]) };
+    return b;
+}
+
+inline pn_bytes_t pn_bytes(const binary& s) {
+    pn_bytes_t b = { s.size(), s.empty() ? 0 : reinterpret_cast<const char*>(&s[0]) };
+    return b;
+}
+
+inline std::string str(const pn_bytes_t& b) { return std::string(b.start, b.size); }
+inline binary bin(const pn_bytes_t& b) { return binary(b.start, b.start+b.size); }
+
+// Save all stream format state, restore in destructor.
+struct ios_guard {
+    std::ios &guarded;
+    std::ios old;
+    ios_guard(std::ios& x) : guarded(x), old(0) { old.copyfmt(guarded); }
+    ~ios_guard() { guarded.copyfmt(old); }
+};
+
+// Convert a char (signed or unsigned) into an unsigned 1 byte integer that will ostream
+// as a numeric byte value, not a character and will not get sign-extended.
+inline unsigned int printable_byte(uint8_t byte) { return byte; }
+
+}
+#endif // TYPES_INTERNAL_HPP

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/messaging_adapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.hpp b/proton-c/bindings/cpp/src/messaging_adapter.hpp
deleted file mode 100644
index 5371eec..0000000
--- a/proton-c/bindings/cpp/src/messaging_adapter.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#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/messaging_handler.hpp"
-
-#include "proton_handler.hpp"
-
-#include <proton/event.h>
-#include <proton/reactor.h>
-
-///@cond INTERNAL
-
-namespace proton {
-
-/// Convert the low level proton-c events to the higher level proton::messaging_handler calls
-class messaging_adapter : public proton_handler
-{
-  public:
-    messaging_adapter(messaging_handler &delegate) : delegate_(delegate) {}
-
-    void on_reactor_init(proton_event &e);
-    void on_reactor_final(proton_event & e);
-    void on_link_flow(proton_event &e);
-    void on_delivery(proton_event &e);
-    void on_connection_remote_open(proton_event &e);
-    void on_connection_remote_close(proton_event &e);
-    void on_session_remote_open(proton_event &e);
-    void on_session_remote_close(proton_event &e);
-    void on_link_local_open(proton_event &e);
-    void on_link_remote_open(proton_event &e);
-    void on_link_remote_detach(proton_event & e);
-    void on_link_remote_close(proton_event &e);
-    void on_transport_closed(proton_event &e);
-
-  private:
-    messaging_handler &delegate_;  // The handler for generated messaging_event's
-};
-
-}
-///@endcond INTERNAL
-#endif  /*!PROTON_CPP_MESSAGING_ADAPTER_H*/

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8c3aa3a5/proton-c/bindings/cpp/src/msg.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/msg.hpp b/proton-c/bindings/cpp/src/msg.hpp
deleted file mode 100644
index b24b25c..0000000
--- a/proton-c/bindings/cpp/src/msg.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef PROTON_MSG_H
-#define PROTON_MSG_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 <sstream>
-#include <iostream>
-
-namespace proton {
-
-/** A simple facade for std::ostringstream that allows
- * in place construction of a message and automatic conversion
- * to string.
- * E.g.
- *@code
- * void foo(const std::string&);
- * foo(msg() << "hello " << 32);
- *@endcode
- * Will construct the string "hello 32" and pass it to foo()
- */
-struct msg {
-    std::ostringstream os;
-    msg() {}
-    msg(const msg& m) : os(m.str()) {}
-    std::string str() const { return os.str(); }
-    operator std::string() const { return str(); }
-    template <class T> msg& operator<<(const T& t) { os << t; return *this; }
-};
-
-inline std::ostream& operator<<(std::ostream& o, const msg& m) { return o << m.str(); }
-
-/** Construct a message using operator << and append (file:line) */
-#define QUOTe_(x) #x
-#define QUOTE(x) QUOTe_(x)
-#define MSG(message) (::proton::msg() << message)
-
-}
-
-#endif  /*!PROTON_MSG_H*/


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