You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/03/24 15:17:50 UTC

[3/5] qpid-proton git commit: PROTON-1164: [C++ binding] Change on_start(event&) -> on_container_start(event&, container&)

PROTON-1164: [C++ binding] Change on_start(event&) -> on_container_start(event&, container&)


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

Branch: refs/heads/master
Commit: 5c35609cc4613866c31e121deeb860266e9da8df
Parents: 9bdea3b
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Mar 23 23:08:10 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Mar 24 10:12:29 2016 -0400

----------------------------------------------------------------------
 examples/cpp/broker.cpp                         |  4 ++--
 examples/cpp/client.cpp                         |  4 ++--
 examples/cpp/connection_options.cpp             |  4 ++--
 examples/cpp/direct_recv.cpp                    |  4 ++--
 examples/cpp/direct_send.cpp                    |  4 ++--
 examples/cpp/engine/broker.cpp                  |  4 ++--
 examples/cpp/engine/simple_send.cpp             |  3 +--
 examples/cpp/helloworld.cpp                     |  4 ++--
 examples/cpp/helloworld_direct.cpp              |  6 ++---
 examples/cpp/queue_browser.cpp                  |  4 ++--
 examples/cpp/recurring_timer.cpp                |  4 ++--
 examples/cpp/selected_recv.cpp                  |  4 ++--
 examples/cpp/server.cpp                         |  4 ++--
 examples/cpp/server_direct.cpp                  |  4 ++--
 examples/cpp/simple_recv.cpp                    |  4 ++--
 examples/cpp/simple_send.cpp                    |  4 ++--
 examples/cpp/ssl.cpp                            | 10 ++++----
 examples/cpp/ssl_client_cert.cpp                | 10 ++++----
 .../bindings/cpp/include/proton/handler.hpp     |  3 ++-
 proton-c/bindings/cpp/src/handler.cpp           |  2 +-
 proton-c/bindings/cpp/src/messaging_adapter.cpp |  8 ++++---
 proton-c/bindings/cpp/src/messaging_event.cpp   |  2 +-
 proton-c/bindings/cpp/src/proton_event.cpp      |  6 ++---
 proton-c/bindings/cpp/src/proton_event.hpp      |  6 ++---
 tests/tools/apps/cpp/reactor_send.cpp           | 24 ++++++++++----------
 25 files changed, 67 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
