18 #include "hazelcast/client/impl/ItemEventHandler.h"
19 #include "hazelcast/client/proxy/IListImpl.h"
20 #include "hazelcast/client/protocol/codec/codecs.h"
28 class ilist :
public proxy::IListImpl {
29 friend class spi::ProxyManager;
31 static constexpr
const char *SERVICE_NAME =
"hz:impl:listService";
45 std::unique_ptr<impl::item_event_handler<protocol::codec::list_addlistener_handler>> itemEventHandler(
46 new impl::item_event_handler<protocol::codec::list_addlistener_handler>(
47 get_name(), get_context().get_client_cluster_service(),
48 get_context().get_serialization_service(),
52 return proxy::IListImpl::add_item_listener(std::move(itemEventHandler), include_value);
61 boost::future<bool>
contains(
const E &element) {
62 return proxy::IListImpl::contains(to_data(element));
71 return to_object_vector<E>(proxy::IListImpl::to_array_data());
80 boost::future<bool>
add(
const E &element) {
81 return proxy::IListImpl::add(to_data(element));
90 boost::future<bool>
remove(
const E &element) {
91 return proxy::IListImpl::remove(to_data(element));
101 return proxy::IListImpl::contains_all_data(to_data_collection(elements));
110 boost::future<bool>
add_all(
const std::vector<E> &elements) {
111 return proxy::IListImpl::add_all_data(to_data_collection(elements));
125 boost::future<bool>
add_all(int32_t index,
const std::vector<E> &elements) {
126 return proxy::IListImpl::add_all_data(index, to_data_collection(elements));
135 boost::future<bool>
remove_all(
const std::vector<E> &elements) {
136 return proxy::IListImpl::remove_all_data(to_data_collection(elements));
146 boost::future<bool>
retain_all(
const std::vector<E> &elements) {
147 return proxy::IListImpl::retain_all_data(to_data_collection(elements));
163 boost::future<boost::optional<E>>
get(int32_t index) {
164 return to_object<E>(proxy::IListImpl::get_data(index));
176 template<
typename E,
typename R = E>
177 boost::future<boost::optional<R>>
set(int32_t index,
const E &element) {
178 return to_object<R>(proxy::IListImpl::set_data(index, to_data(element)));
190 boost::future<void>
add(int32_t index,
const E &element) {
191 return proxy::IListImpl::add(index, to_data(element));
202 boost::future<boost::optional<E>>
remove(int32_t index) {
203 return to_object<E>(proxy::IListImpl::remove_data(index));
214 return proxy::IListImpl::index_of(to_data(element));
224 return proxy::IListImpl::last_index_of(to_data(element));
233 boost::future<std::vector<E>>
sub_list(int32_t from_index, int32_t to_index) {
234 return to_object_vector<E>(proxy::IListImpl::sub_list_data(from_index, to_index));
238 ilist(
const std::string &instance_name, spi::ClientContext *context) : proxy::IListImpl(instance_name,
Concurrent, distributed, client implementation of list.
boost::future< std::vector< E > > to_array()
boost::future< boost::optional< R > > set(int32_t index, const E &element)
Replaced the element in the given 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< int > index_of(const E &element)
boost::future< std::vector< E > > sub_list(int32_t from_index, int32_t to_index)
boost::future< bool > contains_all(const std::vector< E > &elements)
boost::future< bool > remove(const E &element)
boost::future< bool > add_all(const std::vector< E > &elements)
boost::future< bool > remove_all(const std::vector< E > &elements)
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...
boost::future< int32_t > last_index_of(const E &element)
boost::future< boost::optional< E > > get(int32_t index)
You can check if element is available by.
boost::future< bool > add(const E &element)
boost::future< bool > contains(const E &element)
boost::future< boost::optional< E > > remove(int32_t index)
boost::future< void > add(int32_t index, const E &element)
Adds the element to the given index.
boost::future< bool > add_all(int32_t index, const std::vector< E > &elements)
Adds elements in vector to the list with given order.
Item listener for IQueue, ISet and IList.