Qpid Proton C++  0.17.0
receiver.hpp
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 
34 namespace proton {
35 
37 class
38 PN_CPP_CLASS_EXTERN receiver : public link {
40  PN_CPP_EXTERN receiver(pn_link_t* r);
42 
43  public:
45  receiver() {}
46 
50  PN_CPP_EXTERN void open();
51 
53  PN_CPP_EXTERN void open(const receiver_options &opts);
54 
56  PN_CPP_EXTERN class source source() const;
57 
59  PN_CPP_EXTERN class target target() const;
60 
64  PN_CPP_EXTERN void add_credit(uint32_t);
65 
74  PN_CPP_EXTERN void drain();
75 
77  friend class internal::factory<receiver>;
78  friend class receiver_iterator;
79  friend class thread_safe<receiver>;
81 };
82 
84 
86 class receiver_iterator : public internal::iter_base<receiver, receiver_iterator> {
87  explicit receiver_iterator(receiver r, pn_session_t* s = 0) :
88  internal::iter_base<receiver, receiver_iterator>(r), session_(s) {}
89 
90  public:
92  explicit receiver_iterator() :
93  internal::iter_base<receiver, receiver_iterator>(0), session_(0) {}
94 
96  PN_CPP_EXTERN receiver_iterator operator++();
97 
98  private:
99  pn_session_t* session_;
100 
101  friend class connection;
102  friend class session;
103 };
104 
106 typedef internal::iter_range<receiver_iterator> receiver_range;
107 
109 
110 } // proton
111 
112 #endif // PROTON_RECEIVER_HPP
A connection to a remote AMQP peer.
Definition: connection.hpp:40
A point of origin for messages.
Definition: source.hpp:41
A container of senders and receivers.
Definition: session.hpp:38
Options for creating a receiver.
Definition: receiver_options.hpp:52
A channel for receiving messages.
Definition: receiver.hpp:37
A destination for messages.
Definition: target.hpp:42
The main Proton namespace.
Definition: annotation_key.hpp:30
receiver()
Create an empty receiver.
Definition: receiver.hpp:45
Experimental - A thread-safe object wrapper.
Definition: fwd.hpp:65