Hazelcast C++ Client
ISet.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 #ifndef HAZELCAST_CLIENT_MIXEDTYPE_ISET_H_
17 #define HAZELCAST_CLIENT_MIXEDTYPE_ISET_H_
18 
19 #include "hazelcast/client/proxy/ISetImpl.h"
20 #include "hazelcast/client/impl/ItemEventHandler.h"
21 #include "hazelcast/client/protocol/codec/SetAddListenerCodec.h"
22 
23 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
24 #pragma warning(push)
25 #pragma warning(disable: 4251) //for dll export
26 #endif
27 
28 namespace hazelcast {
29  namespace client {
30  namespace mixedtype {
31 
36  class HAZELCAST_API ISet : public proxy::ISetImpl {
37  friend class client::HazelcastClient;
38 
39  public:
50  std::string addItemListener(MixedItemListener &listener, bool includeValue);
59  bool removeItemListener(const std::string &registrationId);
60 
65  int size();
66 
71  bool isEmpty();
72 
79  template <typename E>
80  bool contains(const E &element) {
81  return proxy::ISetImpl::contains(toData(element));
82  }
83 
88  std::vector<TypedData> toArray();
89 
96  template <typename E>
97  bool add(const E &element) {
98  return proxy::ISetImpl::add(toData(element));
99  }
100 
107  template <typename E>
108  bool remove(const E &element) {
109  return proxy::ISetImpl::remove(toData(element));
110  }
111 
118  template <typename E>
119  bool containsAll(const std::vector<E> &elements) {
120  return proxy::ISetImpl::containsAll(toDataCollection(elements));
121  }
122 
129  template <typename E>
130  bool addAll(const std::vector<E> &elements) {
131  std::vector<serialization::pimpl::Data> dataCollection = toDataCollection(elements);
132  return proxy::ISetImpl::addAll(toDataCollection(elements));
133  }
134 
141  template <typename E>
142  bool removeAll(const std::vector<E> &elements) {
143  std::vector<serialization::pimpl::Data> dataCollection = toDataCollection(elements);
144  return proxy::ISetImpl::removeAll(dataCollection);
145  }
146 
154  template <typename E>
155  bool retainAll(const std::vector<E> &elements) {
156  return proxy::ISetImpl::retainAll(toDataCollection(elements));
157  }
158 
163  void clear();
164 
165  private:
166  ISet(const std::string &instanceName, spi::ClientContext *context);
167  };
168  }
169  }
170 }
171 
172 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
173 #pragma warning(pop)
174 #endif
175 
176 #endif /* HAZELCAST_CLIENT_MIXEDTYPE_ISET_H_ */
177 
bool contains(const E &element)
Definition: ISet.h:80
bool containsAll(const std::vector< E > &elements)
Definition: ISet.h:119
bool removeAll(const std::vector< E > &elements)
Definition: ISet.h:142
Concurrent, distributed client implementation of std::unordered_set.
Definition: ISet.h:36
bool addAll(const std::vector< E > &elements)
Definition: ISet.h:130
bool add(const E &element)
Definition: ISet.h:97
bool retainAll(const std::vector< E > &elements)
Removes the elements from this set that are not available in given "elements" vector.
Definition: ISet.h:155
Item listener for IQueue, ISet and IList.
Definition: ItemListener.h:40
Definition: MapEntryView.h:32
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:459