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 bool uninitialized() const;
00053 PN_CPP_EXTERN bool active() const;
00054 PN_CPP_EXTERN bool closed() const;
00055
00056 PN_CPP_EXTERN class error_condition error() const;
00057
00061 PN_CPP_EXTERN void open();
00062
00064 PN_CPP_EXTERN void open(const session_options &opts);
00065
00066 PN_CPP_EXTERN void close();
00067 PN_CPP_EXTERN void close(const error_condition&);
00068
00070 PN_CPP_EXTERN class container &container() const;
00071
00073 PN_CPP_EXTERN class work_queue& work_queue() const;
00074
00076 PN_CPP_EXTERN class connection connection() const;
00077
00079 PN_CPP_EXTERN sender open_sender(const std::string &addr);
00080
00082 PN_CPP_EXTERN sender open_sender(const std::string &addr, const sender_options &opts);
00083
00085 PN_CPP_EXTERN receiver open_receiver(const std::string &addr);
00086
00088 PN_CPP_EXTERN receiver open_receiver(const std::string &addr, const receiver_options &opts);
00089
00091 PN_CPP_EXTERN size_t incoming_bytes() const;
00092
00094 PN_CPP_EXTERN size_t outgoing_bytes() const;
00095
00097 PN_CPP_EXTERN sender_range senders() const;
00098
00100 PN_CPP_EXTERN receiver_range receivers() const;
00101
00103 friend class internal::factory<session>;
00104 friend class session_iterator;
00106 };
00107
00109
00111 class session_iterator : public internal::iter_base<session, session_iterator> {
00112 public:
00113 explicit session_iterator(session s = 0) : internal::iter_base<session, session_iterator>(s) {}
00114
00116 PN_CPP_EXTERN session_iterator operator++();
00117 };
00118
00120 typedef internal::iter_range<session_iterator> session_range;
00121
00123
00124 }
00125
00126 #endif // PROTON_SESSION_HPP