Hazelcast C++ Client
Public Member Functions | Friends | List of all members
hazelcast::client::IQueue< E > Class Template Reference

Concurrent, blocking, distributed, observable, client queue. More...

#include <IQueue.h>

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

Public Member Functions

std::string addItemListener (ItemListener< E > &listener, bool includeValue)
 Adds an item listener for this collection. More...
 
bool removeItemListener (const std::string &registrationId)
 Removes the specified item listener. More...
 
bool offer (const E &element)
 Inserts the specified element into this queue. More...
 
void put (const E &element)
 Puts the element into queue. More...
 
bool offer (const E &element, long timeoutInMillis)
 Inserts the specified element into this queue. More...
 
boost::shared_ptr< E > take ()
 
boost::shared_ptr< E > poll (long timeoutInMillis)
 
int remainingCapacity ()
 
bool remove (const E &element)
 
bool contains (const E &element)
 
size_t drainTo (std::vector< E > &elements)
 Note that elements will be pushed_back to vector. More...
 
size_t drainTo (std::vector< E > &elements, size_t maxElements)
 Note that elements will be pushed_back to vector. More...
 
boost::shared_ptr< E > poll ()
 Returns immediately without waiting. More...
 
boost::shared_ptr< E > peek ()
 Returns immediately without waiting. More...
 
int size ()
 
bool isEmpty ()
 
std::vector< E > toArray ()
 
bool containsAll (const std::vector< E > &elements)
 
bool addAll (const std::vector< E > &elements)
 
bool removeAll (const std::vector< E > &elements)
 
bool retainAll (const std::vector< E > &elements)
 Removes the elements from this queue that are not available in given "elements" vector. More...
 
void clear ()
 Removes all elements from queue.
 

Friends

class impl::HazelcastClientInstanceImpl
 
class adaptor::RawPointerQueue< E >
 

Detailed Description

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

Concurrent, blocking, distributed, observable, client queue.

Template Parameters
Eitem type

Member Function Documentation

◆ addAll()

template<typename E>
bool hazelcast::client::IQueue< E >::addAll ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if all elements given in vector can be added to queue.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ addItemListener()

template<typename E>
std::string hazelcast::client::IQueue< E >::addItemListener ( ItemListener< E > &  listener,
bool  includeValue 
)
inline

Adds an item listener for this collection.

Listener will get notified for all collection add/remove events.

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
listeneritem listener
includeValuetrue updated item should be passed to the item listener, false otherwise.
Returns
returns registration id.

◆ contains()

template<typename E>
bool hazelcast::client::IQueue< E >::contains ( const E &  element)
inline
Parameters
elementto be checked.
Returns
true if queue contains the element.

◆ containsAll()

template<typename E>
bool hazelcast::client::IQueue< E >::containsAll ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if this queue contains all elements given in vector.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ drainTo() [1/2]

template<typename E>
size_t hazelcast::client::IQueue< E >::drainTo ( std::vector< E > &  elements)
inline

Note that elements will be pushed_back to vector.

Parameters
elementsthe vector that elements will be drained to.
Returns
number of elements drained.

◆ drainTo() [2/2]

template<typename E>
size_t hazelcast::client::IQueue< E >::drainTo ( std::vector< E > &  elements,
size_t  maxElements 
)
inline

Note that elements will be pushed_back to vector.

Parameters
maxElementsupper limit to be filled to vector.
elementsvector that elements will be drained to.
Returns
number of elements drained.

◆ isEmpty()

template<typename E>
bool hazelcast::client::IQueue< E >::isEmpty ( )
inline
Returns
true if queue is empty

◆ offer() [1/2]

template<typename E>
bool hazelcast::client::IQueue< E >::offer ( const E &  element)
inline

Inserts the specified element into this queue.

Parameters
elementto add
Returns
true if the element was added to this queue, else false
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ offer() [2/2]

template<typename E>
bool hazelcast::client::IQueue< E >::offer ( const E &  element,
long  timeoutInMillis 
)
inline

Inserts the specified element into this queue.

If queue is full waits for space to became available for specified time.

Parameters
elementto add
timeoutInMillishow long to wait before giving up, in units of
Returns
true if successful, or false if the specified waiting time elapses before space is available

◆ peek()

template<typename E>
boost::shared_ptr<E> hazelcast::client::IQueue< E >::peek ( )
inline

Returns immediately without waiting.

Returns
head of queue without removing it. If not available returns empty constructed shared_ptr.

◆ poll() [1/2]

template<typename E>
boost::shared_ptr<E> hazelcast::client::IQueue< E >::poll ( long  timeoutInMillis)
inline
Parameters
timeoutInMillistime to wait if item is not available.
Returns
the head of the queue. If queue is empty waits for specified time.

◆ poll() [2/2]

template<typename E>
boost::shared_ptr<E> hazelcast::client::IQueue< E >::poll ( )
inline

Returns immediately without waiting.

Returns
removes head of the queue and returns it to user . If not available returns empty constructed shared_ptr.

◆ put()

template<typename E>
void hazelcast::client::IQueue< E >::put ( const E &  element)
inline

Puts the element into queue.

If queue is full waits for space to became available.

◆ remainingCapacity()

template<typename E>
int hazelcast::client::IQueue< E >::remainingCapacity ( )
inline
Returns
remaining capacity

◆ remove()

template<typename E>
bool hazelcast::client::IQueue< E >::remove ( const E &  element)
inline
Parameters
elementto be removed.
Returns
true if element removed successfully.

◆ removeAll()

template<typename E>
bool hazelcast::client::IQueue< 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.

◆ removeItemListener()

template<typename E>
bool hazelcast::client::IQueue< E >::removeItemListener ( const std::string &  registrationId)
inline

Removes the specified item listener.

Returns silently if the specified listener is not added before.

Parameters
registrationIdId of listener registration.
Returns
true if registration is removed, false otherwise

◆ retainAll()

template<typename E>
bool hazelcast::client::IQueue< E >::retainAll ( const std::vector< E > &  elements)
inline

Removes the elements from this queue 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.

◆ size()

template<typename E>
int hazelcast::client::IQueue< E >::size ( )
inline
Returns
size of this distributed queue

◆ take()

template<typename E>
boost::shared_ptr<E> hazelcast::client::IQueue< E >::take ( )
inline
Returns
the head of the queue. If queue is empty waits for an item to be added.

◆ toArray()

template<typename E>
std::vector<E> hazelcast::client::IQueue< E >::toArray ( )
inline
Returns
all elements as std::vector

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