Qpid Proton C++ API  0.38.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() = default;
49 
50  PN_CPP_EXTERN ~receiver();
51 
53  PN_CPP_EXTERN void open();
54 
56  PN_CPP_EXTERN void open(const receiver_options &opts);
57 
59  PN_CPP_EXTERN class source source() const;
60 
62  PN_CPP_EXTERN class target target() const;
63 
67  PN_CPP_EXTERN void add_credit(uint32_t);
68 
77  PN_CPP_EXTERN void drain();
78 
80  friend class internal::factory<receiver>;
81  friend class receiver_iterator;
83 };
84 
86 
88 class receiver_iterator : public internal::iter_base<receiver, receiver_iterator> {
89  explicit receiver_iterator(receiver r, pn_session_t* s = 0) :
90  internal::iter_base<receiver, receiver_iterator>(r), session_(s) {}
91 
92  public:
94  explicit receiver_iterator() :
95  internal::iter_base<receiver, receiver_iterator>(0), session_(0) {}
96 
98  PN_CPP_EXTERN receiver_iterator operator++();
99 
100  private:
101  pn_session_t* session_;
102 
103  friend class connection;
104  friend class session;
105 };
106 
108 typedef internal::iter_range<receiver_iterator> receiver_range;
109 
111 
112 } // proton
113 
114 #endif // PROTON_RECEIVER_HPP
Options for creating a receiver.
Definition: receiver_options.hpp:59
A channel for receiving messages.
Definition: receiver.hpp:41
void add_credit(uint32_t)
Increment the credit available to the sender.
void open(const receiver_options &opts)
Open the receiver.
void open()
Open the receiver.
receiver()=default
Create an empty receiver.
void drain()
Unsettled API - Commence a drain cycle.
A point of origin for messages.
Definition: source.hpp:44
A destination for messages.
Definition: target.hpp:45
Forward declarations.
The main Proton namespace.
Definition: annotation_key.hpp:33