Debian Codegraph @

cpp/src/container.cpp

raw
1 /*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 */
21
22 #include "proton/container.hpp"
23 #include "proton/error_condition.hpp"
24
25 #include "proton/error_condition.hpp"
26 #include "proton/listen_handler.hpp"
27 #include "proton/listener.hpp"
28 #include "proton/uuid.hpp"
29
30 #include "proactor_container_impl.hpp"
31
32 namespace proton {
33
34 container::container(messaging_handler& h, const std::string& id) :
35 impl_(new impl(*this, id, &h)) {}
36 container::container(messaging_handler& h) :
37 impl_(new impl(*this, uuid::random().str(), &h)) {}
38 container::container(const std::string& id) :
39 impl_(new impl(*this, id)) {}
40 container::container() :
41 impl_(new impl(*this, uuid::random().str())) {}
42 container::~container() = default;
43
44 returned<connection> container::connect(const std::string &url) {
45 return connect(url, connection_options());
46 }
47
48 returned<sender> container::open_sender(const std::string &url) {
49 return open_sender(url, proton::sender_options(), connection_options());
50 }
51
52 returned<sender> container::open_sender(const std::string &url, const proton::sender_options &lo) {
53 return open_sender(url, lo, connection_options());
54 }
55
56 returned<sender> container::open_sender(const std::string &url, const proton::connection_options &co) {
57 return open_sender(url, sender_options(), co);
58 }
59
60 returned<receiver> container::open_receiver(const std::string &url) {
61 return open_receiver(url, proton::receiver_options(), connection_options());
62 }
63
64 returned<receiver> container::open_receiver(const std::string &url, const proton::receiver_options &lo) {
65 return open_receiver(url, lo, connection_options());
66 }
67
68 returned<receiver> container::open_receiver(const std::string &url, const proton::connection_options &co) {
69 return open_receiver(url, receiver_options(), co);
70 }
71
72 listener container::listen(const std::string& url, const connection_options& opts) {
73 return impl_->listen(url, opts);
74 }
75
76 listener container::listen(const std::string &url) {
77 return impl_->listen(url);
78 }
79
80 void container::stop() { stop(error_condition()); }
81
82 returned<connection> container::connect(const std::string& url, const connection_options& opts) {
83 return impl_->connect(url, opts);
84 }
85
86 returned<connection> container::connect() {
87 return impl_->connect();
88 }
89
90 listener container::listen(const std::string& url, listen_handler& l) { return impl_->listen(url, l); }
91
92 void container::run() { impl_->run(1); }
93
94 void container::run(int threads) { impl_->run(threads); }
95
96 void container::auto_stop(bool set) { impl_->auto_stop(set); }
97
98 void container::stop(const error_condition& err) { impl_->stop(err); }
99
100 returned<sender> container::open_sender(
101 const std::string &url,
102 const class sender_options &o,
103 const connection_options &c) {
104 return impl_->open_sender(url, o, c);
105 }
106
107 returned<receiver> container::open_receiver(
108 const std::string&url,
109 const class receiver_options &o,
110 const connection_options &c) {
111 return impl_->open_receiver(url, o, c);
112 }
113
114 std::string container::id() const { return impl_->id(); }
115
116 void container::schedule(duration d, internal::v03::work f) { return impl_->schedule(d, f); }
117 void container::schedule(duration d, internal::v11::work f) { return impl_->schedule(d, f); }
118
119 void container::schedule(duration d, void_function0& f) { return impl_->schedule(d, make_work(&void_function0::operator(), &f)); }
120
121 void container::client_connection_options(const connection_options& c) { impl_->client_connection_options(c); }
122 connection_options container::client_connection_options() const { return impl_->client_connection_options(); }
123
124 void container::server_connection_options(const connection_options &o) { impl_->server_connection_options(o); }
125 connection_options container::server_connection_options() const { return impl_->server_connection_options(); }
126
127 void container::sender_options(const class sender_options &o) { impl_->sender_options(o); }
128 class sender_options container::sender_options() const { return impl_->sender_options(); }
129
130 void container::receiver_options(const class receiver_options & o) { impl_->receiver_options(o); }
131 class receiver_options container::receiver_options() const { return impl_->receiver_options(); }
132
133 } // namespace proton