Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generic FIFO queue ----------------------------------------------------------
- template<typename T>
- class queue {
- public:
- virtual ~queue() {}
- virtual void enqueue(const T& t) = 0;
- virtual void enqueue(T&& t) = 0;
- virtual T dequeue() = 0;
- };
- // Bounded queues --------------------------------------------------------------
- class upper_bounded_queue : public virtual queue {
- public:
- virtual bool full() = 0;
- };
- class lower_bounded_queue : public virtual queue {
- public:
- virtual bool empty() = 0;
- };
- class bounded_queue : public virtual upper_bounded_queue,
- public virtual lower_bounded_queue {}
- // Unbounded queues ------------------------------------------------------------
- class upper_unbounded_queue : public virtual upper_bounded_queue {
- public:
- virtual bool full() { return false; } final;
- };
- class lower_unbounded_queue : public virtual lower_bounded_queue {
- public:
- virtual bool empty() { return false; } final;
- };
- class unbounded_queue : public virtual bounded_queue,
- public virtual upper_bounded_queue,
- public virtual lower_bounded_queue {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement