NO-JIRA: c++: minor cleanup - use proton::duration in link options that are durations. - rename link::source/target to local_source/local_target.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/103b3125 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/103b3125 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/103b3125 Branch: refs/heads/master Commit: 103b312556dce0216def48f006bdfc0c381b35e8 Parents: 08e5d95 Author: Alan Conway <[email protected]> Authored: Fri Jan 22 09:22:31 2016 -0500 Committer: Alan Conway <[email protected]> Committed: Fri Jan 22 09:27:05 2016 -0500 ---------------------------------------------------------------------- examples/cpp/broker.hpp | 10 +++++----- examples/cpp/server_direct.cpp | 4 ++-- proton-c/bindings/cpp/include/proton/link.hpp | 4 ++-- proton-c/bindings/cpp/src/blocking_receiver.cpp | 2 +- proton-c/bindings/cpp/src/blocking_sender.cpp | 2 +- proton-c/bindings/cpp/src/container_impl.cpp | 4 ++-- proton-c/bindings/cpp/src/link.cpp | 4 ++-- proton-c/bindings/cpp/src/link_options.cpp | 14 +++++++------- proton-c/bindings/cpp/src/session.cpp | 5 ++--- 9 files changed, 24 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/examples/cpp/broker.hpp ---------------------------------------------------------------------- diff --git a/examples/cpp/broker.hpp b/examples/cpp/broker.hpp index 6b4096e..2b50128 100644 --- a/examples/cpp/broker.hpp +++ b/examples/cpp/broker.hpp @@ -144,21 +144,21 @@ class broker_handler : public proton::handler { proton::terminus remote_source(lnk.remote_source()); queue &q = remote_source.dynamic() ? queues_.dynamic() : queues_.get(remote_source.address()); - lnk.source().address(q.name()); + lnk.local_source().address(q.name()); q.subscribe(lnk.sender()); std::cout << "broker outgoing link from " << q.name() << std::endl; } else { // Receiver std::string address = lnk.remote_target().address(); if (!address.empty()) { - lnk.target().address(address); + lnk.local_target().address(address); std::cout << "broker incoming link to " << address << std::endl; } } } void unsubscribe (proton::sender lnk) { - std::string address = lnk.source().address(); + std::string address = lnk.local_source().address(); if (queues_.get(address).unsubscribe(lnk)) queues_.erase(address); } @@ -187,13 +187,13 @@ class broker_handler : public proton::handler { void on_sendable(proton::event &e) { proton::link lnk = e.link(); - std::string address = lnk.source().address(); + std::string address = lnk.local_source().address(); proton::sender s = lnk.sender(); queues_.get(address).dispatch(&s); } void on_message(proton::event &e) { - std::string address = e.link().target().address(); + std::string address = e.link().local_target().address(); queues_.get(address).publish(e.message(), e.link().receiver()); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/examples/cpp/server_direct.cpp ---------------------------------------------------------------------- diff --git a/examples/cpp/server_direct.cpp b/examples/cpp/server_direct.cpp index 62384b4..abc49c0 100644 --- a/examples/cpp/server_direct.cpp +++ b/examples/cpp/server_direct.cpp @@ -65,8 +65,8 @@ class server : public proton::handler { void on_link_open(proton::event& e) { proton::link link = e.link(); if (!!link.sender() && link.remote_source().dynamic()) { - link.source().address(generate_address()); - senders[link.source().address()] = link.sender(); + link.local_source().address(generate_address()); + senders[link.local_source().address()] = link.sender(); } } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/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 c876fa0..66d1c27 100644 --- a/proton-c/bindings/cpp/include/proton/link.hpp +++ b/proton-c/bindings/cpp/include/proton/link.hpp @@ -86,9 +86,9 @@ class link : public object<pn_link_t> , public endpoint PN_CPP_EXTERN int drained(); /** Local source of the link. */ - PN_CPP_EXTERN terminus source() const; + PN_CPP_EXTERN terminus local_source() const; /** Local target of the link. */ - PN_CPP_EXTERN terminus target() const; + PN_CPP_EXTERN terminus local_target() const; /** Remote source of the link. */ PN_CPP_EXTERN terminus remote_source() const; /** Remote target of the link. */ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/proton-c/bindings/cpp/src/blocking_receiver.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/blocking_receiver.cpp b/proton-c/bindings/cpp/src/blocking_receiver.cpp index ed70634..755c30c 100644 --- a/proton-c/bindings/cpp/src/blocking_receiver.cpp +++ b/proton-c/bindings/cpp/src/blocking_receiver.cpp @@ -47,7 +47,7 @@ blocking_receiver::blocking_receiver( blocking_link(c), fetcher_(new blocking_fetcher(credit)) { open(c.impl_->connection_.open_receiver(addr, link_options().dynamic_address(dynamic).handler(fetcher_.get()))); - std::string sa = link_.source().address(); + std::string sa = link_.local_source().address(); std::string rsa = link_.remote_source().address(); if (!sa.empty() && sa.compare(rsa) != 0) { wait_for_closed(); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/proton-c/bindings/cpp/src/blocking_sender.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/blocking_sender.cpp b/proton-c/bindings/cpp/src/blocking_sender.cpp index b6ad7dc..b42698c 100644 --- a/proton-c/bindings/cpp/src/blocking_sender.cpp +++ b/proton-c/bindings/cpp/src/blocking_sender.cpp @@ -40,7 +40,7 @@ blocking_sender::blocking_sender(blocking_connection &c, const std::string &addr blocking_link(c) { open(c.impl_->connection_.open_sender(address)); - std::string ta = link_.target().address(); + std::string ta = link_.local_target().address(); std::string rta = link_.remote_target().address(); if (ta.empty() || ta.compare(rta) != 0) { wait_for_closed(); http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/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 dcc48a9..8954441 100644 --- a/proton-c/bindings/cpp/src/container_impl.cpp +++ b/proton-c/bindings/cpp/src/container_impl.cpp @@ -172,7 +172,7 @@ sender container_impl::open_sender(const proton::url &url, const proton::link_op connection conn = connect(url, copts); std::string path = url.path(); sender snd = conn.default_session().create_sender(id_ + '-' + path); - snd.target().address(path); + snd.local_target().address(path); snd.open(lopts); return snd; } @@ -185,7 +185,7 @@ receiver container_impl::open_receiver(const proton::url &url, const proton::lin connection conn = connect(url, copts); std::string path = url.path(); receiver rcv = conn.default_session().create_receiver(id_ + '-' + path); - rcv.source().address(path); + rcv.local_source().address(path); rcv.open(lopts); return rcv; } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/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 075bc9f..deab0b2 100644 --- a/proton-c/bindings/cpp/src/link.cpp +++ b/proton-c/bindings/cpp/src/link.cpp @@ -64,8 +64,8 @@ int link::queued() { return pn_link_queued(pn_object()); } int link::unsettled() { return pn_link_unsettled(pn_object()); } int link::drained() { return pn_link_drained(pn_object()); } -terminus link::source() const { return pn_link_source(pn_object()); } -terminus link::target() const { return pn_link_target(pn_object()); } +terminus link::local_source() const { return pn_link_source(pn_object()); } +terminus link::local_target() const { return pn_link_target(pn_object()); } terminus link::remote_source() const { return pn_link_remote_source(pn_object()); } terminus link::remote_target() const { return pn_link_remote_target(pn_object()); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/proton-c/bindings/cpp/src/link_options.cpp ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/src/link_options.cpp b/proton-c/bindings/cpp/src/link_options.cpp index ef8de3f..2514a30 100644 --- a/proton-c/bindings/cpp/src/link_options.cpp +++ b/proton-c/bindings/cpp/src/link_options.cpp @@ -76,9 +76,9 @@ class link_options::impl { if (local_address.set) { const char *addr = local_address.value.empty() ? NULL : local_address.value.c_str(); if (sender) - l.target().address(addr); + l.local_target().address(addr); else - l.source().address(addr); + l.local_source().address(addr); } if (delivery_mode.set) { switch (delivery_mode.value) { @@ -100,7 +100,7 @@ class link_options::impl { l.detach_handler(); } if (dynamic_address.set) { - terminus t = sender ? l.target() : l.source(); + terminus t = sender ? l.local_target() : l.local_source(); t.dynamic(dynamic_address.value); if (dynamic_address.value) { std::string lp, dm; @@ -119,13 +119,13 @@ class link_options::impl { } if (!sender) { // receiver only options - if (distribution_mode.set) l.source().distribution_mode(distribution_mode.value); + if (distribution_mode.set) l.local_source().distribution_mode(distribution_mode.value); if (durable_subscription.set && durable_subscription.value) { - l.source().durability(terminus::DELIVERIES); - l.source().expiry_policy(terminus::EXPIRE_NEVER); + l.local_source().durability(terminus::DELIVERIES); + l.local_source().expiry_policy(terminus::EXPIRE_NEVER); } if (selector.set && selector.value.size()) { - encoder enc = l.source().filter().encode(); + encoder enc = l.local_source().filter().encode(); enc << start::map() << amqp_symbol("selector") << start::described() << amqp_symbol("apache.org:selector-filter:string") << amqp_binary(selector.value) << finish(); } http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/103b3125/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 c851ef7..9602e40 100644 --- a/proton-c/bindings/cpp/src/session.cpp +++ b/proton-c/bindings/cpp/src/session.cpp @@ -55,7 +55,7 @@ sender session::create_sender(const std::string& name) { sender session::open_sender(const std::string &addr, const link_options &lo) { sender snd = create_sender(); - snd.target().address(addr); + snd.local_target().address(addr); snd.open(lo); return snd; } @@ -63,7 +63,7 @@ sender session::open_sender(const std::string &addr, const link_options &lo) { receiver session::open_receiver(const std::string &addr, const link_options &lo) { receiver rcv = create_receiver(); - rcv.source().address(addr); + rcv.local_source().address(addr); rcv.open(lo); return rcv; } @@ -84,4 +84,3 @@ link_range session::find_links(endpoint::state mask) const { } } // namespace proton - --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
