Qpid Proton C++  0.12.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
container.hpp
1 #ifndef PROTON_CPP_CONTAINER_H
2 #define PROTON_CPP_CONTAINER_H
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 "proton/duration.hpp"
26 #include "proton/export.hpp"
27 #include "proton/pn_unique_ptr.hpp"
28 #include "proton/reactor.hpp"
29 #include "proton/url.hpp"
30 #include "proton/connection_options.hpp"
31 #include "proton/link_options.hpp"
32 
33 #include <string>
34 
35 namespace proton {
36 
37 class connection;
38 class acceptor;
39 class handler;
40 class sender;
41 class receiver;
42 class link;
43 class handler;
44 class task;
45 class container_impl;
46 
51 
57 class container {
58  public:
63  PN_CPP_EXTERN container(const std::string& id="");
64 
69  PN_CPP_EXTERN container(handler& mhandler, const std::string& id=std::string());
70 
71  PN_CPP_EXTERN ~container();
72 
74  PN_CPP_EXTERN connection connect(const proton::url&,
75  const connection_options &opts = connection_options());
76 
78  PN_CPP_EXTERN acceptor listen(const proton::url&,
79  const connection_options &opts = connection_options());
80 
83  PN_CPP_EXTERN void run();
84 
88  PN_CPP_EXTERN sender open_sender(const proton::url &,
91 
95  PN_CPP_EXTERN receiver open_receiver(const url &,
98 
100  PN_CPP_EXTERN std::string id() const;
101 
103 
106  PN_CPP_EXTERN class reactor reactor() const;
107 
110  PN_CPP_EXTERN task schedule(int delay, handler *h = 0);
111 
113 
118  PN_CPP_EXTERN void client_connection_options(const connection_options &);
119 
123  PN_CPP_EXTERN void server_connection_options(const connection_options &);
124 
129  PN_CPP_EXTERN void link_options(const link_options &);
130 
131  private:
132  pn_unique_ptr<container_impl> impl_;
133 
135  friend class connector;
136  friend class link;
138 };
139 
140 }
141 
142 #endif // PROTON_CPP_CONTAINER_H
sender open_sender(const proton::url &, const proton::link_options &l=proton::link_options(), const connection_options &c=connection_options())
Open a connection to url and open a sender for url.path().
A top-level container of connections, sessions, and links.
Definition: container.hpp:57
A context for accepting inbound connections.
Definition: acceptor.hpp:36
void server_connection_options(const connection_options &)
Copy the connection options to a template which will be applied to incoming connections.
A link for sending messages.
Definition: sender.hpp:38
receiver open_receiver(const url &, const proton::link_options &l=proton::link_options(), const connection_options &c=connection_options())
Open a connection to url and open a receiver for url.path().
acceptor listen(const proton::url &, const connection_options &opts=connection_options())
Listen on url for incoming connections.
A connection to a remote AMQP peer.
Definition: connection.hpp:42
Options for creating a connection.
Definition: connection_options.hpp:60
void client_connection_options(const connection_options &)
Copy the connection options to a template which will be applied to subsequent outgoing connections...
A proton URL.
Definition: url.hpp:51
Callback functions for handling proton events.
Definition: handler.hpp:40
std::string id() const
A unique identifier for the container.
connection connect(const proton::url &, const connection_options &opts=connection_options())
Open a connection to url.
A link for receiving messages.
Definition: receiver.hpp:36
void run()
Start processing events.
void link_options(const link_options &)
Copy the link options to a template applied to new links created and opened by this container...
container(const std::string &id="")
Create a container.