Qpid Proton C++ API 0.39.0
 
Loading...
Searching...
No Matches
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/export.hpp"
28
31
32namespace proton {
33
35class
36PN_CPP_CLASS_EXTERN endpoint {
37 public:
38 PN_CPP_EXTERN virtual ~endpoint();
39
40 // XXX Add the container accessor here.
41
43 virtual bool uninitialized() const = 0;
44
46 virtual bool active() const = 0;
47
49 virtual bool closed() const = 0;
50
52 virtual class error_condition error() const = 0;
53
54 // XXX Add virtual open() and open(endpoint_options)
55
57 virtual void close() = 0;
58
60 virtual void close(const error_condition&) = 0;
61
63 endpoint() = default;
64 endpoint& operator=(const endpoint&) = default;
65 endpoint(const endpoint&) = default;
66 endpoint& operator=(endpoint&&) = default;
67 endpoint(endpoint&&) = default;
69};
70
71namespace internal {
72
73template <class T, class D> class iter_base {
74 public:
75 typedef T value_type;
76
77 T operator*() const { return obj_; }
78 T* operator->() const { return const_cast<T*>(&obj_); }
79 D operator++(int) { D x(*this); ++(*this); return x; }
80 bool operator==(const iter_base<T, D>& x) const { return obj_ == x.obj_; }
81 bool operator!=(const iter_base<T, D>& x) const { return obj_ != x.obj_; }
82
83 protected:
84 explicit iter_base(T p = 0) : obj_(p) {}
85 T obj_;
86};
87
88template<class I> class iter_range {
89 public:
90 typedef I iterator;
91
92 explicit iter_range(I begin = I(), I end = I()) : begin_(begin), end_(end) {}
93 I begin() const { return begin_; }
94 I end() const { return end_; }
95 bool empty() const { return begin_ == end_; }
96
97 private:
98 I begin_, end_;
99};
100
101} // internal
102} // proton
103
104#endif // PROTON_ENDPOINT_HPP
The base class for session, connection, and link.
Definition: endpoint.hpp:36
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:39
Describes an endpoint error state.
Forward declarations.
The main Proton namespace.
Definition: annotation_key.hpp:33
The base Proton error.
Definition: error.hpp:40