Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
Public Member Functions | Friends | List of all members
hazelcast::client::IList< E > Class Template Reference

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

#include <IList.h>

+ Inheritance diagram for hazelcast::client::IList< E >:

Public Member Functions

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. More...
 
bool removeItemListener (const std::string &registrationId)
 Removes the specified item listener. More...
 
int size ()
 
bool isEmpty ()
 
bool contains (const E &element)
 
std::vector< E > toArray ()
 
bool add (const E &element)
 
bool remove (const E &element)
 
bool containsAll (const std::vector< E > &elements)
 
bool addAll (const std::vector< E > &elements)
 
bool addAll (int index, const std::vector< E > &elements)
 Adds elements in vector to the list with given order. More...
 
bool removeAll (const std::vector< E > &elements)
 
bool retainAll (const std::vector< E > &elements)
 Removes the elements from this list that are not available in given "elements" vector. More...
 
void clear ()
 Removes all elements from list.
 
boost::shared_ptr< E > get (int index)
 You can check if element is available by. More...
 
boost::shared_ptr< E > set (int index, const E &element)
 Replaced the element in the given index. More...
 
void add (int index, const E &element)
 Adds the element to the given index. More...
 
boost::shared_ptr< E > remove (int index)
 
int indexOf (const E &element)
 
int lastIndexOf (const E &element)
 
std::vector< E > subList (int fromIndex, int toIndex)
 

Friends

class HazelcastClient
 

Detailed Description

template<typename E>
class hazelcast::client::IList< E >

Concurrent, distributed , client implementation of std::list.

Parameters
<E>item type

Member Function Documentation

template<typename E >
bool hazelcast::client::IList< E >::add ( const E &  element)
inline
Parameters
element
Returns
true if element is added successfully.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
void hazelcast::client::IList< E >::add ( int  index,
const E &  element 
)
inline

Adds the element to the given index.

Shifts others to the right.

Parameters
indexinsert position
elementto be inserted.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
IndexOutOfBoundsExceptionif the index is out of range.
template<typename E >
bool hazelcast::client::IList< E >::addAll ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if all elements given in vector can be added to list.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
bool hazelcast::client::IList< E >::addAll ( int  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 insterting given elements
elementsvector of elements that will be added to list
Returns
true if list elements are added.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
IndexOutOfBoundsExceptionif the index is out of range.
template<typename E >
std::string hazelcast::client::IList< E >::addItemListener ( ItemListener< E > &  listener,
bool  includeValue 
)
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
template<typename E >
bool hazelcast::client::IList< E >::contains ( const E &  element)
inline
Parameters
element
Returns
true if list contains element
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
bool hazelcast::client::IList< E >::containsAll ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if this list contains all elements given in vector.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
boost::shared_ptr<E> hazelcast::client::IList< E >::get ( int  index)
inline

You can check if element is available by.

boost::shared_ptr<int> e = list.get(5); if(e.get() != NULL ) //......;

Parameters
index
Returns
element in given index. If not available returns empty constructed shared_ptr.
Exceptions
IndexOutOfBoundsExceptionif the index is out of range.
template<typename E >
int hazelcast::client::IList< E >::indexOf ( 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.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
bool hazelcast::client::IList< E >::isEmpty ( )
inline
Returns
true if empty
template<typename E >
int hazelcast::client::IList< E >::lastIndexOf ( 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.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
bool hazelcast::client::IList< E >::remove ( const E &  element)
inline
Parameters
element
Returns
true if element is removed successfully.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
boost::shared_ptr<E> hazelcast::client::IList< E >::remove ( int  index)
inline
Parameters
index
Returns
element in given index. If not available returns empty constructed shared_ptr.
See Also
get
Exceptions
IndexOutOfBoundsExceptionif the index is out of range.
template<typename E >
bool hazelcast::client::IList< E >::removeAll ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if all elements are removed successfully.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
bool hazelcast::client::IList< E >::removeItemListener ( const std::string &  registrationId)
inline

Removes the specified item listener.

Returns false if the specified listener is not added before.

Parameters
registrationIdId of listener registration.
Returns
true if registration is removed, false otherwise
template<typename E >
bool hazelcast::client::IList< E >::retainAll ( 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.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.
template<typename E >
boost::shared_ptr<E> hazelcast::client::IList< E >::set ( int  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
IClassCastExceptionif the type of the specified element is incompatible with the server side.
IndexOutOfBoundsExceptionif the index is out of range.
template<typename E >
int hazelcast::client::IList< E >::size ( )
inline
Returns
size of the distributed list
template<typename E >
std::vector<E> hazelcast::client::IList< E >::subList ( int  fromIndex,
int  toIndex 
)
inline
Returns
the sublist as vector between given indexes.
Exceptions
IndexOutOfBoundsExceptionif the index is out of range.
template<typename E >
std::vector<E> hazelcast::client::IList< E >::toArray ( )
inline
Returns
all elements as std::vector

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