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/04/07 23:28:28 UTC
[1/3] qpid-proton git commit: PROTON-1164: [C++ binding] Remove the
proton::event parameter from handler invocations - It was no longer needed as
there is now always a parameter that gives you access to the object tree. -
Consequently removed the proto
Repository: qpid-proton
Updated Branches:
refs/heads/master 38bf12f9b -> ac5d3c687
PROTON-1164: [C++ binding] Remove the proton::event parameter from handler invocations
- It was no longer needed as there is now always a parameter that gives you
access to the object tree.
- Consequently removed the proton::event interface
and its implementation class proton::messaging_event
- Fixed all the examples
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/edd8bc57
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/edd8bc57
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/edd8bc57
Branch: refs/heads/master
Commit: edd8bc57b41f77752779110790a4399cc91eebd5
Parents: 38bf12f
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Apr 6 15:17:08 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Apr 7 17:10:12 2016 -0400
----------------------------------------------------------------------
examples/cpp/broker.cpp | 2 +-
examples/cpp/broker.hpp | 24 ++--
examples/cpp/client.cpp | 7 +-
examples/cpp/connection_options.cpp | 10 +-
examples/cpp/direct_recv.cpp | 9 +-
examples/cpp/direct_send.cpp | 9 +-
examples/cpp/engine/broker.cpp | 2 +-
examples/cpp/engine/client.cpp | 7 +-
examples/cpp/engine/direct_recv.cpp | 3 +-
examples/cpp/engine/direct_send.cpp | 7 +-
examples/cpp/engine/helloworld.cpp | 7 +-
examples/cpp/engine/server.cpp | 5 +-
examples/cpp/engine/simple_recv.cpp | 5 +-
examples/cpp/engine/simple_send.cpp | 9 +-
examples/cpp/helloworld.cpp | 8 +-
examples/cpp/helloworld_direct.cpp | 14 ++-
examples/cpp/queue_browser.cpp | 6 +-
examples/cpp/recurring_timer.cpp | 9 +-
examples/cpp/selected_recv.cpp | 6 +-
examples/cpp/server.cpp | 5 +-
examples/cpp/server_direct.cpp | 8 +-
examples/cpp/simple_recv.cpp | 9 +-
examples/cpp/simple_send.cpp | 11 +-
examples/cpp/ssl.cpp | 18 +--
examples/cpp/ssl_client_cert.cpp | 20 +--
proton-c/bindings/cpp/CMakeLists.txt | 1 -
proton-c/bindings/cpp/include/proton/event.hpp | 95 --------------
.../bindings/cpp/include/proton/handler.hpp | 48 ++++----
proton-c/bindings/cpp/src/container.cpp | 1 -
proton-c/bindings/cpp/src/container_impl.cpp | 3 +-
proton-c/bindings/cpp/src/engine_test.cpp | 13 +-
proton-c/bindings/cpp/src/handler.cpp | 49 ++++----
.../bindings/cpp/src/io/connection_engine.cpp | 3 +-
proton-c/bindings/cpp/src/messaging_adapter.cpp | 68 ++++------
proton-c/bindings/cpp/src/messaging_event.cpp | 123 -------------------
proton-c/bindings/cpp/src/messaging_event.hpp | 94 --------------
proton-c/bindings/cpp/src/proton_event.hpp | 1 -
tests/tools/apps/cpp/reactor_send.cpp | 11 +-
38 files changed, 190 insertions(+), 540 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
index 54b4d7d..37839c6 100644
--- a/examples/cpp/broker.cpp
+++ b/examples/cpp/broker.cpp
@@ -45,7 +45,7 @@ class broker {
public:
my_handler(const proton::url& u, queues& qs) : broker_handler(qs), url_(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(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/edd8bc57/examples/cpp/broker.hpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.hpp b/examples/cpp/broker.hpp
index f5751e1..ff88976 100644
--- a/examples/cpp/broker.hpp
+++ b/examples/cpp/broker.hpp
@@ -27,9 +27,9 @@
/// The examples add functionality as needed, this helps to make it
/// easier to see the important differences between the examples.
-#include "proton/event.hpp"
-#include "proton/message.hpp"
+#include "proton/connection.hpp"
#include "proton/handler.hpp"
+#include "proton/message.hpp"
#include "proton/sender.hpp"
#include "proton/transport.hpp"
#include "proton/url.hpp"
@@ -154,7 +154,7 @@ class broker_handler : public proton::handler {
public:
broker_handler(queues& qs) : queues_(qs) {}
- void on_sender_open(proton::event &e, proton::sender &sender) override {
+ void on_sender_open(proton::sender &sender) override {
proton::terminus remote_source(sender.remote_source());
queue &q = remote_source.dynamic() ?
queues_.dynamic() : queues_.get(remote_source.address());
@@ -164,7 +164,7 @@ class broker_handler : public proton::handler {
std::cout << "broker outgoing link from " << q.name() << std::endl;
}
- void on_receiver_open(proton::event &e, proton::receiver &receiver) override {
+ void on_receiver_open(proton::receiver &receiver) override {
std::string address = receiver.remote_target().address();
if (!address.empty()) {
receiver.local_target().address(address);
@@ -180,24 +180,24 @@ class broker_handler : public proton::handler {
}
}
- void on_sender_close(proton::event &e, proton::sender &sender) override {
+ void on_sender_close(proton::sender &sender) override {
unsubscribe(sender);
}
- void on_connection_close(proton::event &e, proton::connection &c) override {
+ void on_connection_close(proton::connection &c) override {
remove_stale_consumers(c);
}
- void on_transport_close(proton::event &e, proton::transport &t) override {
+ void on_transport_close(proton::transport &t) override {
remove_stale_consumers(t.connection());
}
- void on_transport_error(proton::event &e, proton::transport &t) override {
+ void on_transport_error(proton::transport &t) override {
std::cout << "broker client disconnect: " << t.condition().what() << std::endl;
}
- void on_unhandled_error(proton::event &e, const proton::condition &c) override {
- std::cerr << "broker error: " << e.name() << ":" << c.what() << std::endl;
+ void on_unhandled_error(const proton::condition &c) override {
+ std::cerr << "broker error: " << c.what() << std::endl;
}
void remove_stale_consumers(proton::connection connection) {
@@ -208,13 +208,13 @@ class broker_handler : public proton::handler {
}
}
- void on_sendable(proton::event &e, proton::sender &s) override {
+ void on_sendable(proton::sender &s) override {
std::string address = s.local_source().address();
queues_.get(address).dispatch(&s);
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::string address = d.link().local_target().address();
queues_.get(address).publish(m, d.link().receiver());
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/client.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/client.cpp b/examples/cpp/client.cpp
index 1b6bd2b..edf6ab3 100644
--- a/examples/cpp/client.cpp
+++ b/examples/cpp/client.cpp
@@ -21,7 +21,6 @@
#include "options.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/connection.hpp"
@@ -40,7 +39,7 @@ class client : public proton::handler {
public:
client(const proton::url &u, const std::vector<std::string>& r) : url(u), requests(r) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(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));
@@ -54,11 +53,11 @@ class client : public proton::handler {
sender.send(req);
}
- void on_receiver_open(proton::event &e, proton::receiver &) override {
+ void on_receiver_open(proton::receiver &) override {
send_request();
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &response) override {
+ void on_message(proton::delivery &d, proton::message &response) override {
if (requests.empty()) return; // Spurious extra message!
std::cout << requests.front() << " => " << response.body() << std::endl;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/connection_options.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/connection_options.cpp b/examples/cpp/connection_options.cpp
index 5be84d4..2002030 100644
--- a/examples/cpp/connection_options.cpp
+++ b/examples/cpp/connection_options.cpp
@@ -19,9 +19,9 @@
*
*/
+#include "proton/connection.hpp"
#include "proton/container.hpp"
#include "proton/handler.hpp"
-#include "proton/event.hpp"
#include "proton/url.hpp"
#include "proton/transport.hpp"
@@ -32,9 +32,9 @@ using proton::connection_options;
#include "fake_cpp11.hpp"
class handler_2 : public proton::handler {
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
std::cout << "connection events going to handler_2" << std::endl;
- std::cout << "connection max_frame_size: " << e.connection().transport().max_frame_size() <<
+ std::cout << "connection max_frame_size: " << c.transport().max_frame_size() <<
", idle timeout: " << c.transport().idle_timeout() << std::endl;
c.close();
}
@@ -48,13 +48,13 @@ class main_handler : public proton::handler {
public:
main_handler(const proton::url& u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
// Connection options for this connection. Merged with and overriding the container's
// client_connection_options() settings.
c.connect(url, connection_options().handler(&conn_handler).max_frame_size(2468));
}
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
std::cout << "unexpected connection event on main handler" << std::endl;
c.close();
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/direct_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_recv.cpp b/examples/cpp/direct_recv.cpp
index e67039d..b424ef3 100644
--- a/examples/cpp/direct_recv.cpp
+++ b/examples/cpp/direct_recv.cpp
@@ -21,9 +21,10 @@
#include "options.hpp"
-#include "proton/container.hpp"
#include "proton/acceptor.hpp"
-#include "proton/event.hpp"
+#include "proton/connection.hpp"
+#include "proton/container.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
#include "proton/link.hpp"
#include "proton/url.hpp"
@@ -44,12 +45,12 @@ class direct_recv : public proton::handler {
public:
direct_recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
acceptor = c.listen(url);
std::cout << "direct_recv listening on " << url << std::endl;
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &msg) override {
+ void on_message(proton::delivery &d, proton::message &msg) override {
if (proton::coerce<uint64_t>(msg.id()) < received) {
return; // Ignore duplicate
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/direct_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_send.cpp b/examples/cpp/direct_send.cpp
index 37038fe..c5a0879 100644
--- a/examples/cpp/direct_send.cpp
+++ b/examples/cpp/direct_send.cpp
@@ -24,7 +24,6 @@
#include "proton/acceptor.hpp"
#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/value.hpp"
@@ -44,12 +43,12 @@ 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_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
acceptor = c.listen(url);
std::cout << "direct_send listening on " << url << std::endl;
}
- void on_sendable(proton::event &e, proton::sender &sender) override {
+ void on_sendable(proton::sender &sender) override {
while (sender.credit() && sent < total) {
proton::message msg;
std::map<std::string, int> m;
@@ -63,7 +62,7 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
confirmed++;
if (confirmed == total) {
@@ -74,7 +73,7 @@ class simple_send : public proton::handler {
}
}
- void on_transport_close(proton::event &e, proton::transport &) override {
+ void on_transport_close(proton::transport &) override {
sent = confirmed;
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/engine/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/broker.cpp b/examples/cpp/engine/broker.cpp
index 21aa8fb..bfe84fc 100644
--- a/examples/cpp/engine/broker.cpp
+++ b/examples/cpp/engine/broker.cpp
@@ -141,7 +141,7 @@ class broker {
public:
my_handler(const proton::url& u, queues& qs) : broker_handler(qs), url_(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(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/edd8bc57/examples/cpp/engine/client.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/client.cpp b/examples/cpp/engine/client.cpp
index 2384bf0..3ba6013 100644
--- a/examples/cpp/engine/client.cpp
+++ b/examples/cpp/engine/client.cpp
@@ -22,7 +22,6 @@
#include "options.hpp"
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/connection.hpp"
@@ -41,7 +40,7 @@ class client : public proton::handler {
public:
client(const proton::url &u, const std::vector<std::string>& r) : url(u), requests(r) {}
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
sender = c.open_sender(url.path());
receiver = c.open_receiver("", proton::link_options().dynamic_address(true));
}
@@ -53,11 +52,11 @@ class client : public proton::handler {
sender.send(req);
}
- void on_receiver_open(proton::event &e, proton::receiver &) override {
+ void on_receiver_open(proton::receiver &) override {
send_request();
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &response) override {
+ void on_message(proton::delivery &d, proton::message &response) override {
if (requests.empty()) return; // Spurious extra message!
std::cout << requests.front() << " => " << response.body() << std::endl;
requests.erase(requests.begin());
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/engine/direct_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/direct_recv.cpp b/examples/cpp/engine/direct_recv.cpp
index 64cd26e..77d4d0c 100644
--- a/examples/cpp/engine/direct_recv.cpp
+++ b/examples/cpp/engine/direct_recv.cpp
@@ -22,7 +22,6 @@
#include "options.hpp"
#include "proton/io/socket.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/link.hpp"
#include "proton/url.hpp"
@@ -41,7 +40,7 @@ class direct_recv : public proton::handler {
public:
direct_recv(int c) : expected(c), received(0) {}
- void on_message(proton::event &e, proton::delivery &d, proton::message &msg) override {
+ void on_message(proton::delivery &d, proton::message &msg) override {
if (msg.id().get<uint64_t>() < received)
return; // ignore duplicate
if (expected == 0 || received < expected) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/engine/direct_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/direct_send.cpp b/examples/cpp/engine/direct_send.cpp
index d05958d..1a07b31 100644
--- a/examples/cpp/engine/direct_send.cpp
+++ b/examples/cpp/engine/direct_send.cpp
@@ -25,7 +25,6 @@
#include "proton/connection.hpp"
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/value.hpp"
@@ -42,7 +41,7 @@ class simple_send : public proton::handler {
public:
simple_send(int c) : sent(0), confirmed(0), total(c) {}
- void on_sendable(proton::event &e, proton::sender &sender) override {
+ void on_sendable(proton::sender &sender) override {
while (sender.credit() && sent < total) {
proton::message msg;
msg.id(sent + 1);
@@ -54,7 +53,7 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
confirmed++;
if (confirmed == total) {
std::cout << "all messages confirmed" << std::endl;
@@ -62,7 +61,7 @@ class simple_send : public proton::handler {
}
}
- void on_transport_close(proton::event &e, proton::transport &) override {
+ void on_transport_close(proton::transport &) override {
sent = confirmed;
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/engine/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/helloworld.cpp b/examples/cpp/engine/helloworld.cpp
index 48b0417..2c9126c 100644
--- a/examples/cpp/engine/helloworld.cpp
+++ b/examples/cpp/engine/helloworld.cpp
@@ -19,7 +19,6 @@
*
*/
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/url.hpp"
#include "proton/io/socket.hpp"
@@ -35,18 +34,18 @@ class hello_world : public proton::handler {
public:
hello_world(const std::string& address) : address_(address) {}
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
c.open_receiver(address_);
c.open_sender(address_);
}
- void on_sendable(proton::event &e, proton::sender &s) override {
+ void on_sendable(proton::sender &s) override {
proton::message m("Hello World!");
s.send(m);
s.close();
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
d.connection().close();
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/engine/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/server.cpp b/examples/cpp/engine/server.cpp
index 33becec..0898393 100644
--- a/examples/cpp/engine/server.cpp
+++ b/examples/cpp/engine/server.cpp
@@ -24,7 +24,6 @@
#include "proton/connection.hpp"
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/url.hpp"
@@ -45,7 +44,7 @@ class server : public proton::handler {
server(const std::string &u) : url(u) {}
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
c.open_receiver(url.path());
std::cout << "server connected to " << url << std::endl;
}
@@ -57,7 +56,7 @@ class server : public proton::handler {
return uc;
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << "Received " << m.body() << std::endl;
std::string reply_to = m.reply_to();
proton::message reply;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/engine/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/simple_recv.cpp b/examples/cpp/engine/simple_recv.cpp
index 184857a..10ab78a 100644
--- a/examples/cpp/engine/simple_recv.cpp
+++ b/examples/cpp/engine/simple_recv.cpp
@@ -23,7 +23,6 @@
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/link.hpp"
#include "proton/value.hpp"
@@ -44,12 +43,12 @@ class simple_recv : public proton::handler {
simple_recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
receiver = c.open_receiver(url.path());
std::cout << "simple_recv listening on " << url << std::endl;
}
- void on_message(proton::event &e, proton::delivery& d, proton::message &msg) override {
+ void on_message(proton::delivery& d, proton::message &msg) override {
if (msg.id().get<uint64_t>() < received)
return; // ignore duplicate
if (expected == 0 || received < expected) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/engine/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/engine/simple_send.cpp b/examples/cpp/engine/simple_send.cpp
index 16e4743..bf6efa1 100644
--- a/examples/cpp/engine/simple_send.cpp
+++ b/examples/cpp/engine/simple_send.cpp
@@ -23,7 +23,6 @@
#include "proton/io/socket.hpp"
#include "proton/url.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/connection.hpp"
#include "proton/value.hpp"
@@ -43,11 +42,11 @@ 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 {
+ void on_connection_open(proton::connection &c) override {
c.open_sender(url.path());
}
- void on_sendable(proton::event &e, proton::sender &sender) override {
+ void on_sendable(proton::sender &sender) override {
while (sender.credit() && sent < total) {
proton::message msg;
msg.id(sent + 1);
@@ -59,7 +58,7 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
confirmed++;
if (confirmed == total) {
std::cout << "all messages confirmed" << std::endl;
@@ -67,7 +66,7 @@ class simple_send : public proton::handler {
}
}
- void on_transport_close(proton::event &e, proton::transport &) override {
+ void on_transport_close(proton::transport &) override {
sent = confirmed;
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/helloworld.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld.cpp b/examples/cpp/helloworld.cpp
index 75cb0db..a2f1fc8 100644
--- a/examples/cpp/helloworld.cpp
+++ b/examples/cpp/helloworld.cpp
@@ -19,8 +19,8 @@
*
*/
+#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/url.hpp"
@@ -35,19 +35,19 @@ class hello_world : public proton::handler {
public:
hello_world(const proton::url& u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
proton::connection conn = c.connect(url);
conn.open_receiver(url.path());
conn.open_sender(url.path());
}
- void on_sendable(proton::event &e, proton::sender &s) override {
+ void on_sendable(proton::sender &s) override {
proton::message m("Hello World!");
s.send(m);
s.close();
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
d.connection().close();
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/helloworld_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/helloworld_direct.cpp b/examples/cpp/helloworld_direct.cpp
index 762a179..42986de 100644
--- a/examples/cpp/helloworld_direct.cpp
+++ b/examples/cpp/helloworld_direct.cpp
@@ -20,9 +20,11 @@
*/
#include "proton/acceptor.hpp"
+#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
+#include "proton/sender.hpp"
#include <iostream>
@@ -36,26 +38,26 @@ class hello_world_direct : public proton::handler {
public:
hello_world_direct(const proton::url& u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
acceptor = c.listen(url);
c.open_sender(url);
}
- void on_sendable(proton::event &e, proton::sender &s) override {
+ void on_sendable(proton::sender &s) override {
proton::message m("Hello World!");
s.send(m);
s.close();
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
d.connection().close();
}
- void on_connection_close(proton::event &, proton::connection &) override {
+ void on_connection_close(proton::connection &) override {
acceptor.close();
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/queue_browser.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/queue_browser.cpp b/examples/cpp/queue_browser.cpp
index 0da1ca3..b9dbf21 100644
--- a/examples/cpp/queue_browser.cpp
+++ b/examples/cpp/queue_browser.cpp
@@ -19,8 +19,8 @@
*
*/
+#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/url.hpp"
#include "proton/link_options.hpp"
@@ -36,12 +36,12 @@ class browser : public proton::handler {
public:
browser(const proton::url& u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
proton::connection conn = c.connect(url);
conn.open_receiver(url.path(), proton::link_options().browsing(true));
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
if (d.link().queued() == 0 && d.link().drained() > 0) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/recurring_timer.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/recurring_timer.cpp b/examples/cpp/recurring_timer.cpp
index e4e3ef1..a4841b2 100644
--- a/examples/cpp/recurring_timer.cpp
+++ b/examples/cpp/recurring_timer.cpp
@@ -22,7 +22,6 @@
#include "options.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/task.hpp"
@@ -32,13 +31,13 @@
#include "fake_cpp11.hpp"
class ticker : public proton::handler {
- void on_timer(proton::event &e, proton::container &) override {
+ void on_timer(proton::container &) override {
std::cout << "Tick..." << std::endl;
}
};
class tocker : public proton::handler {
- void on_timer(proton::event &e, proton::container &) override {
+ void on_timer(proton::container &) override {
std::cout << "Tock..." << std::endl;
}
};
@@ -60,13 +59,13 @@ class recurring : public proton::handler {
return c.schedule(tick_ms * 3, &tock_handler);
}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
// Demonstrate cancel(), we will cancel the first tock on the first recurring::on_timer_task
cancel_task = ticktock(c);
c.schedule(0);
}
- void on_timer(proton::event &e, proton::container &c) override {
+ void on_timer(proton::container &c) override {
if (!!cancel_task) {
cancel_task.cancel();
cancel_task = 0;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/selected_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/selected_recv.cpp b/examples/cpp/selected_recv.cpp
index e5e64ef..3ddb8c2 100644
--- a/examples/cpp/selected_recv.cpp
+++ b/examples/cpp/selected_recv.cpp
@@ -19,8 +19,8 @@
*
*/
+#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/url.hpp"
#include "proton/link_options.hpp"
@@ -36,12 +36,12 @@ class selected_recv : public proton::handler {
public:
selected_recv(const proton::url& u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
proton::connection conn = c.connect(url);
conn.open_receiver(url.path(), proton::link_options().selector("colour = 'green'"));
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/server.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server.cpp b/examples/cpp/server.cpp
index 2592e02..8f25454 100644
--- a/examples/cpp/server.cpp
+++ b/examples/cpp/server.cpp
@@ -23,7 +23,6 @@
#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
#include "proton/url.hpp"
@@ -44,7 +43,7 @@ class server : public proton::handler {
public:
server(const std::string &u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
connection = c.connect(url);
connection.open_receiver(url.path());
@@ -60,7 +59,7 @@ class server : public proton::handler {
return uc;
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << "Received " << m.body() << std::endl;
std::string reply_to = m.reply_to();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/server_direct.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/server_direct.cpp b/examples/cpp/server_direct.cpp
index 0d39d2b..692b60a 100644
--- a/examples/cpp/server_direct.cpp
+++ b/examples/cpp/server_direct.cpp
@@ -23,8 +23,8 @@
#include "proton/acceptor.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
+#include "proton/sender.hpp"
#include "proton/url.hpp"
#include <iostream>
@@ -45,7 +45,7 @@ class server : public proton::handler {
public:
server(const std::string &u) : url(u), address_counter(0) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
c.listen(url);
std::cout << "server listening on " << url << std::endl;
}
@@ -66,14 +66,14 @@ class server : public proton::handler {
return addr.str();
}
- void on_sender_open(proton::event& e, proton::sender &sender) override {
+ void on_sender_open(proton::sender &sender) override {
if (sender.remote_source().dynamic()) {
sender.local_source().address(generate_address());
senders[sender.local_source().address()] = sender;
}
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << "Received " << m.body() << std::endl;
std::string reply_to = m.reply_to();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 4e98fad..72b0667 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -21,12 +21,13 @@
#include "options.hpp"
+#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
+#include "proton/delivery.hpp"
#include "proton/handler.hpp"
#include "proton/link.hpp"
-#include "proton/value.hpp"
#include "proton/message_id.hpp"
+#include "proton/value.hpp"
#include <iostream>
#include <map>
@@ -43,12 +44,12 @@ class simple_recv : public proton::handler {
public:
simple_recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
receiver = c.open_receiver(url);
std::cout << "simple_recv listening on " << url << std::endl;
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &msg) override {
+ void on_message(proton::delivery &d, proton::message &msg) override {
if (msg.id().get<uint64_t>() < received) {
return; // Ignore duplicate
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/simple_send.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp
index 6e03ac4..2ff4611 100644
--- a/examples/cpp/simple_send.cpp
+++ b/examples/cpp/simple_send.cpp
@@ -21,10 +21,9 @@
#include "options.hpp"
+#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
-#include "proton/connection.hpp"
#include "proton/value.hpp"
#include <iostream>
@@ -43,11 +42,11 @@ 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_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(proton::container &c) override {
sender = c.open_sender(url);
}
- void on_sendable(proton::event &e, proton::sender &sender) override {
+ void on_sendable(proton::sender &sender) override {
while (sender.credit() && sent < total) {
proton::message msg;
std::map<std::string, int> m;
@@ -61,7 +60,7 @@ class simple_send : public proton::handler {
}
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
confirmed++;
if (confirmed == total) {
@@ -70,7 +69,7 @@ class simple_send : public proton::handler {
}
}
- void on_transport_close(proton::event &e, proton::transport &) override {
+ void on_transport_close(proton::transport &) override {
sent = confirmed;
}
};
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/ssl.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/ssl.cpp b/examples/cpp/ssl.cpp
index ad6ea03..3e228b7 100644
--- a/examples/cpp/ssl.cpp
+++ b/examples/cpp/ssl.cpp
@@ -20,12 +20,12 @@
*/
#include "proton/acceptor.hpp"
+#include "proton/connection_options.hpp"
+#include "proton/connection.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
-#include "proton/connection_options.hpp"
-#include "proton/transport.hpp"
#include "proton/ssl.hpp"
+#include "proton/transport.hpp"
#include <iostream>
@@ -47,13 +47,13 @@ std::string find_CN(const std::string &);
struct server_handler : public proton::handler {
proton::acceptor acceptor;
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
std::cout << "Inbound server connection connected via SSL. Protocol: " <<
c.transport().ssl().protocol() << std::endl;
acceptor.close();
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
}
};
@@ -67,7 +67,7 @@ class hello_world_direct : public proton::handler {
public:
hello_world_direct(const proton::url& u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(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);
@@ -87,20 +87,20 @@ class hello_world_direct : public proton::handler {
c.open_sender(url);
}
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
std::string subject = c.transport().ssl().remote_subject();
std::cout << "Outgoing client connection connected via SSL. Server certificate identity " <<
find_CN(subject) << std::endl;
}
- void on_sendable(proton::event &e, proton::sender &s) override {
+ void on_sendable(proton::sender &s) override {
proton::message m;
m.body("Hello World!");
s.send(m);
s.close();
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
// All done.
d.connection().close();
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/examples/cpp/ssl_client_cert.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/ssl_client_cert.cpp b/examples/cpp/ssl_client_cert.cpp
index 7255b07..4ed4ea4 100644
--- a/examples/cpp/ssl_client_cert.cpp
+++ b/examples/cpp/ssl_client_cert.cpp
@@ -20,13 +20,13 @@
*/
#include "proton/acceptor.hpp"
+#include "proton/connection.hpp"
+#include "proton/connection_options.hpp"
#include "proton/container.hpp"
-#include "proton/event.hpp"
#include "proton/handler.hpp"
-#include "proton/connection_options.hpp"
-#include "proton/transport.hpp"
-#include "proton/ssl.hpp"
#include "proton/sasl.hpp"
+#include "proton/ssl.hpp"
+#include "proton/transport.hpp"
#include <iostream>
@@ -49,7 +49,7 @@ std::string find_CN(const std::string &);
struct server_handler : public proton::handler {
proton::acceptor inbound_listener;
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
std::cout << "Inbound server connection connected via SSL. Protocol: " <<
c.transport().ssl().protocol() << std::endl;
if (c.transport().sasl().outcome() == sasl::OK) {
@@ -63,7 +63,7 @@ struct server_handler : public proton::handler {
inbound_listener.close();
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &m) override {
+ void on_message(proton::delivery &d, proton::message &m) override {
std::cout << m.body() << std::endl;
}
};
@@ -77,7 +77,7 @@ class hello_world_direct : public proton::handler {
public:
hello_world_direct(const proton::url& u) : url(u) {}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(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");
@@ -102,20 +102,20 @@ class hello_world_direct : public proton::handler {
c.open_sender(url);
}
- void on_connection_open(proton::event &e, proton::connection &c) override {
+ void on_connection_open(proton::connection &c) override {
std::string subject = c.transport().ssl().remote_subject();
std::cout << "Outgoing client connection connected via SSL. Server certificate identity " <<
find_CN(subject) << std::endl;
}
- void on_sendable(proton::event &e, proton::sender &s) override {
+ void on_sendable(proton::sender &s) override {
proton::message m;
m.body("Hello World!");
s.send(m);
s.close();
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
// All done.
d.connection().close();
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 9254a3a..ac07a80 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -50,7 +50,6 @@ set(qpid-proton-cpp-source
src/link_options.cpp
src/message.cpp
src/messaging_adapter.cpp
- src/messaging_event.cpp
src/object.cpp
src/proton_bits.cpp
src/proton_event.cpp
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/proton-c/bindings/cpp/include/proton/event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/event.hpp b/proton-c/bindings/cpp/include/proton/event.hpp
deleted file mode 100644
index 45d37f8..0000000
--- a/proton-c/bindings/cpp/include/proton/event.hpp
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef PROTON_CPP_EVENT_H
-#define PROTON_CPP_EVENT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <proton/export.hpp>
-#include <proton/link.hpp>
-#include <proton/connection.hpp>
-#include <proton/message.hpp>
-#include <vector>
-#include <string>
-
-namespace proton {
-
-class handler;
-class container;
-class connection;
-
-/// A context for a proton event.
-///
-/// @see proton::handler
-class event {
- public:
- virtual PN_CPP_EXTERN ~event() {}
-
- /// @cond INTERNAL
- /// XXX Perhaps remove
- /// Return the name of the event type.
- virtual PN_CPP_EXTERN std::string name() const = 0;
- /// @endcond
-
- /// Get transport.
- ///
- /// @throw proton::error if this event was not generated by a
- /// transport
- virtual PN_CPP_EXTERN class transport transport() const = 0;
-
- /// Get connection.
- ///
- /// @throw proton::error if this event was not generated by a
- /// conection
- virtual PN_CPP_EXTERN class connection connection() const = 0;
-
- /// Get session.
- ///
- /// @throw proton::error if this event was not generated by a
- /// session
- virtual PN_CPP_EXTERN class session session() const = 0;
-
- /// Get sender.
- ///
- /// @throw proton::error if no sender
- virtual PN_CPP_EXTERN class sender sender() const = 0;
-
- /// Get receiver.
- ///
- /// @throw proton::error if no receiver
- virtual PN_CPP_EXTERN class receiver receiver() const = 0;
-
- /// Get link.
- ///
- /// @throw proton::error if no link
- virtual PN_CPP_EXTERN class link link() const = 0;
-
- /// Get delivery.
- ///
- /// @throw proton::error if no delivery
- virtual PN_CPP_EXTERN class delivery delivery() const = 0;
-
- // XXX Should we have a notion of application data? Perhaps this
- // is relevant to timer and app events.
-};
-
-}
-
-#endif // PROTON_CPP_EVENT_H
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/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 892e545..7b18f60 100644
--- a/proton-c/bindings/cpp/include/proton/handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/handler.hpp
@@ -64,11 +64,11 @@ PN_CPP_CLASS_EXTERN handler
/// @{
/// The event loop is starting.
- PN_CPP_EXTERN virtual void on_container_start(event &e, container &c);
+ PN_CPP_EXTERN virtual void on_container_start(container &c);
/// A message is received.
- PN_CPP_EXTERN virtual void on_message(event &e, delivery &d, message &m);
+ PN_CPP_EXTERN virtual void on_message(delivery &d, message &m);
/// A message can be sent.
- PN_CPP_EXTERN virtual void on_sendable(event &e, sender &s);
+ PN_CPP_EXTERN virtual void on_sendable(sender &s);
/// transport_open is not present because currently there is no specific
/// low level event to hang it from - you should put any initialisation code
@@ -78,10 +78,10 @@ PN_CPP_CLASS_EXTERN handler
/// XXX symmetry of the API.
/// The underlying network transport has closed.
- PN_CPP_EXTERN virtual void on_transport_close(event &e, transport &t);
+ PN_CPP_EXTERN virtual void on_transport_close(transport &t);
/// The underlying network transport has closed with an error
/// condition.
- PN_CPP_EXTERN virtual void on_transport_error(event &e, transport &t);
+ PN_CPP_EXTERN virtual void on_transport_error(transport &t);
/// Note that every ..._open event is paired with a ..._close event which can clean
/// up any resources created by the ..._open handler.
@@ -91,41 +91,41 @@ PN_CPP_CLASS_EXTERN handler
/// be along in a minute to handle the clean up.
/// The remote peer opened the connection.
- PN_CPP_EXTERN virtual void on_connection_open(event &e, connection &c);
+ PN_CPP_EXTERN virtual void on_connection_open(connection &c);
/// The remote peer closed the connection.
- PN_CPP_EXTERN virtual void on_connection_close(event &e, connection &c);
+ PN_CPP_EXTERN virtual void on_connection_close(connection &c);
/// The remote peer closed the connection with an error condition.
- PN_CPP_EXTERN virtual void on_connection_error(event &e, connection &c);
+ PN_CPP_EXTERN virtual void on_connection_error(connection &c);
/// The remote peer opened the session.
- PN_CPP_EXTERN virtual void on_session_open(event &e, session &s);
+ PN_CPP_EXTERN virtual void on_session_open(session &s);
/// The remote peer closed the session.
- PN_CPP_EXTERN virtual void on_session_close(event &e, session &s);
+ PN_CPP_EXTERN virtual void on_session_close(session &s);
/// The remote peer closed the session with an error condition.
- PN_CPP_EXTERN virtual void on_session_error(event &e, session &s);
+ PN_CPP_EXTERN virtual void on_session_error(session &s);
/// The remote peer opened the link.
- PN_CPP_EXTERN virtual void on_receiver_open(event &e, receiver& l);
+ PN_CPP_EXTERN virtual void on_receiver_open(receiver& l);
/// The remote peer closed the link.
- PN_CPP_EXTERN virtual void on_receiver_close(event &e, receiver& l);
+ PN_CPP_EXTERN virtual void on_receiver_close(receiver& l);
/// The remote peer closed the link with an error condition.
- PN_CPP_EXTERN virtual void on_receiver_error(event &e, receiver& l);
+ PN_CPP_EXTERN virtual void on_receiver_error(receiver& l);
/// The remote peer opened the link.
- PN_CPP_EXTERN virtual void on_sender_open(event &e, sender& l);
+ PN_CPP_EXTERN virtual void on_sender_open(sender& l);
/// The remote peer closed the link.
- PN_CPP_EXTERN virtual void on_sender_close(event &e, sender& l);
+ PN_CPP_EXTERN virtual void on_sender_close(sender& l);
/// The remote peer closed the link with an error condition.
- PN_CPP_EXTERN virtual void on_sender_error(event &e, sender& l);
+ PN_CPP_EXTERN virtual void on_sender_error(sender& l);
/// The remote peer accepted an outgoing message.
- PN_CPP_EXTERN virtual void on_delivery_accept(event &e, delivery &d);
+ PN_CPP_EXTERN virtual void on_delivery_accept(delivery &d);
/// The remote peer rejected an outgoing message.
- PN_CPP_EXTERN virtual void on_delivery_reject(event &e, delivery &d);
+ PN_CPP_EXTERN virtual void on_delivery_reject(delivery &d);
/// The remote peer released an outgoing message.
- PN_CPP_EXTERN virtual void on_delivery_release(event &e, delivery &d);
+ PN_CPP_EXTERN virtual void on_delivery_release(delivery &d);
/// The remote peer settled an outgoing message.
- PN_CPP_EXTERN virtual void on_delivery_settle(event &e, delivery &d);
+ PN_CPP_EXTERN virtual void on_delivery_settle(delivery &d);
// XXX are we missing on_delivery_modify?
// XXX on_delivery_accept (and co) is a more discriminated on_delivery_settle
@@ -136,13 +136,11 @@ PN_CPP_CLASS_EXTERN handler
/// XXX settle API questions around task
/// XXX register functions instead of having these funny generic events
/// A timer fired.
- PN_CPP_EXTERN virtual void on_timer(event &e, container &c);
+ PN_CPP_EXTERN virtual void on_timer(container &c);
/// @endcond
- /// Fallback event handling.
- PN_CPP_EXTERN virtual void on_unhandled(event &e);
/// Fallback error handling.
- PN_CPP_EXTERN virtual void on_unhandled_error(event &e, const condition &c);
+ PN_CPP_EXTERN virtual void on_unhandled_error(const condition &c);
/// @}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/proton-c/bindings/cpp/src/container.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container.cpp b/proton-c/bindings/cpp/src/container.cpp
index 2cc8df5..fb09017 100644
--- a/proton-c/bindings/cpp/src/container.cpp
+++ b/proton-c/bindings/cpp/src/container.cpp
@@ -34,7 +34,6 @@
#include "connector.hpp"
#include "contexts.hpp"
#include "messaging_adapter.hpp"
-#include "messaging_event.hpp"
#include "proton/connection.h"
#include "proton/session.h"
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/proton-c/bindings/cpp/src/container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp
index 6a47294..e35f06b 100644
--- a/proton-c/bindings/cpp/src/container_impl.cpp
+++ b/proton-c/bindings/cpp/src/container_impl.cpp
@@ -20,7 +20,6 @@
*/
#include "proton/container.hpp"
#include "proton/connection_options.hpp"
-#include "proton/event.hpp"
#include "proton/connection.hpp"
#include "proton/session.hpp"
#include "proton/acceptor.hpp"
@@ -38,8 +37,8 @@
#include "container_impl.hpp"
#include "contexts.hpp"
#include "messaging_adapter.hpp"
-#include "messaging_event.hpp"
#include "msg.hpp"
+#include "proton_event.hpp"
#include "proton/connection.h"
#include "proton/session.h"
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/proton-c/bindings/cpp/src/engine_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/engine_test.cpp b/proton-c/bindings/cpp/src/engine_test.cpp
index ea1be2f..0a14f76 100644
--- a/proton-c/bindings/cpp/src/engine_test.cpp
+++ b/proton-c/bindings/cpp/src/engine_test.cpp
@@ -22,7 +22,6 @@
#include <proton/uuid.hpp>
#include <proton/io/connection_engine.hpp>
#include <proton/handler.hpp>
-#include <proton/event.hpp>
#include <proton/types_fwd.hpp>
#include <proton/link.hpp>
#include <deque>
@@ -100,20 +99,20 @@ struct record_handler : public handler {
std::deque<proton::session> sessions;
std::deque<std::string> errors;
- void on_receiver_open(event& e, receiver &l) override {
+ void on_receiver_open(receiver &l) override {
links.push_back(l);
}
- void on_sender_open(event& e, sender &l) override {
+ void on_sender_open(sender &l) override {
links.push_back(l);
}
- void on_session_open(event& e, session &s) override {
+ void on_session_open(session &s) override {
sessions.push_back(s);
}
- void on_unhandled_error(event& e, const condition& c) override {
- errors.push_back(e.name() + "/" + c.what());
+ void on_unhandled_error(const condition& c) override {
+ errors.push_back(c.what());
}
};
@@ -230,7 +229,7 @@ void test_transport_close() {
ASSERT(e.a.dispatch());
while (!e.b.connection().closed()) e.process();
ASSERT_EQUAL(1, hb.errors.size());
- ASSERT_EQUAL("trasport_error/oops: engine failure", hb.errors.front());
+ ASSERT_EQUAL("oops: engine failure", hb.errors.front());
ASSERT_EQUAL("oops", e.b.connection().remote_condition().name());
ASSERT_EQUAL("engine failure", e.b.connection().remote_condition().description());
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/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 00ee452..28d0e40 100644
--- a/proton-c/bindings/cpp/src/handler.cpp
+++ b/proton-c/bindings/cpp/src/handler.cpp
@@ -20,7 +20,7 @@
*/
#include "proton/handler.hpp"
-#include "proton/error.hpp"
+#include "proton/connection.hpp"
#include "proton/transport.hpp"
#include "proton_event.hpp"
@@ -36,30 +36,29 @@ handler::handler() : messaging_adapter_(new messaging_adapter(*this)) {}
handler::~handler(){}
-void handler::on_container_start(event &e, container &) { on_unhandled(e); }
-void handler::on_message(event &e, delivery &, message &) { on_unhandled(e); }
-void handler::on_sendable(event &e, sender &) { on_unhandled(e); }
-void handler::on_timer(event &e, container &) { on_unhandled(e); }
-void handler::on_transport_close(event &e, transport &) { on_unhandled(e); }
-void handler::on_transport_error(event &e, transport &t) { on_unhandled_error(e, t.condition()); }
-void handler::on_connection_close(event &e, connection &) { on_unhandled(e); }
-void handler::on_connection_error(event &e, connection &c) { on_unhandled_error(e, c.remote_condition()); }
-void handler::on_connection_open(event &e, connection &) { on_unhandled(e); }
-void handler::on_session_close(event &e, session &) { on_unhandled(e); }
-void handler::on_session_error(event &e, session &s) { on_unhandled_error(e, s.remote_condition()); }
-void handler::on_session_open(event &e, session &) { on_unhandled(e); }
-void handler::on_receiver_close(event &e, receiver &) { on_unhandled(e); }
-void handler::on_receiver_error(event &e, receiver &l) { on_unhandled_error(e, l.remote_condition()); }
-void handler::on_receiver_open(event &e, receiver &) { on_unhandled(e); }
-void handler::on_sender_close(event &e, sender &) { on_unhandled(e); }
-void handler::on_sender_error(event &e, sender &l) { on_unhandled_error(e, l.remote_condition()); }
-void handler::on_sender_open(event &e, sender &) { on_unhandled(e); }
-void handler::on_delivery_accept(event &e, delivery &) { on_unhandled(e); }
-void handler::on_delivery_reject(event &e, delivery &) { on_unhandled(e); }
-void handler::on_delivery_release(event &e, delivery &) { on_unhandled(e); }
-void handler::on_delivery_settle(event &e, delivery &) { on_unhandled(e); }
+void handler::on_container_start(container &) {}
+void handler::on_message(delivery &, message &) {}
+void handler::on_sendable(sender &) {}
+void handler::on_timer(container &) {}
+void handler::on_transport_close(transport &) {}
+void handler::on_transport_error(transport &t) { on_unhandled_error(t.condition()); }
+void handler::on_connection_close(connection &) {}
+void handler::on_connection_error(connection &c) { on_unhandled_error(c.remote_condition()); }
+void handler::on_connection_open(connection &) {}
+void handler::on_session_close(session &) {}
+void handler::on_session_error(session &s) { on_unhandled_error(s.remote_condition()); }
+void handler::on_session_open(session &) {}
+void handler::on_receiver_close(receiver &) {}
+void handler::on_receiver_error(receiver &l) { on_unhandled_error(l.remote_condition()); }
+void handler::on_receiver_open(receiver &) {}
+void handler::on_sender_close(sender &) {}
+void handler::on_sender_error(sender &l) { on_unhandled_error(l.remote_condition()); }
+void handler::on_sender_open(sender &) {}
+void handler::on_delivery_accept(delivery &) {}
+void handler::on_delivery_reject(delivery &) {}
+void handler::on_delivery_release(delivery &) {}
+void handler::on_delivery_settle(delivery &) {}
-void handler::on_unhandled(event &) {}
-void handler::on_unhandled_error(event &, const condition& c) { throw proton::error(c.what()); }
+void handler::on_unhandled_error(const condition& c) { throw proton::error(c.what()); }
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/proton-c/bindings/cpp/src/io/connection_engine.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/io/connection_engine.cpp b/proton-c/bindings/cpp/src/io/connection_engine.cpp
index 9513110..a38ec81 100644
--- a/proton-c/bindings/cpp/src/io/connection_engine.cpp
+++ b/proton-c/bindings/cpp/src/io/connection_engine.cpp
@@ -25,10 +25,9 @@
#include "contexts.hpp"
#include "id_generator.hpp"
#include "messaging_adapter.hpp"
-#include "messaging_event.hpp"
#include "msg.hpp"
#include "proton_bits.hpp"
-#include "proton_bits.hpp"
+#include "proton_event.hpp"
#include <proton/connection.h>
#include <proton/transport.h>
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/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 a65e2a5..459895d 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -26,9 +26,9 @@
#include "proton/transport.hpp"
#include "contexts.hpp"
-#include "messaging_event.hpp"
#include "container_impl.hpp"
#include "msg.hpp"
+#include "proton_event.hpp"
#include "proton/connection.h"
#include "proton/delivery.h"
@@ -57,10 +57,9 @@ messaging_adapter::messaging_adapter(handler &delegate) : delegate_(delegate) {}
messaging_adapter::~messaging_adapter(){}
void messaging_adapter::on_reactor_init(proton_event &pe) {
- messaging_event mevent(messaging_event::START, pe);
// Container specific event
if (pe.container())
- delegate_.on_container_start(mevent, *pe.container());
+ delegate_.on_container_start(*pe.container());
}
void messaging_adapter::on_link_flow(proton_event &pe) {
@@ -69,8 +68,7 @@ void messaging_adapter::on_link_flow(proton_event &pe) {
sender s(lnk);
if (lnk && pn_link_is_sender(lnk) && pn_link_credit(lnk) > 0) {
// create on_message extended event
- messaging_event mevent(messaging_event::SENDABLE, pe);
- delegate_.on_sendable(mevent, s);
+ delegate_.on_sendable(s);
}
credit_topup(lnk);
}
@@ -84,7 +82,6 @@ void messaging_adapter::on_delivery(proton_event &pe) {
if (pn_link_is_receiver(lnk)) {
if (!dlv.partial() && dlv.readable()) {
// generate on_message
- messaging_event mevent(messaging_event::MESSAGE, pe);
pn_connection_t *pnc = pn_session_connection(pn_link_session(lnk));
connection_context& ctx = connection_context::get(pnc);
// Reusable per-connection message.
@@ -96,14 +93,13 @@ void messaging_adapter::on_delivery(proton_event &pe) {
if (lctx.auto_accept)
dlv.release();
} else {
- delegate_.on_message(mevent, dlv, msg);
+ delegate_.on_message(dlv, msg);
if (lctx.auto_accept && !dlv.settled())
dlv.accept();
}
}
else if (dlv.updated() && dlv.settled()) {
- messaging_event mevent(messaging_event::DELIVERY_SETTLE, pe);
- delegate_.on_delivery_settle(mevent, dlv);
+ delegate_.on_delivery_settle(dlv);
}
credit_topup(lnk);
} else {
@@ -111,21 +107,17 @@ void messaging_adapter::on_delivery(proton_event &pe) {
if (dlv.updated()) {
uint64_t rstate = dlv.remote_state();
if (rstate == PN_ACCEPTED) {
- messaging_event mevent(messaging_event::DELIVERY_ACCEPT, pe);
- delegate_.on_delivery_accept(mevent, dlv);
+ delegate_.on_delivery_accept(dlv);
}
else if (rstate == PN_REJECTED) {
- messaging_event mevent(messaging_event::DELIVERY_REJECT, pe);
- delegate_.on_delivery_reject(mevent, dlv);
+ delegate_.on_delivery_reject(dlv);
}
else if (rstate == PN_RELEASED || rstate == PN_MODIFIED) {
- messaging_event mevent(messaging_event::DELIVERY_RELEASE, pe);
- delegate_.on_delivery_release(mevent, dlv);
+ delegate_.on_delivery_release(dlv);
}
if (dlv.settled()) {
- messaging_event mevent(messaging_event::DELIVERY_SETTLE, pe);
- delegate_.on_delivery_settle(mevent, dlv);
+ delegate_.on_delivery_settle(dlv);
}
if (lctx.auto_settle)
dlv.settle();
@@ -148,20 +140,18 @@ bool is_local_unititialised(pn_state_t state) {
void messaging_adapter::on_link_remote_close(proton_event &pe) {
pn_event_t *cevent = pe.pn_event();
pn_link_t *lnk = pn_event_link(cevent);
- messaging_event clevent(messaging_event::LINK_CLOSE, pe);
- messaging_event eevent(messaging_event::LINK_ERROR, pe);
if (pn_link_is_receiver(lnk)) {
receiver r = link(lnk).receiver();
if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
- delegate_.on_receiver_error(eevent, r);
+ delegate_.on_receiver_error(r);
}
- delegate_.on_receiver_close(clevent, r);
+ delegate_.on_receiver_close(r);
} else {
sender s = link(lnk).sender();
if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
- delegate_.on_sender_error(eevent, s);
+ delegate_.on_sender_error(s);
}
- delegate_.on_sender_close(clevent, s);
+ delegate_.on_sender_close(s);
}
pn_link_close(lnk);
}
@@ -171,11 +161,9 @@ void messaging_adapter::on_session_remote_close(proton_event &pe) {
pn_session_t *session = pn_event_session(cevent);
class session s(session);
if (pn_condition_is_set(pn_session_remote_condition(session))) {
- messaging_event mevent(messaging_event::SESSION_ERROR, pe);
- delegate_.on_session_error(mevent, s);
+ delegate_.on_session_error(s);
}
- messaging_event mevent(messaging_event::SESSION_CLOSE, pe);
- delegate_.on_session_close(mevent, s);
+ delegate_.on_session_close(s);
pn_session_close(session);
}
@@ -184,29 +172,25 @@ void messaging_adapter::on_connection_remote_close(proton_event &pe) {
pn_connection_t *connection = pn_event_connection(cevent);
class connection c(connection);
if (pn_condition_is_set(pn_connection_remote_condition(connection))) {
- messaging_event mevent(messaging_event::CONNECTION_ERROR, pe);
- delegate_.on_connection_error(mevent, c);
+ delegate_.on_connection_error(c);
}
- messaging_event mevent(messaging_event::CONNECTION_CLOSE, pe);
- delegate_.on_connection_close(mevent, c);
+ delegate_.on_connection_close(c);
pn_connection_close(connection);
}
void messaging_adapter::on_connection_remote_open(proton_event &pe) {
- messaging_event mevent(messaging_event::CONNECTION_OPEN, pe);
pn_connection_t *connection = pn_event_connection(pe.pn_event());
class connection c(connection);
- delegate_.on_connection_open(mevent, c);
+ delegate_.on_connection_open(c);
if (!is_local_open(pn_connection_state(connection)) && is_local_unititialised(pn_connection_state(connection))) {
pn_connection_open(connection);
}
}
void messaging_adapter::on_session_remote_open(proton_event &pe) {
- messaging_event mevent(messaging_event::SESSION_OPEN, pe);
pn_session_t *session = pn_event_session(pe.pn_event());
class session s(session);
- delegate_.on_session_open(mevent, s);
+ delegate_.on_session_open(s);
if (!is_local_open(pn_session_state(session)) && is_local_unititialised(pn_session_state(session))) {
pn_session_open(session);
}
@@ -217,14 +201,13 @@ void messaging_adapter::on_link_local_open(proton_event &pe) {
}
void messaging_adapter::on_link_remote_open(proton_event &pe) {
- messaging_event mevent(messaging_event::LINK_OPEN, pe);
pn_link_t *lnk = pn_event_link(pe.pn_event());
if (pn_link_is_receiver(lnk)) {
receiver r = link(lnk).receiver();
- delegate_.on_receiver_open(mevent, r);
+ delegate_.on_receiver_open(r);
} else {
sender s = link(lnk).sender();
- delegate_.on_sender_open(mevent, s);
+ delegate_.on_sender_open(s);
}
if (!is_local_open(pn_link_state(lnk)) && is_local_unititialised(pn_link_state(lnk))) {
link l(lnk);
@@ -242,19 +225,16 @@ void messaging_adapter::on_transport_tail_closed(proton_event &pe) {
pn_transport_t *tspt = pn_event_transport(pe.pn_event());
transport t(tspt);
if (pn_condition_is_set(pn_transport_condition(tspt))) {
- messaging_event mevent(messaging_event::TRANSPORT_ERROR, pe);
- delegate_.on_transport_error(mevent, t);
+ delegate_.on_transport_error(t);
}
- messaging_event mevent(messaging_event::TRANSPORT_CLOSE, pe);
- delegate_.on_transport_close(mevent, t);
+ delegate_.on_transport_close(t);
}
}
void messaging_adapter::on_timer_task(proton_event& pe)
{
if (pe.container()) {
- messaging_event mevent(messaging_event::TIMER, pe);
- delegate_.on_timer(mevent, *pe.container());
+ delegate_.on_timer(*pe.container());
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/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
deleted file mode 100644
index 4d6ddd3..0000000
--- a/proton-c/bindings/cpp/src/messaging_event.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * 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 "messaging_event.hpp"
-#include "proton/message.hpp"
-#include "proton/handler.hpp"
-#include "proton/sender.hpp"
-#include "proton/receiver.hpp"
-#include "proton/transport.hpp"
-#include "proton/error.hpp"
-
-#include "contexts.hpp"
-#include "msg.hpp"
-#include "proton_handler.hpp"
-
-#include "proton/reactor.h"
-#include "proton/event.h"
-#include "proton/link.h"
-
-/*
- * Performance note:
- * See comments for handler_context::dispatch() in container_impl.cpp.
- */
-
-namespace proton {
-
-messaging_event::messaging_event(event_type t, proton_event &p) :
- type_(t), parent_event_(&p)
-{}
-
-messaging_event::~messaging_event() {}
-
-messaging_event::event_type messaging_event::type() const { return type_; }
-
-transport messaging_event::transport() const {
- if (parent_event_)
- return parent_event_->transport();
- throw error(MSG("No transport context for event"));
-}
-
-connection messaging_event::connection() const {
- if (parent_event_)
- return parent_event_->connection();
- throw error(MSG("No connection context for event"));
-}
-
-session messaging_event::session() const {
- if (parent_event_)
- return parent_event_->session();
- throw error(MSG("No session context for event"));
-}
-
-sender messaging_event::sender() const {
- if (parent_event_)
- return parent_event_->sender();
- throw error(MSG("No sender context for event"));
-}
-
-receiver messaging_event::receiver() const {
- if (parent_event_)
- return parent_event_->receiver();
- throw error(MSG("No receiver context for event"));
-}
-
-link messaging_event::link() const {
- if (parent_event_)
- return parent_event_->link();
- throw error(MSG("No link context for event"));
-}
-
-delivery messaging_event::delivery() const {
- if (parent_event_)
- return parent_event_->delivery();
- throw error(MSG("No delivery context for event"));
-}
-
-std::string messaging_event::name() const {
- switch (type()) {
- case START: return "START";
- case MESSAGE: return "MESSAGE";
- case SENDABLE: return "SENDABLE";
- case TRANSPORT_CLOSE: return "TRANSPORT_CLOSE";
- case TRANSPORT_ERROR: return "TRANSPORT_ERROR";
- case DELIVERY_ACCEPT: return "DELIVERY_ACCEPT";
- case DELIVERY_REJECT: return "DELIVERY_REJECT";
- case DELIVERY_RELEASE: return "DELIVERY_RELEASE";
- case DELIVERY_SETTLE: return "DELIVERY_SETTLE";
- case CONNECTION_CLOSE: return "CONNECTION_CLOSE";
- case CONNECTION_ERROR: return "CONNECTION_ERROR";
- case CONNECTION_OPEN: return "CONNECTION_OPEN";
- case LINK_CLOSE: return "LINK_CLOSE";
- case LINK_OPEN: return "LINK_OPEN";
- case LINK_ERROR: return "LINK_ERROR";
- case SESSION_CLOSE: return "SESSION_CLOSE";
- case SESSION_OPEN: return "SESSION_OPEN";
- case SESSION_ERROR: return "SESSION_ERROR";
- case TRANSACTION_ABORT: return "TRANSACTION_ABORT";
- case TRANSACTION_COMMIT: return "TRANSACTION_COMMIT";
- case TRANSACTION_DECLARE: return "TRANSACTION_DECLARE";
- case TIMER: return "TIMER";
- }
- return "unknown";
-}
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/proton-c/bindings/cpp/src/messaging_event.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_event.hpp b/proton-c/bindings/cpp/src/messaging_event.hpp
deleted file mode 100644
index 60b4287..0000000
--- a/proton-c/bindings/cpp/src/messaging_event.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef PROTON_CPP_MESSAGINGEVENT_H
-#define PROTON_CPP_MESSAGINGEVENT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "proton_event.hpp"
-#include "proton/link.hpp"
-#include "proton/message.hpp"
-
-namespace proton {
-
-class handler;
-class container;
-class connection;
-class message;
-
-/** An event for the proton::messaging_handler */
-class messaging_event : public event
-{
- public:
-
- std::string name() const;
-
- // TODO aconway 2015-07-16: document meaning of each event type.
-
- /** Event types for a messaging_handler */
- enum event_type {
- START,
- MESSAGE,
- SENDABLE,
- TRANSPORT_CLOSE,
- TRANSPORT_ERROR,
- CONNECTION_OPEN,
- CONNECTION_CLOSE,
- CONNECTION_ERROR,
- LINK_OPEN,
- LINK_CLOSE,
- LINK_ERROR,
- SESSION_OPEN,
- SESSION_CLOSE,
- SESSION_ERROR,
- DELIVERY_ACCEPT,
- DELIVERY_REJECT,
- DELIVERY_RELEASE,
- DELIVERY_SETTLE,
- TRANSACTION_DECLARE,
- TRANSACTION_COMMIT,
- TRANSACTION_ABORT,
- TIMER
- };
-
- messaging_event(event_type t, proton_event &parent);
- messaging_event(event_type t, pn_event_t*);
- ~messaging_event();
-
- class transport transport() const;
- class connection connection() const;
- class session session() const;
- class sender sender() const;
- class receiver receiver() const;
- class link link() const;
- class delivery delivery() const;
-
- event_type type() const;
-
- private:
- friend class messaging_adapter;
- event_type type_;
- proton_event *parent_event_;
- messaging_event operator=(const messaging_event&);
- messaging_event(const messaging_event&);
-};
-
-}
-
-#endif /*!PROTON_CPP_MESSAGINGEVENT_H*/
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/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 781f298..ca6edc4 100644
--- a/proton-c/bindings/cpp/src/proton_event.hpp
+++ b/proton-c/bindings/cpp/src/proton_event.hpp
@@ -21,7 +21,6 @@
* under the License.
*
*/
-#include "proton/event.hpp"
#include "proton/link.hpp"
#include "proton/event.h"
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/edd8bc57/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 e21ed9c..cc9b1fb 100644
--- a/tests/tools/apps/cpp/reactor_send.cpp
+++ b/tests/tools/apps/cpp/reactor_send.cpp
@@ -26,7 +26,6 @@
#include "proton/handler.hpp"
#include "proton/connection.hpp"
#include "proton/decoder.hpp"
-#include "proton/event.hpp"
#include "proton/reactor.h"
#include "proton/value.hpp"
#include "proton/link_options.hpp"
@@ -66,12 +65,12 @@ class reactor_send : public proton::handler {
message_.body(content);
}
- void on_container_start(proton::event &e, proton::container &c) override {
+ void on_container_start(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) override {
+ void on_sendable(proton::sender &sender) override {
while (sender.credit() && sent_ < total_) {
id_value_ = sent_ + 1;
message_.correlation_id(id_value_);
@@ -81,7 +80,7 @@ class reactor_send : public proton::handler {
}
}
- void on_delivery_accept(proton::event &e, proton::delivery &d) override {
+ void on_delivery_accept(proton::delivery &d) override {
confirmed_++;
d.settle();
if (confirmed_ == total_) {
@@ -91,7 +90,7 @@ class reactor_send : public proton::handler {
}
}
- void on_message(proton::event &e, proton::delivery &d, proton::message &msg) override {
+ void on_message(proton::delivery &d, proton::message &msg) override {
received_content_ = proton::get<proton::binary>(msg.body());
received_bytes_ += received_content_.size();
if (received_ < total_) {
@@ -104,7 +103,7 @@ class reactor_send : public proton::handler {
}
}
- void on_transport_close(proton::event &e, proton::transport &) override {
+ void on_transport_close(proton::transport &) override {
sent_ = confirmed_;
}
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/3] qpid-proton git commit: PROTON-1164: [C++ binding] Add a
container accessor to object hierarchy - This allows simple access to all
layers of the object model from every object type that can bre passed to a
handler
Posted by as...@apache.org.
PROTON-1164: [C++ binding] Add a container accessor to object hierarchy
- This allows simple access to all layers of the object model
from every object type that can bre passed to a handler
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3ca3cb3b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3ca3cb3b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3ca3cb3b
Branch: refs/heads/master
Commit: 3ca3cb3b519c38b1da917449cc6545cc25714315
Parents: edd8bc5
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Apr 6 16:46:48 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Apr 7 17:10:23 2016 -0400
----------------------------------------------------------------------
proton-c/bindings/cpp/include/proton/delivery.hpp | 3 +++
proton-c/bindings/cpp/include/proton/link.hpp | 3 +++
proton-c/bindings/cpp/include/proton/session.hpp | 3 +++
proton-c/bindings/cpp/src/delivery.cpp | 2 ++
proton-c/bindings/cpp/src/link.cpp | 4 ++++
proton-c/bindings/cpp/src/session.cpp | 4 ++++
6 files changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3ca3cb3b/proton-c/bindings/cpp/include/proton/delivery.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/delivery.hpp b/proton-c/bindings/cpp/include/proton/delivery.hpp
index 8ae8bc1..f1966eb 100644
--- a/proton-c/bindings/cpp/include/proton/delivery.hpp
+++ b/proton-c/bindings/cpp/include/proton/delivery.hpp
@@ -50,6 +50,9 @@ class delivery : public internal::object<pn_delivery_t> {
/// Return the connection for this delivery
PN_CPP_EXTERN class connection connection() const;
+ /// Return the container for this delivery
+ PN_CPP_EXTERN class container &container() const;
+
/// Delivery state values.
enum state {
NONE = 0, ///< Unknown state
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3ca3cb3b/proton-c/bindings/cpp/include/proton/link.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/link.hpp b/proton-c/bindings/cpp/include/proton/link.hpp
index 839f0a3..54eae3b 100644
--- a/proton-c/bindings/cpp/include/proton/link.hpp
+++ b/proton-c/bindings/cpp/include/proton/link.hpp
@@ -119,6 +119,9 @@ PN_CPP_CLASS_EXTERN link : public internal::object<pn_link_t> , public endpoint
/// Get the link name.
PN_CPP_EXTERN std::string name() const;
+ /// Return the container for this link
+ PN_CPP_EXTERN class container &container() const;
+
/// Connection that owns this link.
PN_CPP_EXTERN class connection connection() const;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3ca3cb3b/proton-c/bindings/cpp/include/proton/session.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/session.hpp b/proton-c/bindings/cpp/include/proton/session.hpp
index 24ada91..450f035 100644
--- a/proton-c/bindings/cpp/include/proton/session.hpp
+++ b/proton-c/bindings/cpp/include/proton/session.hpp
@@ -66,6 +66,9 @@ PN_CPP_CLASS_EXTERN session : public internal::object<pn_session_t>, public endp
/// handler::on_session_close().
PN_CPP_EXTERN void close();
+ /// Return the container for this session
+ PN_CPP_EXTERN class container &container() const;
+
/// Get the connection this session belongs to.
PN_CPP_EXTERN class connection connection() const;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3ca3cb3b/proton-c/bindings/cpp/src/delivery.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/delivery.cpp b/proton-c/bindings/cpp/src/delivery.cpp
index 9d69625..49f6e26 100644
--- a/proton-c/bindings/cpp/src/delivery.cpp
+++ b/proton-c/bindings/cpp/src/delivery.cpp
@@ -34,6 +34,8 @@ namespace proton {
link delivery::link() const { return pn_delivery_link(pn_object()); }
session delivery::session() const { return pn_link_session(pn_delivery_link(pn_object())); }
connection delivery::connection() const { return pn_session_connection(pn_link_session(pn_delivery_link(pn_object()))); }
+container& delivery::container() const { return connection().container(); }
+
bool delivery::settled() const { return pn_delivery_settled(pn_object()); }
void delivery::settle() { pn_delivery_settle(pn_object()); }
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3ca3cb3b/proton-c/bindings/cpp/src/link.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/link.cpp b/proton-c/bindings/cpp/src/link.cpp
index 472281e..420711a 100644
--- a/proton-c/bindings/cpp/src/link.cpp
+++ b/proton-c/bindings/cpp/src/link.cpp
@@ -76,6 +76,10 @@ terminus link::remote_target() const { return pn_link_remote_target(pn_object())
std::string link::name() const { return std::string(pn_link_name(pn_object()));}
+container& link::container() const {
+ return connection().container();
+}
+
class connection link::connection() const {
return pn_session_connection(pn_link_session(pn_object()));
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3ca3cb3b/proton-c/bindings/cpp/src/session.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/session.cpp b/proton-c/bindings/cpp/src/session.cpp
index e5c1f82..37550b0 100644
--- a/proton-c/bindings/cpp/src/session.cpp
+++ b/proton-c/bindings/cpp/src/session.cpp
@@ -36,6 +36,10 @@ void session::open() {
pn_session_open(pn_object());
}
+container& session::container() const {
+ return connection().container();
+}
+
connection session::connection() const {
return pn_session_connection(pn_object());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/3] qpid-proton git commit: PROTON-1153: [C++ binding] Remove all
data members from proton_handler - It's now a pure interface - This does mean
that you currently create more pn_handler_t structs than before,
but they could be cached somewhere el
Posted by as...@apache.org.
PROTON-1153: [C++ binding] Remove all data members from proton_handler
- It's now a pure interface
- This does mean that you currently create more pn_handler_t structs
than before, but they could be cached somewhere else.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ac5d3c68
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ac5d3c68
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ac5d3c68
Branch: refs/heads/master
Commit: ac5d3c6871fed288cec36f8a7d9473a14033dfe7
Parents: 3ca3cb3
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Apr 7 03:40:44 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Apr 7 17:10:34 2016 -0400
----------------------------------------------------------------------
proton-c/bindings/cpp/src/container_impl.cpp | 17 +++++++----------
proton-c/bindings/cpp/src/proton_event.cpp | 5 -----
proton-c/bindings/cpp/src/proton_handler.cpp | 5 -----
proton-c/bindings/cpp/src/proton_handler.hpp | 11 -----------
4 files changed, 7 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac5d3c68/proton-c/bindings/cpp/src/container_impl.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/container_impl.cpp b/proton-c/bindings/cpp/src/container_impl.cpp
index e35f06b..c8e8968 100644
--- a/proton-c/bindings/cpp/src/container_impl.cpp
+++ b/proton-c/bindings/cpp/src/container_impl.cpp
@@ -109,16 +109,13 @@ class override_handler : public proton_handler
};
internal::pn_ptr<pn_handler_t> container_impl::cpp_handler(proton_handler *h) {
- if (!h->pn_handler_) {
- h->pn_handler_ = internal::take_ownership(
- pn_handler_new(&handler_context::dispatch,
- sizeof(struct handler_context),
- &handler_context::cleanup));
- handler_context &hc = handler_context::get(h->pn_handler_.get());
- hc.container_ = &container_;
- hc.handler_ = h;
- }
- return h->pn_handler_;
+ pn_handler_t *handler = pn_handler_new(&handler_context::dispatch,
+ sizeof(struct handler_context),
+ &handler_context::cleanup);
+ handler_context &hc = handler_context::get(handler);
+ hc.container_ = &container_;
+ hc.handler_ = h;
+ return internal::take_ownership(handler);
}
container_impl::container_impl(container& c, messaging_adapter *h, const std::string& id) :
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac5d3c68/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 8148eef..bec1145 100644
--- a/proton-c/bindings/cpp/src/proton_event.cpp
+++ b/proton-c/bindings/cpp/src/proton_event.cpp
@@ -149,11 +149,6 @@ void proton_event::dispatch(proton_handler &handler) {
default:
throw error(MSG("Invalid Proton event type " << type_));
}
-
- // recurse through children
- for (proton_handler::iterator child = handler.children_.begin(); child != handler.children_.end(); ++child) {
- dispatch(**child);
- }
}
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac5d3c68/proton-c/bindings/cpp/src/proton_handler.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_handler.cpp b/proton-c/bindings/cpp/src/proton_handler.cpp
index b361863..87d00a3 100644
--- a/proton-c/bindings/cpp/src/proton_handler.cpp
+++ b/proton-c/bindings/cpp/src/proton_handler.cpp
@@ -71,9 +71,4 @@ void proton_handler::on_selectable_final(proton_event &e) { on_unhandled(e); }
void proton_handler::on_unhandled(proton_event &) {}
-void proton_handler::add_child_handler(proton_handler &e) {
- children_.push_back(&e);
-}
-
-
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ac5d3c68/proton-c/bindings/cpp/src/proton_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/proton_handler.hpp b/proton-c/bindings/cpp/src/proton_handler.hpp
index 230ab7c..3b601e2 100644
--- a/proton-c/bindings/cpp/src/proton_handler.hpp
+++ b/proton-c/bindings/cpp/src/proton_handler.hpp
@@ -86,17 +86,6 @@ class proton_handler
virtual void on_selectable_final(proton_event &e);
virtual void on_unhandled(proton_event &e);
///@}
-
- /// Add a child handler, equivalent to this->push_back(&h)
- /// h must not be deleted before this handler.
- void add_child_handler(proton_handler &h);
-
- private:
- std::vector<proton_handler*> children_;
- typedef std::vector<proton_handler*>::iterator iterator;
- friend class proton_event;
- internal::pn_ptr<pn_handler_t> pn_handler_;
- friend class container_impl;
};
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org