proton/endpoint.hpp

Go to the documentation of this file.
00001 #ifndef PROTON_ENDPOINT_HPP
00002 #define PROTON_ENDPOINT_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 "./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     // XXX Add the container accessor here.
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     // XXX Add virtual open() and open(endpoint_options)
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     // Make everything explicit for C++11 compilers
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 } // internal
00107 } // proton
00108 
00109 #endif // PROTON_ENDPOINT_HPP

Generated on 14 May 2019 for Qpid Proton C++ by  doxygen 1.6.1