Qpid Proton C++  0.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
delivery.hpp
1 #ifndef PROTON_CPP_DELIVERY_H
2 #define PROTON_CPP_DELIVERY_H
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 "proton/export.hpp"
26 #include "proton/object.hpp"
27 
28 #include "proton/delivery.h"
29 #include "proton/disposition.h"
30 
31 namespace proton {
32 
36 class delivery : public object<pn_delivery_t> {
37  public:
39  delivery(pn_delivery_t* d=0) : object<pn_delivery_t>(d) {}
41 
43  enum state {
44  NONE = 0,
45  RECEIVED = PN_RECEIVED,
46  ACCEPTED = PN_ACCEPTED,
47  REJECTED = PN_REJECTED,
48  RELEASED = PN_RELEASED,
49  MODIFIED = PN_MODIFIED
50  }; // AMQP spec 3.4 delivery State
51 
54 
56  PN_CPP_EXTERN bool settled() const;
57 
59  PN_CPP_EXTERN void settle();
60 
62  PN_CPP_EXTERN void update(delivery::state state);
63 
65  PN_CPP_EXTERN void settle(delivery::state s);
66 
68 
70  PN_CPP_EXTERN void accept() { settle(ACCEPTED); }
71 
73  PN_CPP_EXTERN void reject() { settle(REJECTED); }
74 
76  PN_CPP_EXTERN void release() { settle(RELEASED); }
77 
79  PN_CPP_EXTERN void modify() { settle(MODIFIED); }
80 
83 
88  PN_CPP_EXTERN bool partial() const;
89 
94  PN_CPP_EXTERN bool writable() const;
95 
100  PN_CPP_EXTERN bool readable() const;
101 
108  PN_CPP_EXTERN bool updated() const;
109 
111  PN_CPP_EXTERN void clear();
112 
114  PN_CPP_EXTERN size_t pending() const;
115 
117 
119  PN_CPP_EXTERN state remote_state() const;
120 };
121 
122 }
123 
124 #endif // PROTON_CPP_DELIVERY_H
Received but not yet settled.
Definition: delivery.hpp:45
A message transfer.
Definition: delivery.hpp:36
Settled as released.
Definition: delivery.hpp:48
Settled as modified.
Definition: delivery.hpp:49
void reject()
Settle with REJECTED state.
Definition: delivery.hpp:73
state remote_state() const
Get the remote state for a delivery.
state
Delivery state values.
Definition: delivery.hpp:43
void release()
Settle with RELEASED state.
Definition: delivery.hpp:76
Settled as rejected.
Definition: delivery.hpp:47
void accept()
Settle with ACCEPTED state.
Definition: delivery.hpp:70
void modify()
Settle with MODIFIED state.
Definition: delivery.hpp:79
Settled as accepted.
Definition: delivery.hpp:46
Unknown state.
Definition: delivery.hpp:44