Hazelcast C++ Client
IList.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_ILIST_H_
17 #define HAZELCAST_CLIENT_MIXEDTYPE_ILIST_H_
18 
19 #include <vector>
20 #include <string>
21 
22 #include "hazelcast/client/proxy/IListImpl.h"
23 #include "hazelcast/client/TypedData.h"
24 #include "hazelcast/client/ItemListener.h"
25 
26 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
27 #pragma warning(push)
28 #pragma warning(disable: 4251) //for dll export
29 #endif
30 
31 namespace hazelcast {
32  namespace client {
33  namespace mixedtype {
38  class HAZELCAST_API IList : public proxy::IListImpl {
39  friend class client::HazelcastClient;
40 
41  public:
53  std::string addItemListener(MixedItemListener &listener, bool includeValue);
54 
63  bool removeItemListener(const std::string &registrationId);
64 
69  int size();
70 
75  bool isEmpty();
76 
83  template <typename E>
84  bool contains(const E &element) {
85  return proxy::IListImpl::contains(toData<E>(element));
86  }
87 
92  std::vector<TypedData> toArray();
93 
100  template <typename E>
101  bool add(const E &element) {
102  return proxy::IListImpl::add(toData<E>(element));
103  }
104 
111  template <typename E>
112  bool remove(const E &element) {
113  return proxy::IListImpl::remove(toData<E>(element));
114  }
115 
122  template <typename E>
123  bool containsAll(const std::vector<E> &elements) {
124  return proxy::IListImpl::containsAll(toDataCollection<E>(elements));
125  }
126 
133  template <typename E>
134  bool addAll(const std::vector<E> &elements) {
135  return proxy::IListImpl::addAll(toDataCollection<E>(elements));
136  }
137 
149  template <typename E>
150  bool addAll(int index, const std::vector<E> &elements) {
151  return proxy::IListImpl::addAll(index, toDataCollection<E>(elements));
152  }
153 
160  template <typename E>
161  bool removeAll(const std::vector<E> &elements) {
162  return proxy::IListImpl::removeAll(toDataCollection<E>(elements));
163  }
164 
172  template <typename E>
173  bool retainAll(const std::vector<E> &elements) {
174  return proxy::IListImpl::retainAll(toDataCollection<E>(elements));
175  }
176 
180  void clear();
181 
194  TypedData get(int index);
195 
205  template <typename E>
206  TypedData set(int index, const E &element) {
207  return TypedData(proxy::IListImpl::setData(index, toData(element)), context->getSerializationService());
208  }
209 
218  template <typename E>
219  void add(int index, const E &element) {
220  proxy::IListImpl::add(index, toData(element));
221  }
222 
230  TypedData remove(int index);
231 
239  template <typename E>
240  int indexOf(const E &element) {
241  return proxy::IListImpl::indexOf(toData(element));
242  }
243 
250  template <typename E>
251  int lastIndexOf(const E &element) {
252  return proxy::IListImpl::lastIndexOf(toData(element));
253  }
254 
260  std::vector<TypedData> subList(int fromIndex, int toIndex);
261 
262  private:
263  IList(const std::string &instanceName, spi::ClientContext *context);
264  };
265  }
266  }
267 }
268 
269 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
270 #pragma warning(pop)
271 #endif
272 
273 #endif /* HAZELCAST_CLIENT_MIXEDTYPE_ILIST_H_ */
274 
TypedData set(int index, const E &element)
Replaced the element in the given index.
Definition: IList.h:206
bool containsAll(const std::vector< E > &elements)
Definition: IList.h:123
bool contains(const E &element)
Definition: IList.h:84
bool removeAll(const std::vector< E > &elements)
Definition: IList.h:161
bool addAll(const std::vector< E > &elements)
Definition: IList.h:134
int indexOf(const E &element)
Definition: IList.h:240
Concurrent, distributed , client implementation of std::list.
Definition: IList.h:38
bool addAll(int index, const std::vector< E > &elements)
Adds elements in vector to the list with given order.
Definition: IList.h:150
bool add(const E &element)
Definition: IList.h:101
bool retainAll(const std::vector< E > &elements)
Removes the elements from this list that are not available in given "elements" vector.
Definition: IList.h:173
Item listener for IQueue, ISet and IList.
Definition: ItemListener.h:40
Definition: MapEntryView.h:32
void add(int index, const E &element)
Adds the element to the given index.
Definition: IList.h:219
TypedData class is a wrapper class for the serialized binary data.
Definition: TypedData.h:40
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:459
int lastIndexOf(const E &element)
Definition: IList.h:251