| 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 "./fwd.hpp" |
| 26 |
#include "./internal/export.hpp" |
| 27 |
#include "./internal/object.hpp" |
| 28 |
|
| 29 |
#include <proton/disposition.h> |
| 30 |
#include <iosfwd> |
| 31 |
|
| 32 |
/// @file |
| 33 |
/// @copybrief proton::transfer |
| 34 |
|
| 35 |
struct pn_delivery_t; |
| 36 |
|
| 37 |
namespace proton { |
| 38 |
|
| 39 |
/// The base class for delivery and tracker. |
| 40 |
class transfer : public internal::object<pn_delivery_t> { |
| 41 |
/// @cond INTERNAL |
| 42 |
transfer(pn_delivery_t* d) : internal::object<pn_delivery_t>(d) {} |
| 43 |
/// @endcond |
| 44 |
|
| 45 |
public: |
| 46 |
/// Create an empty transfer. |
| 47 |
transfer() : internal::object<pn_delivery_t>(0) {} |
| 48 |
|
| 49 |
/// Delivery state values. |
| 50 |
enum state { |
| 51 |
NONE = 0, ///< Unknown state |
| 52 |
RECEIVED = PN_RECEIVED, ///< Received but not yet settled |
| 53 |
ACCEPTED = PN_ACCEPTED, ///< Settled as accepted |
| 54 |
REJECTED = PN_REJECTED, ///< Settled as rejected |
| 55 |
RELEASED = PN_RELEASED, ///< Settled as released |
| 56 |
MODIFIED = PN_MODIFIED ///< Settled as modified |
| 57 |
}; // AMQP spec 3.4 delivery State |
| 58 |
|
| 59 |
/// Get the remote state for a delivery. |
| 60 |
PN_CPP_EXTERN enum state state() const; |
| 61 |
|
| 62 |
/// Return the session for this transfer. |
| 63 |
PN_CPP_EXTERN class session session() const; |
| 64 |
|
| 65 |
/// Return the connection for this transfer. |
| 66 |
PN_CPP_EXTERN class connection connection() const; |
| 67 |
|
| 68 |
/// Get the work_queue for the transfer. |
| 69 |
PN_CPP_EXTERN class work_queue& work_queue() const; |
| 70 |
|
| 71 |
/// Return the container for this transfer. |
| 72 |
PN_CPP_EXTERN class container &container() const; |
| 73 |
|
| 74 |
/// Settle the delivery; informs the remote end. |
| 75 |
PN_CPP_EXTERN void settle(); |
| 76 |
|
| 77 |
/// Return true if the transfer has been settled. |
| 78 |
PN_CPP_EXTERN bool settled() const; |
| 79 |
|
| 80 |
/// @cond INTERNAL |
| 81 |
friend class internal::factory<transfer>; |
| 82 |
/// @endcond |
| 83 |
}; |
| 84 |
|
| 85 |
/// Human-readalbe name of the transfer::state |
| 86 |
PN_CPP_EXTERN std::string to_string(enum transfer::state); |
| 87 |
/// Human-readalbe name of the transfer::state |
| 88 |
PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const enum transfer::state); |
| 89 |
|
| 90 |
} // proton |
| 91 |
|
| 92 |
#endif // PROTON_TRANSFER_HPP |