Qpid Proton C++ API 0.41.1
Loading...
Searching...
No Matches
transfer.hpp
Go to the documentation of this file.
1#ifndef PROTON_TRANSFER_HPP
2#define PROTON_TRANSFER_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 "./binary.hpp"
26#include "./fwd.hpp"
27#include "./internal/export.hpp"
28#include "./internal/object.hpp"
29
30#include <proton/disposition.h>
31#include <iosfwd>
32
35
36struct pn_delivery_t;
37
38namespace proton {
39
41class transfer : public internal::object<pn_delivery_t> {
43 transfer(pn_delivery_t* d) : internal::object<pn_delivery_t>(d) {}
45
46 public:
48 transfer() : internal::object<pn_delivery_t>(0) {}
49
51 enum state {
52 NONE = 0,
53 RECEIVED = PN_RECEIVED,
54 ACCEPTED = PN_ACCEPTED,
55 REJECTED = PN_REJECTED,
56 RELEASED = PN_RELEASED,
57 MODIFIED = PN_MODIFIED
58 }; // AMQP spec 3.4 delivery State
59
61 PN_CPP_EXTERN enum state state() const;
62
64 PN_CPP_EXTERN class session session() const;
65
67 PN_CPP_EXTERN class connection connection() const;
68
70 PN_CPP_EXTERN class work_queue& work_queue() const;
71
73 PN_CPP_EXTERN class container &container() const;
74
76 PN_CPP_EXTERN void settle();
77
79 PN_CPP_EXTERN bool settled() const;
80
82 PN_CPP_EXTERN binary tag() const;
83
85 PN_CPP_EXTERN void user_data(void* user_data) const;
86
88 PN_CPP_EXTERN void* user_data() const;
89
91 friend class internal::factory<transfer>;
93};
94
96PN_CPP_EXTERN std::string to_string(enum transfer::state);
98PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const enum transfer::state);
99
100} // proton
101
103template <> struct std::hash<proton::transfer> {
104 std::size_t operator()(const proton::transfer& k) const {
105 return std::hash<proton::binary>{}(k.tag());
106 }
107};
108
109#endif // PROTON_TRANSFER_HPP
Arbitrary binary data.
Arbitrary binary data.
Definition binary.hpp:40
The base class for delivery and tracker.
Definition transfer.hpp:41
void settle()
Settle the delivery; informs the remote end.
void * user_data() const
Get user data from this transfer.
transfer()
Create an empty transfer.
Definition transfer.hpp:48
enum state state() const
Get the remote state for a delivery.
class work_queue & work_queue() const
Get the work_queue for the transfer.
void user_data(void *user_data) const
Set user data on this transfer.
class session session() const
Return the session for this transfer.
class container & container() const
Return the container for this transfer.
binary tag() const
Return the tag for this transfer.
bool settled() const
Return true if the transfer has been settled.
state
Delivery state values.
Definition transfer.hpp:51
@ RECEIVED
Received but not yet settled.
Definition transfer.hpp:53
@ MODIFIED
Settled as modified.
Definition transfer.hpp:57
@ ACCEPTED
Settled as accepted.
Definition transfer.hpp:54
@ RELEASED
Settled as released.
Definition transfer.hpp:56
@ NONE
Unknown state.
Definition transfer.hpp:52
@ REJECTED
Settled as rejected.
Definition transfer.hpp:55
class connection connection() const
Return the connection for this transfer.
Forward declarations.
The main Proton namespace.
Definition annotation_key.hpp:33
std::string to_string(const message &)
Human readable string representation.
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.