Hazelcast C++ Client
Public Member Functions | Static Public Attributes | Friends | List of all members
hazelcast::client::ilist Class Reference

Concurrent, distributed, client implementation of list. More...

#include <ilist.h>

+ Inheritance diagram for hazelcast::client::ilist:

Public Member Functions

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. More...
 
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. More...
 
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. More...
 
template<typename E >
boost::future< boost::optional< E > > get (int32_t index)
 You can check if element is available by. More...
 
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. More...
 
template<typename E >
boost::future< void > add (int32_t index, const E &element)
 Adds the element to the given index. More...
 
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 Public Attributes

static constexpr const char * SERVICE_NAME = "hz:impl:listService"
 

Friends

class spi::ProxyManager
 

Detailed Description

Concurrent, distributed, client implementation of list.

Member Function Documentation

◆ add() [1/2]

template<typename E >
boost::future<bool> hazelcast::client::ilist::add ( const E &  element)
inline
Parameters
element
Returns
true if element is added successfully.

◆ 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
indexinsert position
elementto be inserted.
Exceptions
Iclass_castif the type of the specified element is incompatible with the server side.
index_out_of_boundsif the index is out of range.

◆ add_all() [1/2]

template<typename E >
boost::future<bool> hazelcast::client::ilist::add_all ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if all elements given in vector can be added to list.

◆ 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
indexstart point of inserting given elements
elementsvector of elements that will be added to list
Returns
true if list elements are added.
Exceptions
index_out_of_boundsif the index is out of range.

◆ 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
listenerthat will be added
includeValuebool value representing value should be included in ItemEvent or not.
Returns
registrationId that can be used to remove item listener

◆ contains()

template<typename E >
boost::future<bool> hazelcast::client::ilist::contains ( const E &  element)
inline
Parameters
element
Returns
true if list contains element

◆ contains_all()

template<typename E >
boost::future<bool> hazelcast::client::ilist::contains_all ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if this list contains all elements given in vector.

◆ 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
index
Returns
element in given index. If not available returns empty constructed shared_ptr.
Exceptions
index_out_of_boundsif the index is out of range.

◆ index_of()

template<typename E >
boost::future<int> hazelcast::client::ilist::index_of ( const E &  element)
inline
Parameters
elementthat will be searched
Returns
index of first occurrence of given element in the list. Returns -1 if element is not in the list.

◆ last_index_of()

template<typename E >
boost::future<int32_t> hazelcast::client::ilist::last_index_of ( const E &  element)
inline
Parameters
elementthat will be searched
Returns
index of last occurrence of given element in the list. Returns -1 if element is not in the list.

◆ remove() [1/2]

template<typename E >
boost::future<bool> hazelcast::client::ilist::remove ( const E &  element)
inline
Parameters
element
Returns
true if element is removed successfully.

◆ remove() [2/2]

template<typename E >
boost::future<boost::optional<E> > hazelcast::client::ilist::remove ( int32_t  index)
inline
Parameters
index
Returns
element in given index. If not available returns empty constructed shared_ptr.
See also
get
Exceptions
index_out_of_boundsif the index is out of range.

◆ remove_all()

template<typename E >
boost::future<bool> hazelcast::client::ilist::remove_all ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if all elements are removed successfully.

◆ 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
elementsstd::vector<E>
Returns
true if operation is successful.

◆ 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
indexinsert position
elementto be inserted.
Returns
oldElement in given index.
Exceptions
Iclass_castif the type of the specified element is incompatible with the server side.
index_out_of_boundsif the index is out of range.

◆ 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_boundsif the index is out of range.

◆ to_array()

template<typename E >
boost::future<std::vector<E> > hazelcast::client::ilist::to_array ( )
inline
Returns
all elements as std::vector

The documentation for this class was generated from the following file: