Qpid Proton C++  0.26.0
receiver.hpp
Go to the documentation of this file.
1 #ifndef PROTON_RECEIVER_HPP
2 #define PROTON_RECEIVER_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 "./internal/export.hpp"
27 #include "./link.hpp"
28 
29 #include <proton/type_compat.h>
30 
31 struct pn_link_t;
32 struct pn_session_t;
33 
36 
37 namespace proton {
38 
40 class
41 PN_CPP_CLASS_EXTERN receiver : public link {
43  PN_CPP_EXTERN receiver(pn_link_t* r);
45 
46  public:
48  receiver() {}
49 
50  PN_CPP_EXTERN ~receiver();
51 
55  PN_CPP_EXTERN void open();
56 
58  PN_CPP_EXTERN void open(const receiver_options &opts);
59 
61  PN_CPP_EXTERN class source source() const;
62 
64  PN_CPP_EXTERN class target target() const;
65 
69  PN_CPP_EXTERN void add_credit(uint32_t);
70 
79  PN_CPP_EXTERN void drain();
80 
82  friend class internal::factory<receiver>;
83  friend class receiver_iterator;
85 };
86 
88 
90 class receiver_iterator : public internal::iter_base<receiver, receiver_iterator> {
91  explicit receiver_iterator(receiver r, pn_session_t* s = 0) :
92  internal::iter_base<receiver, receiver_iterator>(r), session_(s) {}
93 
94  public:
96  explicit receiver_iterator() :
97  internal::iter_base<receiver, receiver_iterator>(0), session_(0) {}
98 
100  PN_CPP_EXTERN receiver_iterator operator++();
101 
102  private:
103  pn_session_t* session_;
104 
105  friend class connection;
106  friend class session;
107 };
108 
110 typedef internal::iter_range<receiver_iterator> receiver_range;
111 
113 
114 } // proton
115 
116 #endif // PROTON_RECEIVER_HPP
Forward declarations.
A point of origin for messages.
Definition: source.hpp:44
Options for creating a receiver.
Definition: receiver_options.hpp:56
A channel for receiving messages.
Definition: receiver.hpp:40
A destination for messages.
Definition: target.hpp:45
The main Proton namespace.
Definition: annotation_key.hpp:33
receiver()
Create an empty receiver.
Definition: receiver.hpp:48