BlockingQueue.hpp
Go to the documentation of this file.
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_CONTAINER__BLOCKING_QUEUE
18 #define COM_BORA_SOFTWARE__BALAU_CONTAINER__BLOCKING_QUEUE
19 
21 
22 #include <chrono>
23 
24 namespace Balau::Container {
25 
29 template <typename T> class BlockingQueue : public Queue<T> {
35  public: virtual void enqueue(T && element) = 0;
36 
40  public: virtual T dequeue() = 0;
41 
47  public: virtual T tryDequeue() = 0;
48 
54  public: virtual T tryDequeue(std::chrono::milliseconds waitTime) = 0;
55 
61  public: virtual bool full() const = 0;
62 
68  public: virtual bool empty() const = 0;
69 };
70 
71 } // namespace Balau::Container
72 
73 #endif // COM_BORA_SOFTWARE__BALAU_CONTAINER__BLOCKING_QUEUE
Base interface for queues.
Definition: Queue.hpp:27
Base interface for queues.
virtual bool empty() const =0
Returns true if the queue is empty.
Various container classes, apart from interprocess containers.
Definition: ArrayBlockingQueue.hpp:25
Base interface for blocking queues.
Definition: BlockingQueue.hpp:29
virtual T tryDequeue()=0
Try to dequeue an object.
virtual bool full() const =0
Returns true if the queue is full.
virtual void enqueue(T &&element)=0
Enqueue an object, waiting for space to be available if the queue is full.
virtual T dequeue()=0
Dequeue an object, waiting for an object to become available if the queue is empty.