index 39a725c..54b4d7d 100644
--- a/examples/cpp/broker.cpp
+++ b/examples/cpp/broker.cpp
@@ -45,8 +45,8 @@ class broker {
       public:
         my_handler(const proton::url& u, queues& qs) : broker_handler(qs), url_(u) {}
 
-        void on_start(proton::event &e) override {
-            e.container().listen(url_);
+        void on_container_start(proton::event &e, proton::container &c) override {
+            c.listen(url_);
             std::cout << "broker listening on " << url_ << std::endl;
         }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/client.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/client.cpp b/examples/cpp/client.cpp
index d026c51..c2ec499 100644
--- a/examples/cpp/client.cpp
+++ b/examples/cpp/client.cpp
@@ -40,8 +40,8 @@ class client : public proton::handler {
   public:
     client(const proton::url &u, const std::vector<std::string>& r) : url(u), requests(r) {}
 
-    void on_start(proton::event &e) override {
-        sender = e.container().open_sender(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        sender = c.open_sender(url);
         // Create a receiver with a dynamically chosen unique address.
         receiver = sender.connection().open_receiver("", proton::link_options().dynamic_address(true));
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/connection_options.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/connection_options.cpp b/examples/cpp/connection_options.cpp
index 26e6216..5be84d4 100644
--- a/examples/cpp/connection_options.cpp
+++ b/examples/cpp/connection_options.cpp
@@ -48,10 +48,10 @@ class main_handler : public proton::handler {
   public:
     main_handler(const proton::url& u) : url(u) {}
 
-    void on_start(proton::event &e) override {
+    void on_container_start(proton::event &e, proton::container &c) override {
         // Connection options for this connection.  Merged with and overriding the container's
         // client_connection_options() settings.
-        e.container().connect(url, connection_options().handler(&conn_handler).max_frame_size(2468));
+        c.connect(url, connection_options().handler(&conn_handler).max_frame_size(2468));
     }
 
     void on_connection_open(proton::event &e, proton::connection &c) override {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/direct_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_recv.cpp b/examples/cpp/direct_recv.cpp
index 282566b..b2df2cc 100644
--- a/examples/cpp/direct_recv.cpp
+++ b/examples/cpp/direct_recv.cpp
@@ -44,8 +44,8 @@ class direct_recv : public proton::handler {
   public:
     direct_recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
 
-    void on_start(proton::event &e) override {
-        acceptor = e.container().listen(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        acceptor = c.listen(url);
         std::cout << "direct_recv listening on " << url << std::endl;
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/direct_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_send.cpp b/examples/cpp/direct_send.cpp
index cc8ede9..12ba70e 100644
--- a/examples/cpp/direct_send.cpp
+++ b/examples/cpp/direct_send.cpp
@@ -44,8 +44,8 @@ class simple_send : public proton::handler {
   public:
     simple_send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
 
-    void on_start(proton::event &e) override {
-        acceptor = e.container().listen(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        acceptor = c.listen(url);
         std::cout << "direct_send listening on " << url << std::endl;
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/engine/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/broker.cpp b/examples/cpp/engine/broker.cpp
index 78bcbb4..21aa8fb 100644
--- a/examples/cpp/engine/broker.cpp
+++ b/examples/cpp/engine/broker.cpp
@@ -141,8 +141,8 @@ class broker {
       public:
         my_handler(const proton::url& u, queues& qs) : broker_handler(qs), url_(u) {}
 
-        void on_start(proton::event &e) override {
-            e.container().listen(url_);
+        void on_container_start(proton::event &e, proton::container &c) override {
+            c.listen(url_);
             std::cout << "broker listening on " << url_ << std::endl;
         }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/engine/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/simple_send.cpp b/examples/cpp/engine/simple_send.cpp
index 6a4f421..ef8a5b1 100644
--- a/examples/cpp/engine/simple_send.cpp
+++ b/examples/cpp/engine/simple_send.cpp
@@ -36,7 +36,6 @@
 class simple_send : public proton::handler {
   private:
     proton::url url;
-    proton::sender sender;
     int sent;
     int confirmed;
     int total;
@@ -45,7 +44,7 @@ class simple_send : public proton::handler {
     simple_send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
 
     void on_connection_open(proton::event &e, proton::connection &c) override {
-        sender = c.open_sender(url.path());
+        c.open_sender(url.path());
     }
 
     void on_sendable(proton::event &e, proton::sender &sender) override {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld.cpp b/examples/cpp/helloworld.cpp
index 4847819..f38037c 100644
--- a/examples/cpp/helloworld.cpp
+++ b/examples/cpp/helloworld.cpp
@@ -35,8 +35,8 @@ class hello_world : public proton::handler {
   public:
     hello_world(const proton::url& u) : url(u) {}
 
-    void on_start(proton::event &e) override {
-        proton::connection conn = e.container().connect(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        proton::connection conn = c.connect(url);
         conn.open_receiver(url.path());
         conn.open_sender(url.path());
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/helloworld_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp
index 23d9c87..a87d87b 100644
--- a/examples/cpp/helloworld_direct.cpp
+++ b/examples/cpp/helloworld_direct.cpp
@@ -36,9 +36,9 @@ class hello_world_direct : public proton::handler {
   public:
     hello_world_direct(const proton::url& u) : url(u) {}
 
-    void on_start(proton::event &e) override {
-        acceptor = e.container().listen(url);
-        e.container().open_sender(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        acceptor = c.listen(url);
+        c.open_sender(url);
     }
 
     void on_sendable(proton::event &e, proton::sender &s) override {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/queue_browser.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/queue_browser.cpp b/examples/cpp/queue_browser.cpp
index 369404d..b160773 100644
--- a/examples/cpp/queue_browser.cpp
+++ b/examples/cpp/queue_browser.cpp
@@ -36,8 +36,8 @@ class browser : public proton::handler {
   public:
     browser(const proton::url& u) : url(u) {}
 
-    void on_start(proton::event &e) override {
-        proton::connection conn = e.container().connect(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        proton::connection conn = c.connect(url);
         conn.open_receiver(url.path(), proton::link_options().browsing(true));
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/recurring_timer.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/recurring_timer.cpp b/examples/cpp/recurring_timer.cpp
index 2819802..540bab4 100644
--- a/examples/cpp/recurring_timer.cpp
+++ b/examples/cpp/recurring_timer.cpp
@@ -60,10 +60,10 @@ class recurring : public proton::handler {
         return e.container().schedule(tick_ms * 3, &tock_handler);
     }
 
-    void on_start(proton::event &e) override {
+    void on_container_start(proton::event &e, proton::container &c) override {
         // Demonstrate cancel(), we will cancel the first tock on the first recurring::on_timer_task
         cancel_task = ticktock(e);
-        e.container().schedule(0);
+        c.schedule(0);
     }
 
     void on_timer(proton::event &e) override {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/selected_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/selected_recv.cpp b/examples/cpp/selected_recv.cpp
index 32bcf7e..23dee01 100644
--- a/examples/cpp/selected_recv.cpp
+++ b/examples/cpp/selected_recv.cpp
@@ -36,8 +36,8 @@ class selected_recv : public proton::handler {
   public:
     selected_recv(const proton::url& u) : url(u) {}
 
-    void on_start(proton::event &e) override {
-        proton::connection conn = e.container().connect(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        proton::connection conn = c.connect(url);
         conn.open_receiver(url.path(), proton::link_options().selector("colour = 'green'"));
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server.cpp b/examples/cpp/server.cpp
index 29534d4..95938ee 100644
--- a/examples/cpp/server.cpp
+++ b/examples/cpp/server.cpp
@@ -44,8 +44,8 @@ class server : public proton::handler {
   public:
     server(const std::string &u) : url(u) {}
 
-    void on_start(proton::event &e) override {
-        connection = e.container().connect(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        connection = c.connect(url);
         connection.open_receiver(url.path());
 
         std::cout << "server connected to " << url << std::endl;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/server_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server_direct.cpp b/examples/cpp/server_direct.cpp
index a99adc0..3dff34a 100644
--- a/examples/cpp/server_direct.cpp
+++ b/examples/cpp/server_direct.cpp
@@ -45,8 +45,8 @@ class server : public proton::handler {
   public:
     server(const std::string &u) : url(u), address_counter(0) {}
 
-    void on_start(proton::event &e) override {
-        e.container().listen(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        c.listen(url);
         std::cout << "server listening on " << url << std::endl;
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 1d4ba91..32f9417 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -43,8 +43,8 @@ class simple_recv : public proton::handler {
   public:
     simple_recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
 
-    void on_start(proton::event &e) override {
-        receiver = e.container().open_receiver(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        receiver = c.open_receiver(url);
         std::cout << "simple_recv listening on " << url << std::endl;
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp
index e5e795e..95a6601 100644
--- a/examples/cpp/simple_send.cpp
+++ b/examples/cpp/simple_send.cpp
@@ -43,8 +43,8 @@ class simple_send : public proton::handler {
   public:
     simple_send(const std::string &s, int c) : url(s), sent(0), confirmed(0), total(c) {}
 
-    void on_start(proton::event &e) override {
-        sender = e.container().open_sender(url);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        sender = c.open_sender(url);
     }
 
     void on_sendable(proton::event &e, proton::sender &sender) override {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/ssl.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/ssl.cpp b/examples/cpp/ssl.cpp
index 6098b8e..b792114 100644
--- a/examples/cpp/ssl.cpp
+++ b/examples/cpp/ssl.cpp
@@ -67,13 +67,13 @@ class hello_world_direct : public proton::handler {
   public:
     hello_world_direct(const proton::url& u) : url(u) {}
 
-    void on_start(proton::event &e) override {
+    void on_container_start(proton::event &e, proton::container &c) override {
         // Configure listener.  Details vary by platform.
         ssl_certificate server_cert = platform_certificate("tserver", "tserverpw");
         ssl_server_options ssl_srv(server_cert);
         connection_options server_opts;
         server_opts.ssl_server_options(ssl_srv).handler(&s_handler);
-        e.container().server_connection_options(server_opts);
+        c.server_connection_options(server_opts);
 
         // Configure client with a Certificate Authority database populated with the server's self signed certificate.
         // Since the test certifcate's credentials are unlikely to match this host's name, downgrade the verification
@@ -81,10 +81,10 @@ class hello_world_direct : public proton::handler {
         connection_options client_opts;
         ssl_client_options ssl_cli(platform_CA("tserver"), proton::ssl::VERIFY_PEER);
         client_opts.ssl_client_options(ssl_cli);
-        e.container().client_connection_options(client_opts);
+        c.client_connection_options(client_opts);
 
-        s_handler.acceptor = e.container().listen(url);
-        e.container().open_sender(url);
+        s_handler.acceptor = c.listen(url);
+        c.open_sender(url);
     }
 
     void on_connection_open(proton::event &e, proton::connection &c) override {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/examples/cpp/ssl_client_cert.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/ssl_client_cert.cpp b/examples/cpp/ssl_client_cert.cpp
index a15e49b..5c2b3ef 100644
--- a/examples/cpp/ssl_client_cert.cpp
+++ b/examples/cpp/ssl_client_cert.cpp
@@ -77,7 +77,7 @@ class hello_world_direct : public proton::handler {
   public:
     hello_world_direct(const proton::url& u) : url(u) {}
 
-    void on_start(proton::event &e) override {
+    void on_container_start(proton::event &e, proton::container &c) override {
         // Configure listener.  Details vary by platform.
         ssl_certificate server_cert = platform_certificate("tserver", "tserverpw");
         std::string client_CA = platform_CA("tclient");
@@ -86,7 +86,7 @@ class hello_world_direct : public proton::handler {
         connection_options server_opts;
         server_opts.ssl_server_options(srv_ssl).handler(&s_handler);
         server_opts.sasl_allowed_mechs("EXTERNAL");
-        e.container().server_connection_options(server_opts);
+        c.server_connection_options(server_opts);
 
         // Configure client.
         ssl_certificate client_cert = platform_certificate("tclient", "tclientpw");
@@ -96,10 +96,10 @@ class hello_world_direct : public proton::handler {
         ssl_client_options ssl_cli(client_cert, server_CA, proton::ssl::VERIFY_PEER);
         connection_options client_opts;
         client_opts.ssl_client_options(ssl_cli).sasl_allowed_mechs("EXTERNAL");
-        e.container().client_connection_options(client_opts);
+        c.client_connection_options(client_opts);
 
-        s_handler.inbound_listener = e.container().listen(url);
-        e.container().open_sender(url);
+        s_handler.inbound_listener = c.listen(url);
+        c.open_sender(url);
     }
 
     void on_connection_open(proton::event &e, proton::connection &c) override {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/proton-c/bindings/cpp/include/proton/handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/handler.hpp b/proton-c/bindings/cpp/include/proton/handler.hpp
index aaed559..c9a8910 100644
--- a/proton-c/bindings/cpp/include/proton/handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/handler.hpp
@@ -29,6 +29,7 @@
 namespace proton {
 
 class condition;
+class container;
 class event;
 class transport;
 class connection;
@@ -63,7 +64,7 @@ PN_CPP_CLASS_EXTERN handler
     /// @{
 
     /// The event loop is starting.
-    PN_CPP_EXTERN virtual void on_start(event &e);
+    PN_CPP_EXTERN virtual void on_container_start(event &e, container &c);
     /// A message is received.
     PN_CPP_EXTERN virtual void on_message(event &e, message &m);
     /// A message can be sent.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/proton-c/bindings/cpp/src/handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/handler.cpp b/proton-c/bindings/cpp/src/handler.cpp
index 87a9075..920ee12 100644
--- a/proton-c/bindings/cpp/src/handler.cpp
+++ b/proton-c/bindings/cpp/src/handler.cpp
@@ -36,7 +36,7 @@ handler::handler() : messaging_adapter_(new messaging_adapter(*this)) {}
 
 handler::~handler(){}
 
-void handler::on_start(event &e) { on_unhandled(e); }
+void handler::on_container_start(event &e, container &) { on_unhandled(e); }
 void handler::on_message(event &e, message &) { on_unhandled(e); }
 void handler::on_sendable(event &e, sender &) { on_unhandled(e); }
 void handler::on_timer(event &e) { on_unhandled(e); }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/proton-c/bindings/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp
index f280330..bfab77d 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -58,7 +58,9 @@ messaging_adapter::~messaging_adapter(){}
 
 void messaging_adapter::on_reactor_init(proton_event &pe) {
     messaging_event mevent(messaging_event::START, pe);
-    delegate_.on_start(mevent);
+    // Container specific event
+    if (pe.container())
+        delegate_.on_container_start(mevent, *pe.container());
 }
 
 void messaging_adapter::on_link_flow(proton_event &pe) {
@@ -227,8 +229,8 @@ void messaging_adapter::on_link_remote_open(proton_event &pe) {
     }
     if (!is_local_open(pn_link_state(lnk)) && is_local_unititialised(pn_link_state(lnk))) {
         link l(lnk);
-        if (pe.container_)
-            l.open(pe.container_->impl_->link_options_);
+        if (pe.container())
+            l.open(pe.container()->impl_->link_options_);
         else
             l.open();    // No default for engine
     }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/proton-c/bindings/cpp/src/messaging_event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_event.cpp b/proton-c/bindings/cpp/src/messaging_event.cpp
index 96fcf78..bf491c9 100644
--- a/proton-c/bindings/cpp/src/messaging_event.cpp
+++ b/proton-c/bindings/cpp/src/messaging_event.cpp
@@ -52,7 +52,7 @@ messaging_event::event_type messaging_event::type() const { return type_; }
 
 container& messaging_event::container() const {
     if (parent_event_)
-        return parent_event_->container();
+        return *parent_event_->container();
     throw error(MSG("No container context for event"));
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/proton-c/bindings/cpp/src/proton_event.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_event.cpp b/proton-c/bindings/cpp/src/proton_event.cpp
index c11d9fd..8148eef 100644
--- a/proton-c/bindings/cpp/src/proton_event.cpp
+++ b/proton-c/bindings/cpp/src/proton_event.cpp
@@ -49,10 +49,8 @@ std::string proton_event::name() const { return pn_event_type_name(pn_event_type
 
 pn_event_t *proton_event::pn_event() const { return pn_event_; }
 
-container& proton_event::container() const {
-    if (!container_)
-        throw error(MSG("No container context for this event"));
-    return *container_;
+container* proton_event::container() const {
+    return container_;
 }
 
 transport proton_event::transport() const {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/proton-c/bindings/cpp/src/proton_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_event.hpp b/proton-c/bindings/cpp/src/proton_event.hpp
index c671eb9..781f298 100644
--- a/proton-c/bindings/cpp/src/proton_event.hpp
+++ b/proton-c/bindings/cpp/src/proton_event.hpp
@@ -274,7 +274,8 @@ class proton_event
 
     void dispatch(proton_handler& h);
 
-    class container& container() const;
+    class container* container() const;
+
     class transport transport() const;
     class connection connection() const;
     class session session() const;
@@ -292,9 +293,6 @@ class proton_event
     mutable pn_event_t *pn_event_;
     event_type type_;
     class container *container_;
-  friend class messaging_event;
-  friend class connection_engine;
-  friend class messaging_adapter;
 };
 
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c35609c/tests/tools/apps/cpp/reactor_send.cpp
----------------------------------------------------------------------
diff --git a/tests/tools/apps/cpp/reactor_send.cpp b/tests/tools/apps/cpp/reactor_send.cpp
index 5700c73..541de1c 100644
--- a/tests/tools/apps/cpp/reactor_send.cpp
+++ b/tests/tools/apps/cpp/reactor_send.cpp
@@ -37,6 +37,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#if __cplusplus < 201103L
+#define override
+#endif
 
 class reactor_send : public proton::handler {
   private:
@@ -63,14 +66,12 @@ class reactor_send : public proton::handler {
         message_.body(content);
     }
 
-    void on_start(proton::event &e) {
-        e.container().link_options(proton::link_options().credit_window(1024));
-        e.container().open_sender(url_);
+    void on_container_start(proton::event &e, proton::container &c) override {
+        c.link_options(proton::link_options().credit_window(1024));
+        c.open_sender(url_);
     }
 
-    void on_sendable(proton::event &e) {
-        proton::sender sender = e.sender();
-
+    void on_sendable(proton::event &e, proton::sender &sender) override {
         while (sender.credit() && sent_ < total_) {
             id_value_ = sent_ + 1;
             message_.correlation_id(id_value_);
@@ -80,18 +81,17 @@ class reactor_send : public proton::handler {
         }
     }
 
-    void on_accepted(proton::event &e) {
+    void on_delivery_accept(proton::event &e, proton::delivery &d) override {
         confirmed_++;
-        e.delivery().settle();
+        d.settle();
         if (confirmed_ == total_) {
             std::cout << "all messages confirmed" << std::endl;
             if (!replying_)
-                e.connection().close();
+                d.link().connection().close();
         }
     }
 
-    void on_message(proton::event &e) {
-        proton::message &msg = e.message();
+    void on_message(proton::event &e, proton::message &msg) override {
         received_content_ = proton::get<proton::binary>(msg.body());
         received_bytes_ += received_content_.size();
         if (received_ < total_) {
@@ -104,7 +104,7 @@ class reactor_send : public proton::handler {
         }
     }
 
-    void on_disconnected(proton::event &e) {
+    void on_transport_close(proton::event &e, proton::transport &) override {
         sent_ = confirmed_;
     }
 };


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