Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Aws::DataFlow::ObservedBlockingQueue< T, Allocator > Class Template Reference

#include <observed_queue.h>

Inheritance diagram for Aws::DataFlow::ObservedBlockingQueue< T, Allocator >:
Inheritance graph
[legend]

Public Member Functions

void clear () override
 
bool dequeue (T &data, const std::chrono::microseconds &duration) override
 
bool empty () const override
 
bool enqueue (T &&value) override
 
bool enqueue (T &value) override
 
 ObservedBlockingQueue (const size_t &max_queue_size)
 
size_t size () const override
 
bool tryEnqueue (T &value, const std::chrono::microseconds &duration) override
 
bool tryEnqueue (T &&value, const std::chrono::microseconds &duration) override
 
 ~ObservedBlockingQueue () override=default
 
- Public Member Functions inherited from Aws::DataFlow::ObservedQueue< T, Allocator >
void setStatusMonitor (std::shared_ptr< StatusMonitor > status_monitor) override
 
 ~ObservedQueue () override=default
 
- Public Member Functions inherited from Aws::DataFlow::Source< T >
virtual ~Source ()=default
 

Private Types

using OQ = ObservedQueue< T, Allocator >
 
using WaitFunc = std::function< std::cv_status(std::unique_lock< std::mutex > &)>
 

Private Member Functions

bool enqueueOnCondition (T &value, const WaitFunc &wait_func)
 

Static Private Member Functions

static std::cv_status wait (std::condition_variable &condition_variable, std::unique_lock< std::mutex > &lock)
 

Private Attributes

std::condition_variable condition_variable_
 
std::mutex dequeue_mutex_
 
size_t max_queue_size_
 

Additional Inherited Members

- Protected Member Functions inherited from Aws::DataFlow::ObservedQueue< T, Allocator >
void notifyMonitor (const Status &status)
 
- Protected Attributes inherited from Aws::DataFlow::ObservedQueue< T, Allocator >
std::deque< T, Allocator > dequeue_
 
std::shared_ptr< StatusMonitorstatus_monitor_
 

Detailed Description

template<class T, class Allocator = std::allocator<T>>
class Aws::DataFlow::ObservedBlockingQueue< T, Allocator >

An observed queue is a dequeue wrapper which notifies an observer when a task is added.

Template Parameters
Ttype of data
Allocator

Definition at line 283 of file observed_queue.h.

Member Typedef Documentation

template<class T, class Allocator = std::allocator<T>>
using Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::OQ = ObservedQueue<T, Allocator>
private

Definition at line 394 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
using Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::WaitFunc = std::function <std::cv_status (std::unique_lock<std::mutex>&)>
private

Definition at line 395 of file observed_queue.h.

Constructor & Destructor Documentation

template<class T, class Allocator = std::allocator<T>>
Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::ObservedBlockingQueue ( const size_t &  max_queue_size)
inlineexplicit

Create an observed blocking queue.

Parameters
max_queue_sizeto configure.
Exceptions
std::invalid_argumentmax_queue_size is 0

Definition at line 292 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::~ObservedBlockingQueue ( )
overridedefault

Member Function Documentation

template<class T, class Allocator = std::allocator<T>>
void Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::clear ( )
inlineoverridevirtual

Clear the dequeue

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 388 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
bool Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::dequeue ( T &  data,
const std::chrono::microseconds &  duration 
)
inlineoverridevirtual

Dequeue data and notify the observer of data unavailable if the queue is empty.

Returns
the front of the dequeue

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 360 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
bool Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::empty ( ) const
inlineoverridevirtual
Returns
true if the queue is empty

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 372 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
bool Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::enqueue ( T &&  value)
inlineoverridevirtual

Enqueue data and notify the observer of data available.

Parameters
valueto enqueue

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 305 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
bool Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::enqueue ( T &  value)
inlineoverridevirtual

Enqueue data and notify the observer of data available.

Parameters
valueto enqueue

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 316 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
bool Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::enqueueOnCondition ( T &  value,
const WaitFunc wait_func 
)
inlineprivate

Enqueue on the condition variable.

Parameters
valueto enqueue
wait_functo wait for availability
Returns
true if the value was enqueued

Definition at line 419 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
size_t Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::size ( ) const
inlineoverridevirtual
Returns
the size of the queue

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 380 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
bool Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::tryEnqueue ( T &  value,
const std::chrono::microseconds &  duration 
)
inlineoverridevirtual

Blocking call.

Parameters
value
duration
Returns

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 333 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
bool Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::tryEnqueue ( T &&  value,
const std::chrono::microseconds &  duration 
)
inlineoverridevirtual

Reimplemented from Aws::DataFlow::ObservedQueue< T, Allocator >.

Definition at line 344 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
static std::cv_status Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::wait ( std::condition_variable &  condition_variable,
std::unique_lock< std::mutex > &  lock 
)
inlinestaticprivate

Static wait function which returns no_timeout on completion.

Parameters
condition_variable
lock
Returns
std::cv_status::no_timeout

Definition at line 404 of file observed_queue.h.

Member Data Documentation

template<class T, class Allocator = std::allocator<T>>
std::condition_variable Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::condition_variable_
private

Definition at line 434 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
std::mutex Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::dequeue_mutex_
mutableprivate

Definition at line 435 of file observed_queue.h.

template<class T, class Allocator = std::allocator<T>>
size_t Aws::DataFlow::ObservedBlockingQueue< T, Allocator >::max_queue_size_
private

Definition at line 433 of file observed_queue.h.


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


dataflow_lite
Author(s): AWS RoboMaker
autogenerated on Fri May 7 2021 02:18:22