Qpid Proton C++ API  0.18.1
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 
40 #define PN_CPP_SUPPORTS_THREADS PN_CPP_HAS_STD_THREAD && PN_CPP_HAS_STD_MUTEX
41 
43 namespace proton {
44 
55 class PN_CPP_CLASS_EXTERN container {
56  public:
67  PN_CPP_EXTERN container(messaging_handler& handler, const std::string& id);
68 
77  PN_CPP_EXTERN container(messaging_handler& handler);
78 
81  PN_CPP_EXTERN container(const std::string& id);
82 
86  PN_CPP_EXTERN container();
87 
97  PN_CPP_EXTERN ~container();
98 
113  PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url,
114  const connection_options& conn_opts);
115 
119  PN_CPP_EXTERN returned<connection> connect(const std::string& conn_url);
120 
133  PN_CPP_EXTERN listener listen(const std::string& listen_url,
134  listen_handler& handler);
135 
144  PN_CPP_EXTERN listener listen(const std::string& listen_url,
145  const connection_options& conn_opts);
146 
152  PN_CPP_EXTERN listener listen(const std::string& listen_url);
153 
162  PN_CPP_EXTERN void run();
163 
164 #if PN_CPP_SUPPORTS_THREADS
165  PN_CPP_EXTERN void run(int count);
172 #endif
173 
180  PN_CPP_EXTERN void auto_stop(bool enabled);
181 
185  PN_CPP_EXTERN void stop(const error_condition& err);
186 
200  PN_CPP_EXTERN void stop();
201 
205  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url);
206 
213  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
214  const proton::sender_options& snd_opts);
215 
222  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
223  const connection_options& conn_opts);
224 
231  PN_CPP_EXTERN returned<sender> open_sender(const std::string& addr_url,
232  const proton::sender_options& snd_opts,
233  const connection_options& conn_opts);
234 
238  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url);
239 
240 
247  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
248  const proton::receiver_options& rcv_opts);
249 
256  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
257  const connection_options& conn_opts);
258 
265  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string& addr_url,
266  const proton::receiver_options& rcv_opts,
267  const connection_options& conn_opts);
268 
270  PN_CPP_EXTERN std::string id() const;
271 
275  PN_CPP_EXTERN void client_connection_options(const connection_options& conn_opts);
276 
278  PN_CPP_EXTERN connection_options client_connection_options() const;
279 
284  PN_CPP_EXTERN void server_connection_options(const connection_options& conn_opts);
285 
287  PN_CPP_EXTERN connection_options server_connection_options() const;
288 
292  PN_CPP_EXTERN void sender_options(const class sender_options& snd_opts);
293 
295  PN_CPP_EXTERN class sender_options sender_options() const;
296 
300  PN_CPP_EXTERN void receiver_options(const class receiver_options& rcv_opts);
301 
303  PN_CPP_EXTERN class receiver_options receiver_options() const;
304 
310  PN_CPP_EXTERN void schedule(duration dur, work fn);
311 
313  PN_CPP_EXTERN PN_CPP_DEPRECATED("Use 'container::schedule(duration, work)'") void schedule(duration dur, void_function0& fn);
314 
316  // This is a hack to ensure that the C++03 version is declared
317  // only during the compilation of the library
318 #if PN_CPP_HAS_LAMBDAS && PN_CPP_HAS_VARIADIC_TEMPLATES && defined(qpid_proton_cpp_EXPORTS)
319  PN_CPP_EXTERN void schedule(duration dur, internal::v03::work fn);
320 #endif
321 
323  private:
324  class impl;
325  internal::pn_unique_ptr<impl> impl_;
326 
328  friend class connection_options;
329  friend class session_options;
330  friend class receiver_options;
331  friend class sender_options;
332  friend class work_queue;
334 };
335 
336 } // proton
337 
338 #endif // PROTON_CONTAINER_HPP
A return type for container methods.
A top-level container of connections, sessions, and links.
Definition: container.hpp:55
A listener for incoming connections.
Definition: listener.hpp:33
Options for creating a sender.
Definition: sender_options.hpp:56
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:55
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