proton/session.hpp

Go to the documentation of this file.
00001 #ifndef PROTON_SESSION_HPP
00002 #define PROTON_SESSION_HPP
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 
00025 #include "./fwd.hpp"
00026 #include "./internal/export.hpp"
00027 #include "./endpoint.hpp"
00028 #include "./receiver.hpp"
00029 #include "./sender.hpp"
00030 
00031 #include <string>
00032 
00035 
00036 struct pn_session_t;
00037 
00038 namespace proton {
00039 
00041 class
00042 PN_CPP_CLASS_EXTERN session : public internal::object<pn_session_t>, public endpoint {
00043   public:
00045     PN_CPP_EXTERN session(pn_session_t* s) : internal::object<pn_session_t>(s) {}
00047 
00048   public:
00050     session() : internal::object<pn_session_t>(0) {}
00051 
00052     PN_CPP_EXTERN ~session();
00053 
00054     PN_CPP_EXTERN bool uninitialized() const;
00055     PN_CPP_EXTERN bool active() const;
00056     PN_CPP_EXTERN bool closed() const;
00057 
00058     PN_CPP_EXTERN class error_condition error() const;
00059 
00063     PN_CPP_EXTERN void open();
00064 
00066     PN_CPP_EXTERN void open(const session_options &opts);
00067 
00068     PN_CPP_EXTERN void close();
00069     PN_CPP_EXTERN void close(const error_condition&);
00070 
00072     PN_CPP_EXTERN class container &container() const;
00073 
00075     PN_CPP_EXTERN class work_queue& work_queue() const;
00076 
00078     PN_CPP_EXTERN class connection connection() const;
00079 
00081     PN_CPP_EXTERN sender open_sender(const std::string &addr);
00082 
00084     PN_CPP_EXTERN sender open_sender(const std::string &addr, const sender_options &opts);
00085 
00087     PN_CPP_EXTERN receiver open_receiver(const std::string &addr);
00088 
00090     PN_CPP_EXTERN receiver open_receiver(const std::string &addr, const receiver_options &opts);
00091 
00093     PN_CPP_EXTERN size_t incoming_bytes() const;
00094 
00096     PN_CPP_EXTERN size_t outgoing_bytes() const;
00097 
00099     PN_CPP_EXTERN sender_range senders() const;
00100 
00102     PN_CPP_EXTERN receiver_range receivers() const;
00103 
00105   friend class internal::factory<session>;
00106   friend class session_iterator;
00108 };
00109 
00111     
00113 class session_iterator : public internal::iter_base<session, session_iterator> {
00114  public:
00115     explicit session_iterator(session s = 0) : internal::iter_base<session, session_iterator>(s) {}
00116 
00118     PN_CPP_EXTERN session_iterator operator++();
00119 };
00120 
00122 typedef internal::iter_range<session_iterator> session_range;
00123 
00125     
00126 } // proton
00127 
00128 #endif // PROTON_SESSION_HPP

Generated on 17 Jan 2019 for Qpid Proton C++ by  doxygen 1.6.1