Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BD039200B54 for ; Wed, 13 Jul 2016 11:45:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BBC2C160A89; Wed, 13 Jul 2016 09:45:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E57F1160A96 for ; Wed, 13 Jul 2016 11:45:40 +0200 (CEST) Received: (qmail 46251 invoked by uid 500); 13 Jul 2016 09:45:40 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 45367 invoked by uid 99); 13 Jul 2016 09:45:39 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2016 09:45:39 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 85C93E04EE; Wed, 13 Jul 2016 09:45:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jross@apache.org To: commits@qpid.apache.org Date: Wed, 13 Jul 2016 09:45:57 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [19/51] [partial] qpid-site git commit: QPID-7350: Restore some missing 0.13.0 examples and the tutorial; avoid some accidental exposure of example classes in API ref archived-at: Wed, 13 Jul 2016 09:45:43 -0000 http://git-wip-us.apache.org/repos/asf/qpid-site/blob/59433afd/content/releases/qpid-proton-0.13.0/proton/cpp/api/container__impl__base_8hpp_source.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-proton-0.13.0/proton/cpp/api/container__impl__base_8hpp_source.html b/content/releases/qpid-proton-0.13.0/proton/cpp/api/container__impl__base_8hpp_source.html index 1c3f042..79fcda8 100755 --- a/content/releases/qpid-proton-0.13.0/proton/cpp/api/container__impl__base_8hpp_source.html +++ b/content/releases/qpid-proton-0.13.0/proton/cpp/api/container__impl__base_8hpp_source.html @@ -3,7 +3,7 @@ - + Qpid Proton C++ API: proton/io/container_impl_base.hpp Source File @@ -55,7 +55,7 @@ - + @@ -93,132 +93,9 @@ $(document).ready(function(){initNavTree('container__impl__base_8hpp_source.html
container_impl_base.hpp
-
1 #ifndef PROTON_IO_CONTAINER_IMPL_BASE_HPP
-
2 #define PROTON_IO_CONTAINER_IMPL_BASE_HPP
-
3 
-
4 /*
-
5  *
-
6  * Licensed to the Apache Software Foundation (ASF) under one
-
7  * or more contributor license agreements. See the NOTICE file
-
8  * distributed with this work for additional information
-
9  * regarding copyright ownership. The ASF licenses this file
-
10  * to you under the Apache License, Version 2.0 (the
-
11  * "License"); you may not use this file except in compliance
-
12  * with the License. You may obtain a copy of the License at
-
13  *
-
14  * http://www.apache.org/licenses/LICENSE-2.0
-
15  *
-
16  * Unless required by applicable law or agreed to in writing,
-
17  * software distributed under the License is distributed on an
-
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-
19  * KIND, either express or implied. See the License for the
-
20  * specific language governing permissions and limitations
-
21  * under the License.
-
22  *
-
23  */
-
24 
-
25 #include "./link_namer.hpp"
-
26 #include "../container.hpp"
-
27 
-
28 #include <mutex>
-
29 #include <sstream>
-
30 
-
31 namespace proton {
-
32 namespace io {
-
33 
- -
43  public:
- -
46  store(client_copts_, opts);
-
47  }
-
48 
- -
51  return load(client_copts_);
-
52  }
-
53 
- -
56  store(server_copts_, opts);
-
57  }
-
58 
- -
61  return load(server_copts_);
-
62  }
-
63 
-
65  void sender_options(const class sender_options & opts) {
-
66  store(sender_opts_, opts);
-
67  }
-
68 
- -
71  return load(sender_opts_);
-
72  }
-
73 
-
75  void receiver_options(const class receiver_options & opts) {
-
76  store(receiver_opts_, opts);
-
77  }
-
78 
- -
81  return load(receiver_opts_);
-
82  }
-
83 
-
85  returned<sender> open_sender(
-
86  const std::string &url, const class sender_options &opts, const connection_options &copts)
-
87  {
-
88  return open_link<sender, class sender_options>(url, opts, copts, &connection::open_sender);
-
89  }
-
90 
-
92  returned<receiver> open_receiver(
-
93  const std::string &url, const class receiver_options &opts, const connection_options &copts)
-
94  {
-
95  return open_link<receiver>(url, opts, copts, &connection::open_receiver);
-
96  }
-
97 
-
98  private:
-
99  template<class T, class Opts>
-
100  returned<T> open_link(
-
101  const std::string &url_str, const Opts& opts, const connection_options& copts,
-
102  T (connection::*open_fn)(const std::string&, const Opts&))
-
103  {
-
104  std::string addr = url(url_str).path();
-
105  std::shared_ptr<thread_safe<connection> > ts_connection = connect(url_str, copts);
-
106  std::promise<returned<T> > result_promise;
-
107  auto do_open = [ts_connection, addr, opts, open_fn, &result_promise]() {
-
108  try {
-
109  connection c = ts_connection->unsafe();
-
110  returned<T> s = make_thread_safe((c.*open_fn)(addr, opts));
-
111  result_promise.set_value(s);
-
112  } catch (...) {
-
113  result_promise.set_exception(std::current_exception());
-
114  }
-
115  };
-
116  ts_connection->event_loop()->inject(do_open);
-
117  std::future<returned<T> > result_future = result_promise.get_future();
-
118  if (!result_future.valid())
-
119  throw error(url_str+": connection closed");
-
120  return result_future.get();
-
121  }
-
122 
-
123  mutable std::mutex lock_;
-
124  template <class T> T load(const T& v) const {
-
125  std::lock_guard<std::mutex> g(lock_);
-
126  return v;
-
127  }
-
128  template <class T> void store(T& v, const T& x) const {
-
129  std::lock_guard<std::mutex> g(lock_);
-
130  v = x;
-
131  }
-
132  connection_options client_copts_, server_copts_;
-
133  class receiver_options receiver_opts_;
-
134  class sender_options sender_opts_;
-
135 };
-
136 
-
137 } // io
-
138 } // proton
-
139 
-
140 #endif // PROTON_IO_CONTAINER_IMPL_BASE_HPP
-
virtual returned< connection > connect(const std::string &url, const connection_options &)=0
Connect to url and send an open request to the remote peer.
-
std::string path() const
path is everything after the final "/".
+
1 #ifndef PROTON_IO_CONTAINER_IMPL_BASE_HPP
2 #define PROTON_IO_CONTAINER_IMPL_BASE_HPP
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
25 #include "./link_namer.hpp"
26 #include "../container.hpp"
27 
28 #include <mutex>
29 #include <sstream>
30 
31 namespace proton {
32 namespace io {
33 
43  public:
46  store(client_copts_, opts);
47  }
48 
51  return load(client_copts_);
52  }
53 
56  store(server_copts_, opts);
57  }
58 
61  return load(server_copts_);
62  }
63 
65  void sender_options(const class sender_options & opts) {
66  store(sender_opts_, opts);
67  }
68 
71  return load(sender_opts_);
72  }
73 
75  void receiver_options(const class receiver_options & opts) {
76  store(receiver_opts_, opts);
77  }
78 
81  return load(receiver_opts_);
82  }
83 
85  returned<sender> open_sender(
86  co nst std::string &url, const class sender_options &opts, const connection_options &copts)
87  {
88  return open_link<sender, class sender_options>(url, opts, copts, &connection::open_sender);
89  }
90 
< /a> 92  returned<receiver> open_receiver(
93  const std::string &url, const class receiver_options &opts, const connection_options &copts)
94  {
95  return open_link<receiver>(url, opts, copts, &connection::open_receiver);
96  }
97 
98  private:
99  template<class T, class Opts>
100  returned<T> open_link(
101  const std::string &url_str, const Opts& opts, const connection_options& copts,
102  T (connection::*open_fn)(const std::string&, const Opts&))
103  {
104  std::string addr = url(url_str).path();
105  std::shared_ptr<thread_safe<connection> > ts_connection = connect(url_str, copts);
106  std::promise<returned<T> > result_promise;
107  auto do_open = [ts_connection, addr, opts, open_fn, &result_promise]() {
108  try {
109  connection c = ts_connection->unsafe();
110  returned<T> s = make_thread_safe((c.*open_fn)(addr, opts));
111  result_promise.set_value(s);
112  } catch (...) {
113  result_promise.set_exception(std::current_exception());
114  }
115  };
116  ts_connection->event_loop()->inject(do_open);
117  std::future<returned<T> > result_future = result_promise.get_future();
118  if (!result_future.valid())
119  throw error(url_str+": connection closed");
120  return result_future.get();
121  }
122 
123  mutable std::mutex lock_;
124  template <class T> T load(const T& v) const {
125  std::lock_guard<std::mutex> g(lock_);
126  return v;
127  }
128  template <class T> void store(T& v, const T& x) const {
129  std::lock_guard<std::mutex> g(lock_);
130  v = x;
131  }
132  connection_options client_copts_, server_copts_;
133  class receiver_options receiver_opts_;
134  class sender_options sender_opts_;
135 };
136 
137 } // io
138 } // proton
139 
140 #endif // PROTON_IO_CONTAINER_IMPL_BASE_HPP
virtual returned< connection > connect(const std::string &url, const connection_options &)=0
Connect to url and send an open request to the remote peer.
+
std::string path() const
path is everything after the final "/".
A top-level container of connections, sessions, senders, and receivers.
Definition: container.hpp:59
-
class receiver_options receiver_options() const
Receiver options applied to receivers created by this container.
Definition: container_impl_base.hpp:80
receiver open_receiver(const std::string &addr)
Open a receiver for addr on default_session().
Options for creating a sender.
Definition: sender_options.hpp:64
void client_connection_options(const connection_options &opts)
Connection options that will be to outgoing connections.
Definition: container_impl_base.hpp:45
@@ -235,7 +112,7 @@ $(document).ready(function(){initNavTree('container__impl__base_8hpp_source.html
connection_options client_connection_options() const
Connection options that will be to outgoing connections.
Definition: container_impl_base.hpp:50
returned< receiver > open_receiver(const std::string &url, const class receiver_options &opts, const connection_options &copts)
Open a connection and receiver for url.
Definition: container_impl_base.hpp:92
void server_connection_options(const connection_options &opts)
Connection options that will be applied to incoming connections.
Definition: container_impl_base.hpp:55
-
class sender_options sender_options() const
Sender options applied to senders created by this container.
Definition: container_impl_base.hpp:70
+
The base Proton error.
Definition: error.hpp:37
returned< T > make_thread_safe(const T &obj)
Make a thread-safe wrapper for obj.
Definition: thread_safe.hpp:162
Type traits for mapping between AMQP and C++ types.
Definition: annotation_key.hpp:28
@@ -243,10 +120,10 @@ $(document).ready(function(){initNavTree('container__impl__base_8hpp_source.html --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org