Member Functions for Queue ADT - List Based Implementation
// ******************************************************** // Implementation file Queuelst.cpp for the ADT queue. // ADT list implementation. // ******************************************************** #include "Queuelst.h" // header file Queue::Queue() { } // end default constructor Queue::Queue(Queue& Q): L(Q.L) { } // end copy constructor Queue::~Queue() { } // end destructor int Queue::isEmpty() { return (L.length() == 0); } // end isEmpty int Queue::insert(queueItemType NewItem) { int Success = L.insert(L.length()+1, NewItem); return Success; } // end insert int Queue::del() { int Success = L.del(1); // Assertion: If list was empty at entry, Success is false. return Success; } // end del int Queue::del(queueItemType& QueueFront) { int Success = L.retrieve(1, QueueFront); if (Success) Success = L.del(1); // Assertion: If list was empty at entry, Success is false. return Success; } // end del int Queue::getFront(queueItemType& QueueFront) { int Success = L.retrieve(1, QueueFront); // Assertion: If list was empty at entry, Success is false. return Success; } // end getFront // End of implementation file.
Email Me | Office Hours | My Home Page | Department Home | MCC Home Page