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"
42 class IList :
public proxy::IListImpl {
59 impl::ItemEventHandler<E, protocol::codec::ListAddListenerCodec::AbstractEventHandler> *entryEventHandler =
60 new impl::ItemEventHandler<E, protocol::codec::ListAddListenerCodec::AbstractEventHandler>(
61 getName(), context->getClusterService(), context->getSerializationService(), listener,
63 return proxy::IListImpl::addItemListener(entryEventHandler, includeValue);
75 return proxy::IListImpl::removeItemListener(registrationId);
83 return proxy::IListImpl::size();
101 return proxy::IListImpl::contains(toData(element));
109 return toObjectCollection<E>(proxy::IListImpl::toArrayData());
118 bool add(
const E &element) {
119 return proxy::IListImpl::add(toData(element));
128 bool remove(
const E &element) {
129 return proxy::IListImpl::remove(toData(element));
139 return proxy::IListImpl::containsAll(toDataCollection(elements));
148 bool addAll(
const std::vector<E> &elements) {
149 return proxy::IListImpl::addAll(toDataCollection(elements));
163 bool addAll(
int index,
const std::vector<E> &elements) {
164 return proxy::IListImpl::addAll(index, toDataCollection(elements));
174 return proxy::IListImpl::removeAll(toDataCollection(elements));
185 return proxy::IListImpl::retainAll(toDataCollection(elements));
192 proxy::IListImpl::clear();
207 boost::shared_ptr<E>
get(
int index) {
208 return boost::shared_ptr<E>(toObject<E>(proxy::IListImpl::getData(index)));
220 boost::shared_ptr<E>
set(
int index,
const E &element) {
221 return boost::shared_ptr<E>(toObject<E>(proxy::IListImpl::setData(index, toData(element))));
232 void add(
int index,
const E &element) {
233 proxy::IListImpl::add(index, toData(element));
243 boost::shared_ptr<E>
remove(
int index) {
244 return boost::shared_ptr<E>(toObject<E>(proxy::IListImpl::removeData(index)));
255 return proxy::IListImpl::indexOf(toData(element));
265 return proxy::IListImpl::lastIndexOf(toData(element));
273 std::vector<E>
subList(
int fromIndex,
int toIndex) {
274 return toObjectCollection<E>(proxy::IListImpl::subListData(fromIndex, toIndex));
278 IList(
const std::string &instanceName, spi::ClientContext *context)
279 : 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:58
int indexOf(const E &element)
Definition: IList.h:254
int lastIndexOf(const E &element)
Definition: IList.h:264
bool retainAll(const std::vector< E > &elements)
Removes the elements from this list that are not available in given "elements" vector.
Definition: IList.h:184
int size()
Definition: IList.h:82
bool removeAll(const std::vector< E > &elements)
Definition: IList.h:173
bool removeItemListener(const std::string ®istrationId)
Removes the specified item listener.
Definition: IList.h:74
bool containsAll(const std::vector< E > &elements)
Definition: IList.h:138
std::vector< E > subList(int fromIndex, int toIndex)
Definition: IList.h:273
Concurrent, distributed , client implementation of std::list.
Definition: IList.h:42
bool add(const E &element)
Definition: IList.h:118
Concurrent, distributed , client implementation of std::list.
Definition: RawPointerList.h:38
void clear()
Removes all elements from list.
Definition: IList.h:191
bool addAll(int index, const std::vector< E > &elements)
Adds elements in vector to the list with given order.
Definition: IList.h:163
bool isEmpty()
Definition: IList.h:90
bool addAll(const std::vector< E > &elements)
Definition: IList.h:148
boost::shared_ptr< E > set(int index, const E &element)
Replaced the element in the given index.
Definition: IList.h:220
Item listener for IQueue, ISet and IList.
Definition: ItemListener.h:40
std::vector< E > toArray()
Definition: IList.h:108
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:458
void add(int index, const E &element)
Adds the element to the given index.
Definition: IList.h:232
bool contains(const E &element)
Definition: IList.h:100