Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
TransactionalQueue.h
1 /*
2  * Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 //
17 // Created by sancar koyunlu on 8/5/13.
18 
19 
20 
21 
22 
23 #ifndef HAZELCAST_TransactionalQueue
24 #define HAZELCAST_TransactionalQueue
25 
26 #include "hazelcast/client/proxy/TransactionalQueueImpl.h"
27 
28 namespace hazelcast {
29  namespace client {
36  template<typename E>
37  class TransactionalQueue : public proxy::TransactionalQueueImpl {
38  friend class TransactionContext;
39 
40  public:
46  bool offer(const E& e) {
47  return offer(e, 0);
48  }
49 
55  bool offer(const E& e, long timeoutInMillis) {
56  return proxy::TransactionalQueueImpl::offer(toData(&e), timeoutInMillis);
57  }
58 
64  boost::shared_ptr<E> poll() {
65  return poll(0);
66  }
67 
73  boost::shared_ptr<E> poll(long timeoutInMillis) {
74  return toObject<E>(proxy::TransactionalQueueImpl::poll(timeoutInMillis));
75  }
76 
82  int size() {
83  return proxy::TransactionalQueueImpl::size();
84  }
85 
86  private:
87  TransactionalQueue(const std::string& name, txn::TransactionProxy *transactionProxy)
88  : proxy::TransactionalQueueImpl(name, transactionProxy) {
89 
90  }
91  };
92  }
93 }
94 
95 #endif //HAZELCAST_TransactionalQueue
96 
bool offer(const E &e)
Transactional implementation of IQueue::offer(const E &e)
Definition: TransactionalQueue.h:46
boost::shared_ptr< E > poll()
Transactional implementation of IQueue::poll()
Definition: TransactionalQueue.h:64
int size()
Transactional implementation of IQueue::size()
Definition: TransactionalQueue.h:82
boost::shared_ptr< E > poll(long timeoutInMillis)
Transactional implementation of IQueue::poll(long timeoutInMillis)
Definition: TransactionalQueue.h:73
Transactional implementation of IQueue.
Definition: TransactionalQueue.h:37
bool offer(const E &e, long timeoutInMillis)
Transactional implementation of IQueue::offer(const E &e, long timeoutInMillis)
Definition: TransactionalQueue.h:55
Provides a context to do transactional operations; so beginning/committing transactions, but also retrieving transactional data-structures like the TransactionalMap.
Definition: TransactionContext.h:57