Qpid Proton C++ API  0.19.0
container.hpp
Go to the documentation of this file.
1 #ifndef PROTON_CONTAINER_HPP
2 #define PROTON_CONTAINER_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 "./fwd.hpp"
26 #include "./returned.hpp"
27 #include "./types_fwd.hpp"
28 
29 #include "./internal/config.hpp"
30 #include "./internal/export.hpp"
31 #include "./internal/pn_unique_ptr.hpp"
32 
33 #include <string>
34 
37 
38 namespace proton {
39 
50 class PN_CPP_CLASS_EXTERN container {
51  public:
62  PN_CPP_EXTERN container(messaging_handler& handler, const std::string& id);
63 
72  PN_CPP_EXTERN container(messaging_handler& handler);
73 
76  PN_CPP_EXTERN container(const std::string& id);
77 
81  PN_CPP_EXTERN container();
82 
92  PN_CPP_EXTERN ~container();
93 
108  PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url,
109  const connection_options& conn_opts);
110 
114  PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url);
115 
128  PN_CPP_EXTERN listener listen(const std::string& listen_url,
129  listen_handler& handler);
130 
139  PN_CPP_EXTERN listener listen(const std::string& listen_url,
140  const connection_options& conn_opts);
141 
147  PN_CPP_EXTERN listener listen(const std::string& listen_url);
148 
157  PN_CPP_EXTERN void run();
158 
159 #if PN_CPP_SUPPORTS_THREADS
160  PN_CPP_EXTERN void run(int count);
167 #endif
168 
175  PN_CPP_EXTERN void auto_stop(bool enabled);
176 
180  PN_CPP_EXTERN void stop(const error_condition& err);
181 
195  PN_CPP_EXTERN void stop();
196 
200  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url);
201 
208  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
209  const proton::sender_options& snd_opts);
210 
217  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
218  const connection_options& conn_opts);
219 
226  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
227  const proton::sender_options& snd_opts,
228  const connection_options& conn_opts);
229 
233  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url);
234 
235 
242  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
243  const proton::receiver_options& rcv_opts);
244 
251  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
252  const connection_options& conn_opts);
253 
260  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
261  const proton::receiver_options& rcv_opts,
262  const connection_options& conn_opts);
263 
265  PN_CPP_EXTERN std::string id() const;
266 
270  PN_CPP_EXTERN void client_connection_options(const connection_options& conn_opts);
271 
273  PN_CPP_EXTERN connection_options client_connection_options() const;
274 
279  PN_CPP_EXTERN void server_connection_options(const connection_options& conn_opts);
280 
282  PN_CPP_EXTERN connection_options server_connection_options() const;
283 
287  PN_CPP_EXTERN void sender_options(const class sender_options& snd_opts);
288 
290  PN_CPP_EXTERN class sender_options sender_options() const;
291 
295  PN_CPP_EXTERN void receiver_options(const class receiver_options& rcv_opts);
296 
298  PN_CPP_EXTERN class receiver_options receiver_options() const;
299 
305  PN_CPP_EXTERN void schedule(duration dur, work fn);
306 
308  PN_CPP_EXTERN PN_CPP_DEPRECATED("Use 'container::schedule(duration, work)'") void schedule(duration dur, void_function0& fn);
309 
311  // This is a hack to ensure that the C++03 version is declared
312  // only during the compilation of the library
313 #if PN_CPP_HAS_LAMBDAS && PN_CPP_HAS_VARIADIC_TEMPLATES && defined(qpid_proton_cpp_EXPORTS)
314  PN_CPP_EXTERN void schedule(duration dur, internal::v03::work fn);
315 #endif
316 
318  private:
319  class impl;
320  internal::pn_unique_ptr<impl> impl_;
321 
323  friend class connection_options;
324  friend class session_options;
325  friend class receiver_options;
326  friend class sender_options;
327  friend class work_queue;
329 };
330 
331 } // proton
332 
333 #endif // PROTON_CONTAINER_HPP
A return type for container methods.
A top-level container of connections, sessions, and links.
Definition: container.hpp:50
A listener for incoming connections.
Definition: listener.hpp:33
Options for creating a sender.
Definition: sender_options.hpp:57
A span of time in milliseconds.
Definition: duration.hpp:39
Forward declarations.
Options for creating a connection.
Definition: connection_options.hpp:65
A return type for container methods.
Definition: fwd.hpp:79
Forward declarations for Proton types used to represent AMQP types.
Options for creating a receiver.
Definition: receiver_options.hpp:56
Unsettled API - A handler for incoming connections.
Definition: listen_handler.hpp:39
Unsettled API - A context for thread-safe execution of work.
Definition: work_queue.hpp:339
A handler for Proton messaging events.
Definition: messaging_handler.hpp:62
Options for creating a session.
Definition: session_options.hpp:40
The main Proton namespace.
Definition: annotation_key.hpp:33
Describes an endpoint error state.
Definition: error_condition.hpp:40