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:30 UTC

[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

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