Hazelcast C++ Client
Public Member Functions | Friends | List of all members
hazelcast::client::mixedtype::IQueue Class Reference

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

#include <IQueue.h>

+ Inheritance diagram for hazelcast::client::mixedtype::IQueue:

Public Member Functions

std::string addItemListener (MixedItemListener &listener, bool includeValue)
 Adds an item listener for this collection. More...
 
bool removeItemListener (const std::string &registrationId)
 Removes the specified item listener. More...
 
template<typename E >
bool offer (const E &element)
 Inserts the specified element into this queue. More...
 
template<typename E >
void put (const E &element)
 Puts the element into queue. More...
 
template<typename E >
bool offer (const E &element, long timeoutInMillis)
 Inserts the specified element into this queue. More...
 
TypedData take ()
 
TypedData poll (long timeoutInMillis)
 
int remainingCapacity ()
 
template<typename E >
bool remove (const E &element)
 
template<typename E >
bool contains (const E &element)
 
size_t drainTo (std::vector< TypedData > &elements)
 Note that elements will be pushed_back to vector. More...
 
size_t drainTo (std::vector< TypedData > &elements, int64_t maxElements)
 Note that elements will be pushed_back to vector. More...
 
TypedData poll ()
 Returns immediately without waiting. More...
 
TypedData peek ()
 Returns immediately without waiting. More...
 
int size ()
 
bool isEmpty ()
 
std::vector< TypedDatatoArray ()
 
template<typename E >
bool containsAll (const std::vector< E > &elements)
 
template<typename E >
bool addAll (const std::vector< E > &elements)
 
template<typename E >
bool removeAll (const std::vector< E > &elements)
 
template<typename E >
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 client::impl::HazelcastClientInstanceImpl
 

Detailed Description

Concurrent, blocking, distributed, observable, client queue.

Member Function Documentation

◆ addAll()

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

std::string hazelcast::client::mixedtype::IQueue::addItemListener ( MixedItemListener listener,
bool  includeValue 
)

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::mixedtype::IQueue::contains ( const E &  element)
inline
Parameters
elementto be checked.
Returns
true if queue contains the element.

◆ containsAll()

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

size_t hazelcast::client::mixedtype::IQueue::drainTo ( std::vector< TypedData > &  elements)

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]

size_t hazelcast::client::mixedtype::IQueue::drainTo ( std::vector< TypedData > &  elements,
int64_t  maxElements 
)

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()

bool hazelcast::client::mixedtype::IQueue::isEmpty ( )
Returns
true if queue is empty

◆ offer() [1/2]

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

TypedData hazelcast::client::mixedtype::IQueue::peek ( )

Returns immediately without waiting.

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

◆ poll() [1/2]

TypedData hazelcast::client::mixedtype::IQueue::poll ( long  timeoutInMillis)
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]

TypedData hazelcast::client::mixedtype::IQueue::poll ( )

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::mixedtype::IQueue::put ( const E &  element)
inline

Puts the element into queue.

If queue is full waits for space to became available.

◆ remainingCapacity()

int hazelcast::client::mixedtype::IQueue::remainingCapacity ( )
Returns
remaining capacity

◆ remove()

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

◆ removeAll()

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

bool hazelcast::client::mixedtype::IQueue::removeItemListener ( const std::string &  registrationId)

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::mixedtype::IQueue::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()

int hazelcast::client::mixedtype::IQueue::size ( )
Returns
size of this distributed queue

◆ take()

TypedData hazelcast::client::mixedtype::IQueue::take ( )
Returns
the head of the queue. If queue is empty waits for an item to be added.

◆ toArray()

std::vector< TypedData > hazelcast::client::mixedtype::IQueue::toArray ( )
Returns
all elements as std::vector

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