Qpid C++ Messaging API  0.24
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Session.h
Go to the documentation of this file.
1 #ifndef QPID_MESSAGING_SESSION_H
2 #define QPID_MESSAGING_SESSION_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  */
25 
28 #include "qpid/messaging/Handle.h"
29 
30 #include <string>
31 
32 namespace qpid {
33 namespace messaging {
34 
35 #ifndef SWIG
36 template <class> class PrivateImplRef;
37 #endif
38 class Address;
39 class Connection;
40 class Message;
41 class Sender;
42 class Receiver;
43 class SessionImpl;
44 
50 {
51  public:
52  QPID_MESSAGING_EXTERN Session(SessionImpl* impl = 0);
53  QPID_MESSAGING_EXTERN Session(const Session&);
54  QPID_MESSAGING_EXTERN ~Session();
55  QPID_MESSAGING_EXTERN Session& operator=(const Session&);
56 
63  QPID_MESSAGING_EXTERN void close();
64 
71  QPID_MESSAGING_EXTERN void commit();
72  QPID_MESSAGING_EXTERN void rollback();
73 
81  QPID_MESSAGING_EXTERN void acknowledge(bool sync=false);
85  QPID_MESSAGING_EXTERN void acknowledge(Message&, bool sync=false);
89  QPID_MESSAGING_EXTERN void acknowledgeUpTo(Message&, bool sync=false);
95  QPID_MESSAGING_EXTERN void reject(Message&);
101  QPID_MESSAGING_EXTERN void release(Message&);
102 
111  QPID_MESSAGING_EXTERN void sync(bool block=true);
112 
119  QPID_MESSAGING_EXTERN uint32_t getReceivable();
125  QPID_MESSAGING_EXTERN uint32_t getUnsettledAcks();
134  QPID_MESSAGING_EXTERN bool nextReceiver(Receiver&, Duration timeout=Duration::FOREVER);
144 
152  QPID_MESSAGING_EXTERN Sender createSender(const Address& address);
163  QPID_MESSAGING_EXTERN Sender createSender(const std::string& address);
164 
172  QPID_MESSAGING_EXTERN Receiver createReceiver(const Address& address);
183  QPID_MESSAGING_EXTERN Receiver createReceiver(const std::string& address);
184 
189  QPID_MESSAGING_EXTERN Sender getSender(const std::string& name) const;
194  QPID_MESSAGING_EXTERN Receiver getReceiver(const std::string& name) const;
199  QPID_MESSAGING_EXTERN Connection getConnection() const;
200 
205  QPID_MESSAGING_EXTERN bool hasError();
211  QPID_MESSAGING_EXTERN void checkError();
212 
213 #ifndef SWIG
214  private:
215  friend class qpid::messaging::PrivateImplRef<Session>;
216 #endif
217 };
218 }} // namespace qpid::messaging
219 
220 #endif