Qpid C++ Messaging API  1.37.0
Connection.h
1 #ifndef QPID_MESSAGING_CONNECTION_H
2 #define QPID_MESSAGING_CONNECTION_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 #include "qpid/messaging/ImportExport.h"
25 
26 #include "qpid/messaging/Handle.h"
27 #include "qpid/messaging/exceptions.h"
28 #include "qpid/types/Variant.h"
29 
30 #include <string>
31 
32 namespace qpid {
33 namespace messaging {
34 
35 #ifndef SWIG
36 template <class> class PrivateImplRef;
37 #endif
38 class ConnectionImpl;
39 class Session;
40 
45 class QPID_MESSAGING_CLASS_EXTERN Connection : public qpid::messaging::Handle<ConnectionImpl>
46 {
47  public:
48  QPID_MESSAGING_EXTERN Connection(ConnectionImpl* impl);
49  QPID_MESSAGING_EXTERN Connection(const Connection&);
50  QPID_MESSAGING_EXTERN Connection();
122  QPID_MESSAGING_EXTERN Connection(const std::string& url, const qpid::types::Variant::Map& options = qpid::types::Variant::Map());
129  QPID_MESSAGING_EXTERN Connection(const std::string& url, const std::string& options);
130  QPID_MESSAGING_EXTERN ~Connection();
131  QPID_MESSAGING_EXTERN Connection& operator=(const Connection&);
132  QPID_MESSAGING_EXTERN void setOption(const std::string& name, const qpid::types::Variant& value);
133  QPID_MESSAGING_EXTERN void open();
134  QPID_MESSAGING_EXTERN bool isOpen();
135  QPID_MESSAGING_EXTERN bool isOpen() const;
136 
146  QPID_MESSAGING_EXTERN void reconnect(const std::string& url);
156  QPID_MESSAGING_EXTERN void reconnect();
161  QPID_MESSAGING_EXTERN std::string getUrl() const;
162 
168  QPID_MESSAGING_EXTERN void close();
169  QPID_MESSAGING_EXTERN Session createTransactionalSession(const std::string& name = std::string());
170  QPID_MESSAGING_EXTERN Session createSession(const std::string& name = std::string());
171 
172  QPID_MESSAGING_EXTERN Session getSession(const std::string& name) const;
173  QPID_MESSAGING_EXTERN std::string getAuthenticatedUsername();
174 
175 #ifndef SWIG
176  private:
177  friend class qpid::messaging::PrivateImplRef<Connection>;
178 #endif
179 };
180 
181 }} // namespace qpid::messaging
182 
183 #endif
Definition: Variant.h:73
Definition: Connection.h:36
Definition: Connection.h:45
Definition: Handle.h:39
Definition: Session.h:49
Definition: Address.h:32