16 #ifndef HAZELCAST_ILIST
17 #define HAZELCAST_ILIST
19 #include "hazelcast/client/serialization/pimpl/Data.h"
20 #include "hazelcast/client/DistributedObject.h"
21 #include "hazelcast/client/ItemListener.h"
22 #include "hazelcast/client/impl/ItemEventHandler.h"
23 #include "hazelcast/client/proxy/IListImpl.h"
24 #include "hazelcast/client/protocol/codec/ListAddListenerCodec.h"
38 class IList :
public proxy::IListImpl {
54 impl::ItemEventHandler<E, protocol::codec::ListAddListenerCodec::AbstractEventHandler> *entryEventHandler =
55 new impl::ItemEventHandler<E, protocol::codec::ListAddListenerCodec::AbstractEventHandler>(
56 getName(), context->getClusterService(), context->getSerializationService(), listener,
58 return proxy::IListImpl::addItemListener(entryEventHandler, includeValue);
70 return proxy::IListImpl::removeItemListener(registrationId);
78 return proxy::IListImpl::size();
96 return proxy::IListImpl::contains(toData(element));
104 return toObjectCollection<E>(proxy::IListImpl::toArray());
113 bool add(
const E &element) {
114 return proxy::IListImpl::add(toData(element));
123 bool remove(
const E &element) {
124 return proxy::IListImpl::remove(toData(element));
134 return proxy::IListImpl::containsAll(toDataCollection(elements));
143 bool addAll(
const std::vector<E> &elements) {
144 return proxy::IListImpl::addAll(toDataCollection(elements));
158 bool addAll(
int index,
const std::vector<E> &elements) {
159 return proxy::IListImpl::addAll(index, toDataCollection(elements));
169 return proxy::IListImpl::removeAll(toDataCollection(elements));
180 return proxy::IListImpl::retainAll(toDataCollection(elements));
187 proxy::IListImpl::clear();
202 boost::shared_ptr<E>
get(
int index) {
203 return toObject<E>(proxy::IListImpl::get(index));
215 boost::shared_ptr<E>
set(
int index,
const E &element) {
216 return toObject<E>(proxy::IListImpl::set(index, toData(element)));
227 void add(
int index,
const E &element) {
228 proxy::IListImpl::add(index, toData(element));
238 boost::shared_ptr<E>
remove(
int index) {
239 return toObject<E>(proxy::IListImpl::remove(index));
250 return proxy::IListImpl::indexOf(toData(element));
260 return proxy::IListImpl::lastIndexOf(toData(element));
268 std::vector<E>
subList(
int fromIndex,
int toIndex) {
269 return toObjectCollection<E>(proxy::IListImpl::subList(fromIndex, toIndex));
273 IList(
const std::string &instanceName, spi::ClientContext *context)
274 : proxy::IListImpl(instanceName, context) {
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: IList.h:53
int indexOf(const E &element)
Definition: IList.h:249
int lastIndexOf(const E &element)
Definition: IList.h:259
bool retainAll(const std::vector< E > &elements)
Removes the elements from this list that are not available in given "elements" vector.
Definition: IList.h:179
int size()
Definition: IList.h:77
bool removeAll(const std::vector< E > &elements)
Definition: IList.h:168
bool removeItemListener(const std::string ®istrationId)
Removes the specified item listener.
Definition: IList.h:69
bool containsAll(const std::vector< E > &elements)
Definition: IList.h:133
std::vector< E > subList(int fromIndex, int toIndex)
Definition: IList.h:268
Concurrent, distributed , client implementation of std::list.
Definition: IList.h:38
bool add(const E &element)
Definition: IList.h:113
void clear()
Removes all elements from list.
Definition: IList.h:186
bool addAll(int index, const std::vector< E > &elements)
Adds elements in vector to the list with given order.
Definition: IList.h:158
bool isEmpty()
Definition: IList.h:85
bool addAll(const std::vector< E > &elements)
Definition: IList.h:143
boost::shared_ptr< E > set(int index, const E &element)
Replaced the element in the given index.
Definition: IList.h:215
Item listener for IQueue, ISet and IList.
Definition: ItemListener.h:40
std::vector< E > toArray()
Definition: IList.h:103
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:412
void add(int index, const E &element)
Adds the element to the given index.
Definition: IList.h:227
bool contains(const E &element)
Definition: IList.h:95