// Queue.h
// doxygen comments are needed in this
//
// Queue class
// Version
// Nicola Ritter
// modified smr
// Encapsulates the STL queue, to provide a minimal and complete queue.
//——————————————-
#ifndef MY_QUEUE
#define MY_QUEUE
//——————————————-
#include
#include
using namespace std;
//——————————————-
template
class Queue
{
public:
Queue () {};
~Queue () {};
bool Enqueue(const T &data);
bool Dequeue (T &data);
bool Empty () {return m_queue.empty();}
private:
queue
};
//——————————————-
// It is a template, so we have to put all the code
// in the header file
//——————————————-
template
bool Queue
{
bool okay = true;
try
{
m_queue.push(data);
}
catch (…)
{
okay = false;
}
return okay;
}
//——————————————-
template
bool Queue
{
if (m_queue.size() > 0)
{
data = m_queue.front();
m_queue.pop();
return true;
}
else
{
return false;
}
}
//——————————————-
#endif