00001 #ifndef PROTON_SESSION_HPP
00002 #define PROTON_SESSION_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 }
00127
00128 #endif // PROTON_SESSION_HPP