Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
RawPointerSet.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 #ifndef HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERSET_H_
17 #define HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERSET_H_
18 
19 #include "hazelcast/client/ISet.h"
20 #include "hazelcast/client/impl/DataArrayImpl.h"
21 
22 namespace hazelcast {
23  namespace client {
24  namespace adaptor {
30  template<typename T>
31  class RawPointerSet {
32  public:
33  RawPointerSet(ISet<T> &s) : set(s), serializationService(s.context->getSerializationService()) {
34  }
35 
46  std::string addItemListener(ItemListener<T> &listener, bool includeValue) {
47  return set.addItemListener(listener, includeValue);
48  }
49 
58  bool removeItemListener(const std::string &registrationId) {
59  return set.removeItemListener(registrationId);
60  }
61 
66  int size() {
67  return set.size();
68  }
69 
74  bool isEmpty() {
75  return set.isEmpty();
76  }
77 
84  bool contains(const T &element) {
85  return set.contains(element);
86  }
87 
92  std::auto_ptr<DataArray<T> > toArray() {
93  return std::auto_ptr<DataArray<T> >(new impl::DataArrayImpl<T>(set.toArrayData(), serializationService));
94  }
95 
102  bool add(const T &element) {
103  return set.add(element);
104  }
105 
112  bool remove(const T &element) {
113  return set.remove(element);
114  }
115 
122  bool containsAll(const std::vector<T> &elements) {
123  return set.containsAll(elements);
124  }
125 
132  bool addAll(const std::vector<T> &elements) {
133  return set.addAll(elements);
134  }
135 
142  bool removeAll(const std::vector<T> &elements) {
143  return set.removeAll(elements);
144  }
145 
153  bool retainAll(const std::vector<T> &elements) {
154  return set.retainAll(elements);
155  }
156 
161  void clear() {
162  set.clear();
163  }
164 
165  private:
166  ISet<T> &set;
167  serialization::pimpl::SerializationService &serializationService;
168  };
169  }
170  }
171 }
172 
173 #endif /* HAZELCAST_CLIENT_ADAPTOR_RAWPOINTERSET_H_ */
174 
bool removeAll(const std::vector< E > &elements)
Definition: ISet.h:152
bool addAll(const std::vector< T > &elements)
Definition: RawPointerSet.h:132
bool retainAll(const std::vector< T > &elements)
Removes the elements from this set that are not available in given "elements" vector.
Definition: RawPointerSet.h:153
bool containsAll(const std::vector< E > &elements)
Definition: ISet.h:131
int size()
Definition: ISet.h:75
bool add(const T &element)
Definition: RawPointerSet.h:102
int size()
Definition: RawPointerSet.h:66
bool contains(const T &element)
Definition: RawPointerSet.h:84
bool removeAll(const std::vector< T > &elements)
Definition: RawPointerSet.h:142
Concurrent, distributed client implementation of std::unordered_set.
Definition: RawPointerSet.h:31
void clear()
Removes all elements from set.
Definition: ISet.h:172
bool add(const E &element)
Definition: ISet.h:111
bool addAll(const std::vector< E > &elements)
Definition: ISet.h:141
std::auto_ptr< DataArray< T > > toArray()
Definition: RawPointerSet.h:92
bool containsAll(const std::vector< T > &elements)
Definition: RawPointerSet.h:122
bool remove(const E &element)
Definition: ISet.h:121
std::string addItemListener(ItemListener< E > &listener, bool includeValue)
Warning 1: If listener should do a time consuming operation, off-load the operation to another thread...
Definition: ISet.h:51
bool removeItemListener(const std::string &registrationId)
Removes the specified item listener.
Definition: RawPointerSet.h:58
Item listener for IQueue, ISet and IList.
Definition: ItemListener.h:40
bool removeItemListener(const std::string &registrationId)
Removes the specified item listener.
Definition: ISet.h:67
bool contains(const E &element)
Definition: ISet.h:93
std::string addItemListener(ItemListener< T > &listener, bool includeValue)
Warning 1: If listener should do a time consuming operation, off-load the operation to another thread...
Definition: RawPointerSet.h:46
bool isEmpty()
Definition: RawPointerSet.h:74
bool retainAll(const std::vector< E > &elements)
Removes the elements from this set that are not available in given "elements" vector.
Definition: ISet.h:164
bool isEmpty()
Definition: ISet.h:83
void clear()
Removes all elements from set.
Definition: RawPointerSet.h:161