Qpid Proton C++ 0.33.0
endpoint.hpp
Go to the documentation of this file.
1#ifndef PROTON_ENDPOINT_HPP
2#define PROTON_ENDPOINT_HPP
3
4/*
5 *
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements. See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership. The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied. See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 *
23 */
24
25#include "./fwd.hpp"
26#include "./error_condition.hpp"
27#include "./internal/config.hpp"
28#include "./internal/export.hpp"
29
32
33namespace proton {
34
36class
37PN_CPP_CLASS_EXTERN endpoint {
38 public:
39 PN_CPP_EXTERN virtual ~endpoint();
40
41 // XXX Add the container accessor here.
42
44 virtual bool uninitialized() const = 0;
45
47 virtual bool active() const = 0;
48
50 virtual bool closed() const = 0;
51
53 virtual class error_condition error() const = 0;
54
55 // XXX Add virtual open() and open(endpoint_options)
56
58 virtual void close() = 0;
59
61 virtual void close(const error_condition&) = 0;
62
63#if PN_CPP_HAS_DEFAULTED_FUNCTIONS && PN_CPP_HAS_DEFAULTED_MOVE_INITIALIZERS
64 // Make everything explicit for C++11 compilers
65
67 endpoint() = default;
68 endpoint& operator=(const endpoint&) = default;
69 endpoint(const endpoint&) = default;
70 endpoint& operator=(endpoint&&) = default;
71 endpoint(endpoint&&) = default;
73#endif
74};
75
76namespace internal {
77
78template <class T, class D> class iter_base {
79 public:
80 typedef T value_type;
81
82 T operator*() const { return obj_; }
83 T* operator->() const { return const_cast<T*>(&obj_); }
84 D operator++(int) { D x(*this); ++(*this); return x; }
85 bool operator==(const iter_base<T, D>& x) const { return obj_ == x.obj_; }
86 bool operator!=(const iter_base<T, D>& x) const { return obj_ != x.obj_; }
87
88 protected:
89 explicit iter_base(T p = 0) : obj_(p) {}
90 T obj_;
91};
92
93template<class I> class iter_range {
94 public:
95 typedef I iterator;
96
97 explicit iter_range(I begin = I(), I end = I()) : begin_(begin), end_(end) {}
98 I begin() const { return begin_; }
99 I end() const { return end_; }
100 bool empty() const { return begin_ == end_; }
101
102 private:
103 I begin_, end_;
104};
105
106} // internal
107} // proton
108
109#endif // PROTON_ENDPOINT_HPP
The base class for session, connection, and link.
Definition: endpoint.hpp:37
virtual bool closed() const =0
True if the local and remote ends are closed.
virtual bool active() const =0
True if the local end is active.
virtual void close(const error_condition &)=0
Close the endpoint with an error condition.
virtual bool uninitialized() const =0
True if the local end is uninitialized.
virtual void close()=0
Close the endpoint.
Describes an endpoint error state.
Definition: error_condition.hpp:40
Describes an endpoint error state.
Forward declarations.
The main Proton namespace.
Definition: annotation_key.hpp:33
The base Proton error.
Definition: error.hpp:41