Qpid Proton C++  0.17.0
container.hpp
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 "./types_fwd.hpp"
27 
28 #include "./internal/config.hpp"
29 #include "./internal/export.hpp"
30 #include "./internal/pn_unique_ptr.hpp"
31 
32 #ifdef PN_CPP_HAS_STD_FUNCTION
33 #include <functional>
34 #endif
35 #include <string>
36 
37 namespace proton {
38 
50 class PN_CPP_CLASS_EXTERN container {
51  public:
53  PN_CPP_EXTERN container(messaging_handler& h, const std::string& id="");
54 
56  PN_CPP_EXTERN container(const std::string& id="");
57 
58  PN_CPP_EXTERN ~container();
59 
71  PN_CPP_EXTERN returned<connection> connect(const std::string& url, const connection_options &);
72 
74  PN_CPP_EXTERN returned<connection> connect(const std::string& url);
75 
79  PN_CPP_EXTERN void stop_listening(const std::string& url);
81 
90  PN_CPP_EXTERN listener listen(const std::string& url, listen_handler& lh);
91 
94  PN_CPP_EXTERN listener listen(const std::string& url, const connection_options&);
95 
98  PN_CPP_EXTERN listener listen(const std::string& url);
99 
105  PN_CPP_EXTERN void run();
106 
111  PN_CPP_EXTERN void auto_stop(bool);
112 
120  PN_CPP_EXTERN void stop(const error_condition& err);
121 
126  PN_CPP_EXTERN void stop();
127 
129  PN_CPP_EXTERN returned<sender> open_sender(const std::string &url);
130 
135  PN_CPP_EXTERN returned<sender> open_sender(const std::string &url,
136  const proton::sender_options &o);
137 
142  PN_CPP_EXTERN returned<sender> open_sender(const std::string &url,
143  const connection_options &c);
144 
149  PN_CPP_EXTERN returned<sender> open_sender(const std::string &url,
150  const proton::sender_options &o,
151  const connection_options &c);
152 
154  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url);
155 
156 
161  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url,
162  const proton::receiver_options &o);
163 
168  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url,
169  const connection_options &c);
170 
175  PN_CPP_EXTERN returned<receiver> open_receiver(const std::string&url,
176  const proton::receiver_options &o,
177  const connection_options &c);
178 
180  PN_CPP_EXTERN std::string id() const;
181 
185  PN_CPP_EXTERN void client_connection_options(const connection_options &);
186 
188  PN_CPP_EXTERN connection_options client_connection_options() const;
189 
194  PN_CPP_EXTERN void server_connection_options(const connection_options &);
195 
197  PN_CPP_EXTERN connection_options server_connection_options() const;
198 
202  PN_CPP_EXTERN void sender_options(const class sender_options &);
203 
205  PN_CPP_EXTERN class sender_options sender_options() const;
206 
210  PN_CPP_EXTERN void receiver_options(const class receiver_options &);
211 
213  PN_CPP_EXTERN class receiver_options receiver_options() const;
214 
218  PN_CPP_EXTERN void schedule(duration, void_function0&);
219 
220 #if PN_CPP_HAS_STD_FUNCTION
221  PN_CPP_EXTERN void schedule(duration, std::function<void()>);
223 #endif
224 
225  private:
226  class impl;
227  internal::pn_unique_ptr<impl> impl_;
228 
229  friend class connection_options;
230  friend class session_options;
231  friend class receiver_options;
232  friend class sender_options;
233 };
234 
235 } // proton
236 
237 #endif // PROTON_CONTAINER_HPP
A top-level container of connections, sessions, senders, and receivers.
Definition: container.hpp:50
A listener for incoming connections.
Definition: listener.hpp:31
Options for creating a sender.
Definition: sender_options.hpp:54
A span of time in milliseconds.
Definition: duration.hpp:36
Options for creating a connection.
Definition: connection_options.hpp:62
A C++03 compatible void no-argument callback function object.
Definition: function.hpp:35
A URL parser.
Definition: url.hpp:56
Forward declarations for all the C++ types used by Proton to represent AMQP types.
Options for creating a receiver.
Definition: receiver_options.hpp:52
Experimental - A handler for incoming connections.
Definition: listen_handler.hpp:34
A handler for Proton messaging events.
Definition: messaging_handler.hpp:59
Options for creating a session.
Definition: session_options.hpp:38
The main Proton namespace.
Definition: annotation_key.hpp:30
Describes an endpoint error state.
Definition: error_condition.hpp:37