Hazelcast C++ Client
RawPointerTransactionalQueue.h
1 /*
2  * Copyright (c) 2008-2017, 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 ihsan demir on 24/3/16.
18 
19 #ifndef HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERTRANSACTIONALQUEUE_H_
20 #define HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERTRANSACTIONALQUEUE_H_
21 
22 #include "hazelcast/client/TransactionalQueue.h"
23 
24 namespace hazelcast {
25  namespace client {
26  namespace adaptor {
33  template<typename T>
35  public:
36  RawPointerTransactionalQueue(TransactionalQueue<T> &q) : queue(q), serializationService(
37  q.context->getSerializationService()) {
38  }
39 
45  bool offer(const T &e) {
46  return queue.offer(e);
47  }
48 
54  bool offer(const T &e, long timeoutInMillis) {
55  return queue.offer(e, timeoutInMillis);
56  }
57 
63  std::auto_ptr<T> poll() {
64  return poll(0);
65  }
66 
72  std::auto_ptr<T> poll(long timeoutInMillis) {
73  return serializationService.toObject<T>(queue.pollData(timeoutInMillis).get());
74  }
75 
81  int size() {
82  return queue.size();
83  }
84 
85  private:
86  TransactionalQueue<T> &queue;
87  serialization::pimpl::SerializationService &serializationService;
88  };
89  }
90  }
91 }
92 
93 #endif //HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERTRANSACTIONALQUEUE_H_
94 
bool offer(const T &e)
Transactional implementation of IQueue::offer(const T &e)
Definition: RawPointerTransactionalQueue.h:45
bool offer(const E &e)
Transactional implementation of IQueue::offer(const E &e)
Definition: TransactionalQueue.h:48
bool offer(const T &e, long timeoutInMillis)
Transactional implementation of IQueue::offer(const T &e, long timeoutInMillis)
Definition: RawPointerTransactionalQueue.h:54
int size()
Transactional implementation of IQueue::size()
Definition: RawPointerTransactionalQueue.h:81
Transactional implementation of IQueue.
Definition: RawPointerTransactionalQueue.h:34
int size()
Transactional implementation of IQueue::size()
Definition: TransactionalQueue.h:84
Definition: MapEntryView.h:32
std::auto_ptr< T > poll(long timeoutInMillis)
Transactional implementation of IQueue::poll(long timeoutInMillis)
Definition: RawPointerTransactionalQueue.h:72
std::auto_ptr< T > poll()
Transactional implementation of IQueue::poll()
Definition: RawPointerTransactionalQueue.h:63