Qpid Proton C++ API  0.21.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 
194  PN_CPP_EXTERN void stop();
195 
199  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url);
200 
207  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
208  const proton::sender_options& snd_opts);
209 
216  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
217  const connection_options& conn_opts);
218 
225  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
226  const proton::sender_options& snd_opts,
227  const connection_options& conn_opts);
228 
232  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url);
233 
234 
241  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
242  const proton::receiver_options& rcv_opts);
243 
250  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
251  const connection_options& conn_opts);
252 
259  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
260  const proton::receiver_options& rcv_opts,
261  const connection_options& conn_opts);
262 
264  PN_CPP_EXTERN std::string id() const;
265 
269  PN_CPP_EXTERN void client_connection_options(const connection_options& conn_opts);
270 
272  PN_CPP_EXTERN connection_options client_connection_options() const;
273 
278  PN_CPP_EXTERN void server_connection_options(const connection_options& conn_opts);
279 
281  PN_CPP_EXTERN connection_options server_connection_options() const;
282 
286  PN_CPP_EXTERN void sender_options(const class sender_options& snd_opts);
287 
289  PN_CPP_EXTERN class sender_options sender_options() const;
290 
294  PN_CPP_EXTERN void receiver_options(const class receiver_options& rcv_opts);
295 
297  PN_CPP_EXTERN class receiver_options receiver_options() const;
298 
304  PN_CPP_EXTERN void schedule(duration dur, work fn);
305 
307  PN_CPP_EXTERN PN_CPP_DEPRECATED("Use 'container::schedule(duration, work)'") void schedule(duration dur, void_function0& fn);
308 
310  // This is a hack to ensure that the C++03 version is declared
311  // only during the compilation of the library
312 #if PN_CPP_HAS_LAMBDAS && PN_CPP_HAS_VARIADIC_TEMPLATES && defined(qpid_proton_cpp_EXPORTS)
313  PN_CPP_EXTERN void schedule(duration dur, internal::v03::work fn);
314 #endif
315 
317  private:
318  class impl;
319  internal::pn_unique_ptr<impl> impl_;
320 
322  friend class connection_options;
323  friend class session_options;
324  friend class receiver_options;
325  friend class sender_options;
326  friend class work_queue;
328 };
329 
330 } // proton
331 
332 #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:66
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