Concurrent, distributed, client implementation of list.
More...
#include <ilist.h>
|
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.
|
template<typename E> |
boost::future< bool > | contains (const E &element) |
template<typename E> |
boost::future< std::vector< E > > | to_array () |
template<typename E> |
boost::future< bool > | add (const E &element) |
template<typename E> |
boost::future< bool > | remove (const E &element) |
template<typename E> |
boost::future< bool > | contains_all (const std::vector< E > &elements) |
template<typename E> |
boost::future< bool > | add_all (const std::vector< E > &elements) |
template<typename E> |
boost::future< bool > | add_all (int32_t index, const std::vector< E > &elements) |
| Adds elements in vector to the list with given order.
|
template<typename E> |
boost::future< bool > | remove_all (const std::vector< E > &elements) |
template<typename E> |
boost::future< bool > | retain_all (const std::vector< E > &elements) |
| Removes the elements from this list that are not available in given "elements" vector.
|
template<typename E> |
boost::future< boost::optional< E > > | get (int32_t index) |
| You can check if element is available by.
|
template<typename E, typename R = E> |
boost::future< boost::optional< R > > | set (int32_t index, const E &element) |
| Replaced the element in the given index.
|
template<typename E> |
boost::future< void > | add (int32_t index, const E &element) |
| Adds the element to the given index.
|
template<typename E> |
boost::future< boost::optional< E > > | remove (int32_t index) |
template<typename E> |
boost::future< int > | index_of (const E &element) |
template<typename E> |
boost::future< int32_t > | last_index_of (const E &element) |
template<typename E> |
boost::future< std::vector< E > > | sub_list (int32_t from_index, int32_t to_index) |
|
static constexpr const char * | SERVICE_NAME = "hz:impl:listService" |
Concurrent, distributed, client implementation of list.
Definition at line 28 of file ilist.h.
◆ add() [1/2]
template<typename E>
boost::future< bool > hazelcast::client::ilist::add |
( |
const E & | element | ) |
|
|
inline |
- Parameters
-
- Returns
- true if element is added successfully.
Definition at line 93 of file ilist.h.
94 {
95 return proxy::IListImpl::add(to_data(element));
96 }
◆ add() [2/2]
template<typename E>
boost::future< void > hazelcast::client::ilist::add |
( |
int32_t | index, |
|
|
const E & | element ) |
|
inline |
Adds the element to the given index.
Shifts others to the right.
- Parameters
-
index | insert position |
element | to be inserted. |
- Exceptions
-
Iclass_cast | if the type of the specified element is incompatible with the server side. |
index_out_of_bounds | if the index is out of range. |
Definition at line 220 of file ilist.h.
221 {
222 return proxy::IListImpl::add(index, to_data(element));
223 }
◆ add_all() [1/2]
template<typename E>
boost::future< bool > hazelcast::client::ilist::add_all |
( |
const std::vector< E > & | elements | ) |
|
|
inline |
- Parameters
-
- Returns
- true if all elements given in vector can be added to list.
Definition at line 127 of file ilist.h.
128 {
129 return proxy::IListImpl::add_all_data(to_data_collection(elements));
130 }
◆ add_all() [2/2]
template<typename E>
boost::future< bool > hazelcast::client::ilist::add_all |
( |
int32_t | index, |
|
|
const std::vector< E > & | elements ) |
|
inline |
Adds elements in vector to the list with given order.
Starts adding elements from given index, and shifts others to the right.
- Parameters
-
index | start point of inserting given elements |
elements | vector of elements that will be added to list |
- Returns
- true if list elements are added.
- Exceptions
-
index_out_of_bounds | if the index is out of range. |
Definition at line 143 of file ilist.h.
144 {
145 return proxy::IListImpl::add_all_data(index,
146 to_data_collection(elements));
147 }
◆ add_item_listener()
boost::future< boost::uuids::uuid > hazelcast::client::ilist::add_item_listener |
( |
item_listener && | listener, |
|
|
bool | include_value ) |
|
inline |
Warning 1: If listener should do a time consuming operation, off-load the operation to another thread.
otherwise it will slow down the system.
Warning 2: Do not make a call to hazelcast. It can cause deadlock.
- Parameters
-
listener | that will be added |
includeValue | bool value representing value should be included in ItemEvent or not. |
- Returns
- registrationId that can be used to remove item listener
Definition at line 47 of file ilist.h.
50 {
51 std::unique_ptr<
52 impl::item_event_handler<protocol::codec::list_addlistener_handler>>
53 itemEventHandler(new impl::item_event_handler<
54 protocol::codec::list_addlistener_handler>(
55 get_name(),
56 get_context().get_logger(),
57 get_context().get_client_cluster_service(),
58 get_context().get_serialization_service(),
59 std::move(listener),
60 include_value));
61
62 return proxy::IListImpl::add_item_listener(std::move(itemEventHandler),
63 include_value);
64 }
◆ contains()
template<typename E>
boost::future< bool > hazelcast::client::ilist::contains |
( |
const E & | element | ) |
|
|
inline |
- Parameters
-
- Returns
- true if list contains element
Definition at line 72 of file ilist.h.
73 {
74 return proxy::IListImpl::contains(to_data(element));
75 }
◆ contains_all()
template<typename E>
boost::future< bool > hazelcast::client::ilist::contains_all |
( |
const std::vector< E > & | elements | ) |
|
|
inline |
- Parameters
-
- Returns
- true if this list contains all elements given in vector.
Definition at line 115 of file ilist.h.
116 {
117 return proxy::IListImpl::contains_all_data(
118 to_data_collection(elements));
119 }
◆ get()
template<typename E>
boost::future< boost::optional< E > > hazelcast::client::ilist::get |
( |
int32_t | index | ) |
|
|
inline |
You can check if element is available by.
auto e = list.get(5).get();
if(e.has_value())
//......;
- Parameters
-
- Returns
- element in given index. If not available returns empty constructed shared_ptr.
- Exceptions
-
index_out_of_bounds | if the index is out of range. |
Definition at line 187 of file ilist.h.
188 {
189 return to_object<E>(proxy::IListImpl::get_data(index));
190 }
◆ index_of()
template<typename E>
boost::future< int > hazelcast::client::ilist::index_of |
( |
const E & | element | ) |
|
|
inline |
- Parameters
-
element | that will be searched |
- Returns
- index of first occurrence of given element in the list. Returns -1 if element is not in the list.
Definition at line 246 of file ilist.h.
247 {
248 return proxy::IListImpl::index_of(to_data(element));
249 }
◆ last_index_of()
template<typename E>
boost::future< int32_t > hazelcast::client::ilist::last_index_of |
( |
const E & | element | ) |
|
|
inline |
- Parameters
-
element | that will be searched |
- Returns
- index of last occurrence of given element in the list. Returns -1 if element is not in the list.
Definition at line 257 of file ilist.h.
258 {
259 return proxy::IListImpl::last_index_of(to_data(element));
260 }
◆ remove() [1/2]
template<typename E>
boost::future< bool > hazelcast::client::ilist::remove |
( |
const E & | element | ) |
|
|
inline |
- Parameters
-
- Returns
- true if element is removed successfully.
Definition at line 104 of file ilist.h.
105 {
106 return proxy::IListImpl::remove(to_data(element));
107 }
◆ remove() [2/2]
template<typename E>
boost::future< boost::optional< E > > hazelcast::client::ilist::remove |
( |
int32_t | index | ) |
|
|
inline |
- Parameters
-
- Returns
- element in given index. If not available returns empty constructed shared_ptr.
- See also
- get
- Exceptions
-
index_out_of_bounds | if the index is out of range. |
Definition at line 234 of file ilist.h.
235 {
236 return to_object<E>(proxy::IListImpl::remove_data(index));
237 }
◆ remove_all()
template<typename E>
boost::future< bool > hazelcast::client::ilist::remove_all |
( |
const std::vector< E > & | elements | ) |
|
|
inline |
- Parameters
-
- Returns
- true if all elements are removed successfully.
Definition at line 155 of file ilist.h.
156 {
157 return proxy::IListImpl::remove_all_data(to_data_collection(elements));
158 }
◆ retain_all()
template<typename E>
boost::future< bool > hazelcast::client::ilist::retain_all |
( |
const std::vector< E > & | elements | ) |
|
|
inline |
Removes the elements from this list that are not available in given "elements" vector.
- Parameters
-
- Returns
- true if operation is successful.
Definition at line 168 of file ilist.h.
169 {
170 return proxy::IListImpl::retain_all_data(to_data_collection(elements));
171 }
◆ set()
template<typename E, typename R = E>
boost::future< boost::optional< R > > hazelcast::client::ilist::set |
( |
int32_t | index, |
|
|
const E & | element ) |
|
inline |
Replaced the element in the given index.
And returns element if there were entry before inserting.
- Parameters
-
index | insert position |
element | to be inserted. |
- Returns
- oldElement in given index.
- Exceptions
-
Iclass_cast | if the type of the specified element is incompatible with the server side. |
index_out_of_bounds | if the index is out of range. |
Definition at line 204 of file ilist.h.
205 {
206 return to_object<R>(
207 proxy::IListImpl::set_data(index, to_data(element)));
208 }
◆ sub_list()
template<typename E>
boost::future< std::vector< E > > hazelcast::client::ilist::sub_list |
( |
int32_t | from_index, |
|
|
int32_t | to_index ) |
|
inline |
- Returns
- the sublist as vector between given indexes.
- Exceptions
-
index_out_of_bounds | if the index is out of range. |
Definition at line 268 of file ilist.h.
269 {
270 return to_object_vector<E>(
271 proxy::IListImpl::sub_list_data(from_index, to_index));
272 }
◆ to_array()
template<typename E>
boost::future< std::vector< E > > hazelcast::client::ilist::to_array |
( |
| ) |
|
|
inline |
- Returns
- all elements as std::vector
Definition at line 82 of file ilist.h.
83 {
84 return to_object_vector<E>(proxy::IListImpl::to_array_data());
85 }
◆ spi::ProxyManager
friend class spi::ProxyManager |
|
friend |
◆ SERVICE_NAME
const char* hazelcast::client::ilist::SERVICE_NAME = "hz:impl:listService" |
|
staticconstexpr |
The documentation for this class was generated from the following file:
- hazelcast/include/hazelcast/client/ilist.h