Qpid Proton C++  0.17.0
sender.hpp
1 #ifndef PROTON_SENDER_HPP
2 #define PROTON_SENDER_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 struct pn_link_t;
30 struct pn_session_t;
31 
32 namespace proton {
33 
35 class
36 PN_CPP_CLASS_EXTERN sender : public link {
38  PN_CPP_EXTERN sender(pn_link_t* s);
40 
41  public:
43  sender() {}
44 
48  PN_CPP_EXTERN void open();
49 
51  PN_CPP_EXTERN void open(const sender_options &opts);
52 
54  PN_CPP_EXTERN tracker send(const message &m);
55 
57  PN_CPP_EXTERN class source source() const;
58 
60  PN_CPP_EXTERN class target target() const;
61 
68  PN_CPP_EXTERN void return_credit();
69 
71  friend class internal::factory<sender>;
72  friend class sender_iterator;
73  friend class thread_safe<sender>;
75 };
76 
78 
80 class sender_iterator : public internal::iter_base<sender, sender_iterator> {
81  sender_iterator(sender snd, pn_session_t* s = 0) :
82  internal::iter_base<sender, sender_iterator>(snd), session_(s) {}
83 
84  public:
86  sender_iterator() :
87  internal::iter_base<sender, sender_iterator>(0), session_(0) {}
89  PN_CPP_EXTERN sender_iterator operator++();
90 
91  private:
92  pn_session_t* session_;
93 
94  friend class connection;
95  friend class session;
96 };
97 
99 typedef internal::iter_range<sender_iterator> sender_range;
100 
102 
103 }
104 
105 #endif // PROTON_SENDER_HPP
An AMQP message.
Definition: message.hpp:47
A channel for sending messages.
Definition: sender.hpp:35
sender()
Create an empty sender.
Definition: sender.hpp:43
Options for creating a sender.
Definition: sender_options.hpp:54
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
A tracker for a sent message.
Definition: tracker.hpp:37
A destination for messages.
Definition: target.hpp:42
The main Proton namespace.
Definition: annotation_key.hpp:30
Experimental - A thread-safe object wrapper.
Definition: fwd.hpp:65