00001 #ifndef PROTON_ENDPOINT_HPP
00002 #define PROTON_ENDPOINT_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 "./error_condition.hpp"
00027 #include "./internal/config.hpp"
00028 #include "./internal/export.hpp"
00029
00032
00033 namespace proton {
00034
00036 class
00037 PN_CPP_CLASS_EXTERN endpoint {
00038 public:
00039 PN_CPP_EXTERN virtual ~endpoint();
00040
00041
00042
00044 virtual bool uninitialized() const = 0;
00045
00047 virtual bool active() const = 0;
00048
00050 virtual bool closed() const = 0;
00051
00053 virtual class error_condition error() const = 0;
00054
00055
00056
00058 virtual void close() = 0;
00059
00061 virtual void close(const error_condition&) = 0;
00062
00063 #if PN_CPP_HAS_DEFAULTED_FUNCTIONS && PN_CPP_HAS_DEFAULTED_MOVE_INITIALIZERS
00064
00065
00067 endpoint() = default;
00068 endpoint& operator=(const endpoint&) = default;
00069 endpoint(const endpoint&) = default;
00070 endpoint& operator=(endpoint&&) = default;
00071 endpoint(endpoint&&) = default;
00073 #endif
00074 };
00075
00076 namespace internal {
00077
00078 template <class T, class D> class iter_base {
00079 public:
00080 typedef T value_type;
00081
00082 T operator*() const { return obj_; }
00083 T* operator->() const { return const_cast<T*>(&obj_); }
00084 D operator++(int) { D x(*this); ++(*this); return x; }
00085 bool operator==(const iter_base<T, D>& x) const { return obj_ == x.obj_; }
00086 bool operator!=(const iter_base<T, D>& x) const { return obj_ != x.obj_; }
00087
00088 protected:
00089 explicit iter_base(T p = 0) : obj_(p) {}
00090 T obj_;
00091 };
00092
00093 template<class I> class iter_range {
00094 public:
00095 typedef I iterator;
00096
00097 explicit iter_range(I begin = I(), I end = I()) : begin_(begin), end_(end) {}
00098 I begin() const { return begin_; }
00099 I end() const { return end_; }
00100 bool empty() const { return begin_ == end_; }
00101
00102 private:
00103 I begin_, end_;
00104 };
00105
00106 }
00107 }
00108
00109 #endif // PROTON_ENDPOINT_HPP