Repository: qpid-proton Updated Branches: refs/heads/master 0a398f604 -> d324e5cd9
PROTON-1270: [C++ binding] Add new overloads for open_sender & open_receiver - These allow you to create senders and receivers with connection options but without specifying empty sender_options or receiver_options. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d324e5cd Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d324e5cd Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d324e5cd Branch: refs/heads/master Commit: d324e5cd9bde53bfb3a346daa2db773559225fa4 Parents: 0a398f6 Author: Andrew Stitcher <[email protected]> Authored: Mon Jul 25 13:08:29 2016 -0400 Committer: Andrew Stitcher <[email protected]> Committed: Mon Jul 25 13:08:29 2016 -0400 ---------------------------------------------------------------------- examples/cpp/simple_recv.cpp | 2 +- examples/cpp/simple_send.cpp | 2 +- .../bindings/cpp/include/proton/container.hpp | 34 +++++++++++++++++--- proton-c/bindings/cpp/src/container.cpp | 8 +++++ 4 files changed, 39 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d324e5cd/examples/cpp/simple_recv.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp index 47f4d94..10a8ee7 100644 --- a/examples/cpp/simple_recv.cpp +++ b/examples/cpp/simple_recv.cpp @@ -51,7 +51,7 @@ class simple_recv : public proton::messaging_handler { proton::connection_options co; if (!user.empty()) co.user(user); if (!password.empty()) co.password(password); - receiver = c.open_receiver(url, proton::receiver_options(), co); + receiver = c.open_receiver(url, co); std::cout << "simple_recv listening on " << url << std::endl; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d324e5cd/examples/cpp/simple_send.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/simple_send.cpp b/examples/cpp/simple_send.cpp index d63b0a8..9e11588 100644 --- a/examples/cpp/simple_send.cpp +++ b/examples/cpp/simple_send.cpp @@ -50,7 +50,7 @@ class simple_send : public proton::messaging_handler { proton::connection_options co; if (!user.empty()) co.user(user); if (!password.empty()) co.password(password); - sender = c.open_sender(url, proton::sender_options(), co); + sender = c.open_sender(url, co); } void on_sendable(proton::sender &s) OVERRIDE { http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d324e5cd/proton-c/bindings/cpp/include/proton/container.hpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/include/proton/container.hpp b/proton-c/bindings/cpp/include/proton/container.hpp index e728ce2..8524349 100644 --- a/proton-c/bindings/cpp/include/proton/container.hpp +++ b/proton-c/bindings/cpp/include/proton/container.hpp @@ -136,14 +136,21 @@ class PN_CPP_CLASS_EXTERN container { /// Open a connection and sender for `url`. /// - /// Any supplied sender options will override the container's + /// Supplied sender options will override the container's /// template options. virtual returned<sender> open_sender(const std::string &url, const proton::sender_options &o) = 0; /// Open a connection and sender for `url`. /// - /// Any supplied sender or connection options will override the + /// Supplied connection options will override the + /// container's template options. + virtual returned<sender> open_sender(const std::string &url, + const connection_options &c) = 0; + + /// Open a connection and sender for `url`. + /// + /// Supplied sender or connection options will override the /// container's template options. virtual returned<sender> open_sender(const std::string &url, const proton::sender_options &o, @@ -155,14 +162,21 @@ class PN_CPP_CLASS_EXTERN container { /// Open a connection and receiver for `url`. /// - /// Any supplied receiver options will override the container's + /// Supplied receiver options will override the container's /// template options. virtual returned<receiver> open_receiver(const std::string&url, const proton::receiver_options &o) = 0; /// Open a connection and receiver for `url`. /// - /// Any supplied receiver or connection options will override the + /// Supplied receiver or connection options will override the + /// container's template options. + virtual returned<receiver> open_receiver(const std::string&url, + const connection_options &c) = 0; + + /// Open a connection and receiver for `url`. + /// + /// Supplied receiver or connection options will override the /// container's template options. virtual returned<receiver> open_receiver(const std::string&url, const proton::receiver_options &o, @@ -237,9 +251,13 @@ class PN_CPP_CLASS_EXTERN standard_container : public container { PN_CPP_EXTERN returned<sender> open_sender(const std::string &url); PN_CPP_EXTERN returned<sender> open_sender(const std::string &url, const proton::sender_options &o); + PN_CPP_EXTERN returned<sender> open_sender(const std::string &url, + const proton::connection_options &o); PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url); PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url, - const proton::receiver_options &o); + const proton::receiver_options &o); + PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url, + const proton::connection_options &o); }; /// @endcond @@ -275,6 +293,9 @@ class container_ref : public container { const connection_options &c) { return impl_->open_sender(url, o, c); } returned<sender> open_sender( const std::string &url, + const class connection_options &o) { return impl_->open_sender(url, o); } + returned<sender> open_sender( + const std::string &url, const class sender_options &o) { return impl_->open_sender(url, o); } returned<sender> open_sender( const std::string &url) { return impl_->open_sender(url); } @@ -287,6 +308,9 @@ class container_ref : public container { const std::string&url, const class receiver_options &o) { return impl_->open_receiver(url, o); } returned<receiver> open_receiver( + const std::string&url, + const class connection_options &o) { return impl_->open_receiver(url, o); } + returned<receiver> open_receiver( const std::string&url) { return impl_->open_receiver(url); } std::string id() const { return impl_->id(); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d324e5cd/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 4ba6a6a..0e64a58 100644 --- a/proton-c/bindings/cpp/src/container.cpp +++ b/proton-c/bindings/cpp/src/container.cpp @@ -43,6 +43,10 @@ returned<sender> standard_container::open_sender(const std::string &url, const p return open_sender(url, lo, connection_options()); } +returned<sender> standard_container::open_sender(const std::string &url, const proton::connection_options &co) { + return open_sender(url, sender_options(), co); +} + returned<receiver> standard_container::open_receiver(const std::string &url) { return open_receiver(url, proton::receiver_options(), connection_options()); } @@ -51,6 +55,10 @@ returned<receiver> standard_container::open_receiver(const std::string &url, con return open_receiver(url, lo, connection_options()); } +returned<receiver> standard_container::open_receiver(const std::string &url, const proton::connection_options &co) { + return open_receiver(url, receiver_options(), co); +} + namespace{ struct listen_opts : public listen_handler { connection_options opts; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
