18#include "hazelcast/client/impl/ItemEventHandler.h"
19#include "hazelcast/client/proxy/IListImpl.h"
20#include "hazelcast/client/protocol/codec/codecs.h"
28class ilist :
public proxy::IListImpl
30 friend class spi::ProxyManager;
33 static constexpr const char* SERVICE_NAME =
"hz:impl:listService";
52 impl::item_event_handler<protocol::codec::list_addlistener_handler>>
53 itemEventHandler(
new impl::item_event_handler<
54 protocol::codec::list_addlistener_handler>(
56 get_context().get_logger(),
57 get_context().get_client_cluster_service(),
58 get_context().get_serialization_service(),
62 return proxy::IListImpl::add_item_listener(std::move(itemEventHandler),
74 return proxy::IListImpl::contains(to_data(element));
84 return to_object_vector<E>(proxy::IListImpl::to_array_data());
93 boost::future<bool>
add(
const E& element)
95 return proxy::IListImpl::add(to_data(element));
104 boost::future<bool>
remove(
const E& element)
106 return proxy::IListImpl::remove(to_data(element));
117 return proxy::IListImpl::contains_all_data(
118 to_data_collection(elements));
127 boost::future<bool>
add_all(
const std::vector<E>& elements)
129 return proxy::IListImpl::add_all_data(to_data_collection(elements));
143 boost::future<bool>
add_all(int32_t index,
const std::vector<E>& elements)
145 return proxy::IListImpl::add_all_data(index,
146 to_data_collection(elements));
155 boost::future<bool>
remove_all(
const std::vector<E>& elements)
157 return proxy::IListImpl::remove_all_data(to_data_collection(elements));
168 boost::future<bool>
retain_all(
const std::vector<E>& elements)
170 return proxy::IListImpl::retain_all_data(to_data_collection(elements));
187 boost::future<boost::optional<E>>
get(int32_t index)
189 return to_object<E>(proxy::IListImpl::get_data(index));
203 template<
typename E,
typename R = E>
204 boost::future<boost::optional<R>>
set(int32_t index,
const E& element)
207 proxy::IListImpl::set_data(index, to_data(element)));
220 boost::future<void>
add(int32_t index,
const E& element)
222 return proxy::IListImpl::add(index, to_data(element));
234 boost::future<boost::optional<E>>
remove(int32_t index)
236 return to_object<E>(proxy::IListImpl::remove_data(index));
248 return proxy::IListImpl::index_of(to_data(element));
259 return proxy::IListImpl::last_index_of(to_data(element));
268 boost::future<std::vector<E>>
sub_list(int32_t from_index, int32_t to_index)
270 return to_object_vector<E>(
271 proxy::IListImpl::sub_list_data(from_index, to_index));
275 ilist(
const std::string& instance_name, spi::ClientContext* context)
276 : proxy::IListImpl(instance_name, context)
Concurrent, distributed, client implementation of list.
boost::future< bool > contains(const E &element)
boost::future< bool > add_all(const std::vector< E > &elements)
boost::future< boost::optional< R > > set(int32_t index, const E &element)
Replaced the element in the given index.
boost::future< boost::optional< E > > get(int32_t index)
You can check if element is available by.
boost::future< std::vector< E > > sub_list(int32_t from_index, int32_t to_index)
boost::future< bool > retain_all(const std::vector< E > &elements)
Removes the elements from this list that are not available in given "elements" vector.
boost::future< boost::optional< E > > remove(int32_t index)
boost::future< bool > add(const E &element)
boost::future< bool > remove(const E &element)
boost::future< void > add(int32_t index, const E &element)
Adds the element to the given index.
boost::future< std::vector< E > > to_array()
boost::future< int > index_of(const E &element)
boost::future< bool > remove_all(const std::vector< E > &elements)
boost::future< bool > contains_all(const std::vector< E > &elements)
boost::future< int32_t > last_index_of(const E &element)
boost::future< bool > add_all(int32_t index, const std::vector< E > &elements)
Adds elements in vector to the list with given order.
boost::future< boost::uuids::uuid > add_item_listener(item_listener &&listener, bool include_value)
Warning 1: If listener should do a time consuming operation, off-load the operation to another thread...
Item listener for IQueue, ISet and IList.