Qpid C++ Messaging API  0.22
qpid/messaging/Connection.h
Go to the documentation of this file.
00001 #ifndef QPID_MESSAGING_CONNECTION_H
00002 #define QPID_MESSAGING_CONNECTION_H
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 #include "qpid/messaging/ImportExport.h"
00025 
00026 #include "qpid/messaging/Handle.h"
00027 #include "qpid/messaging/exceptions.h"
00028 #include "qpid/types/Variant.h"
00029 
00030 #include <string>
00031 
00032 namespace qpid {
00033 namespace messaging {
00034 
00035 #ifndef SWIG
00036 template <class> class PrivateImplRef;
00037 #endif
00038 class ConnectionImpl;
00039 class Session;
00040 
00045 class QPID_MESSAGING_CLASS_EXTERN Connection : public qpid::messaging::Handle<ConnectionImpl>
00046 {
00047   public:
00048     QPID_MESSAGING_EXTERN Connection(ConnectionImpl* impl);
00049     QPID_MESSAGING_EXTERN Connection(const Connection&);
00050     QPID_MESSAGING_EXTERN Connection();
00082     QPID_MESSAGING_EXTERN Connection(const std::string& url, const qpid::types::Variant::Map& options = qpid::types::Variant::Map());
00089     QPID_MESSAGING_EXTERN Connection(const std::string& url, const std::string& options);
00090     QPID_MESSAGING_EXTERN ~Connection();
00091     QPID_MESSAGING_EXTERN Connection& operator=(const Connection&);
00092     QPID_MESSAGING_EXTERN void setOption(const std::string& name, const qpid::types::Variant& value);
00093     QPID_MESSAGING_EXTERN void open();
00094     QPID_MESSAGING_EXTERN bool isOpen();
00095     QPID_MESSAGING_EXTERN bool isOpen() const;
00101     QPID_MESSAGING_EXTERN void close();
00102     QPID_MESSAGING_EXTERN Session createTransactionalSession(const std::string& name = std::string());
00103     QPID_MESSAGING_EXTERN Session createSession(const std::string& name = std::string());
00104 
00105     QPID_MESSAGING_EXTERN Session getSession(const std::string& name) const;
00106     QPID_MESSAGING_EXTERN std::string getAuthenticatedUsername();
00107 
00108 #ifndef SWIG
00109   private:
00110   friend class qpid::messaging::PrivateImplRef<Connection>;
00111 #endif
00112 };
00113 
00114 }} // namespace qpid::messaging
00115 
00116 #endif