qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject qpid-proton git commit: PROTON-1083: [C++ binding] Implement missing on_timer/TIMER messaging event.
Date Mon, 18 Jan 2016 19:21:38 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 463cfd7ac -> 06ed3abc1


PROTON-1083: [C++ binding] Implement missing on_timer/TIMER messaging event.


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

Branch: refs/heads/master
Commit: 06ed3abc1114cc9b3ccfb3b94b777cefb383fd91
Parents: 463cfd7
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Wed Jan 6 12:46:14 2016 -0500
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Mon Jan 18 14:16:43 2016 -0500

----------------------------------------------------------------------
 examples/cpp/recurring_timer.cpp                           | 6 +++---
 proton-c/bindings/cpp/include/proton/messaging_adapter.hpp | 4 +++-
 proton-c/bindings/cpp/include/proton/messaging_handler.hpp | 9 ++++++++-
 proton-c/bindings/cpp/include/proton/proton_handler.hpp    | 2 +-
 proton-c/bindings/cpp/src/messaging_adapter.cpp            | 5 +++++
 5 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/06ed3abc/examples/cpp/recurring_timer.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/recurring_timer.cpp b/examples/cpp/recurring_timer.cpp
index 4beaaf6..d234b4c 100644
--- a/examples/cpp/recurring_timer.cpp
+++ b/examples/cpp/recurring_timer.cpp
@@ -29,13 +29,13 @@
 #include <map>
 
 class ticker : public proton::messaging_handler {
-    void on_timer_task(proton::event &e) {
+    void on_timer(proton::event &e) {
         std::cout << "Tick..." << std::endl;
     }
 };
 
 class tocker : public proton::messaging_handler {
-    void on_timer_task(proton::event &e) {
+    void on_timer(proton::event &e) {
         std::cout << "Tock..." << std::endl;
     }
 };
@@ -63,7 +63,7 @@ class recurring : public proton::messaging_handler {
         e.container().schedule(0);
     }
 
-    void on_timer_task(proton::event &e) {
+    void on_timer(proton::event &e) {
         if (!!cancel_task) {
             cancel_task.cancel();
             cancel_task = 0;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/06ed3abc/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp b/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp
index 4e765e2..5a52658 100644
--- a/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp
+++ b/proton-c/bindings/cpp/include/proton/messaging_adapter.hpp
@@ -33,7 +33,7 @@ namespace proton {
 
 // Combine's Python's: endpoint_state_handler, incoming_message_handler, outgoing_message_handler
 
-class messaging_adapter : public messaging_handler
+class messaging_adapter : public proton_handler, public messaging_handler
 {
   public:
     PN_CPP_EXTERN messaging_adapter(messaging_handler &delegate);
@@ -59,6 +59,8 @@ class messaging_adapter : public messaging_handler
     PN_CPP_EXTERN virtual void on_link_close(event &e);
     PN_CPP_EXTERN virtual void on_link_error(event &e);
     PN_CPP_EXTERN virtual void on_link_open(event &e);
+
+    PN_CPP_EXTERN virtual void on_timer_task(event &e);
   private:
     messaging_handler &delegate_;  // The handler for generated messaging_event's
 };

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/06ed3abc/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
index 9ec0f0d..39dc3e0 100644
--- a/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/messaging_handler.hpp
@@ -25,17 +25,24 @@
 #include "proton/proton_handler.hpp"
 #include "proton/event.h"
 
+#include <stdexcept>
+
 namespace proton {
 
 class event;
 class messaging_adapter;
 
+class messaging_exception : public std::runtime_error {
+  public:
+    messaging_exception(event& e);
+};
+
 /** messaging_handler base class. Provides a simpler set of events than
  * proton::proton_handler and automates some common tasks.  Subclass and
  * over-ride event handling member functions.
  * @see proton::messaging_event for meaning of events.
  */
-class messaging_handler : public proton_handler
+class messaging_handler : virtual public handler
 {
   public:
     /** Create a messaging_handler

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/06ed3abc/proton-c/bindings/cpp/include/proton/proton_handler.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/proton_handler.hpp b/proton-c/bindings/cpp/include/proton/proton_handler.hpp
index 2738f71..4d22770 100644
--- a/proton-c/bindings/cpp/include/proton/proton_handler.hpp
+++ b/proton-c/bindings/cpp/include/proton/proton_handler.hpp
@@ -30,7 +30,7 @@ class proton_event;
 
 /// Handler base class, subclass and over-ride event handling member functions.
 /// @see proton::proton_event for meaning of events.
-class proton_handler : public handler
+class proton_handler : virtual public handler
 {
   public:
     PN_CPP_EXTERN proton_handler();

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/06ed3abc/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 d66189c..ad8e850 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -276,6 +276,11 @@ void messaging_adapter::on_link_close(event &e) {
         on_link_error(e);
 }
 
+void messaging_adapter::on_timer_task(event& e)
+{
+    delegate_.on_timer(e);
+}
+
 void messaging_adapter::on_unhandled(event &) {
 }
 


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


Mime
View raw message