Files
qad/_oldpip/pip_0.4.0_r5/piqueue.h
Бычков Андрей ba8bc27298 1
git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
2015-02-28 21:28:53 +00:00

42 lines
1.4 KiB
C++

/*! \file picontainers.h
* \brief Queue container
*
* This file declare PIQueue
*/
/*
PIP - Platform Independent Primitives
Queue container
Copyright (C) 2014 Ivan Pelipenko peri4ko@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIQUEUE_H
#define PIQUEUE_H
#include "pivector.h"
template<typename T>
class PIP_EXPORT PIQueue: public PIVector<T> {
public:
PIQueue() {;}
PIVector<T> & enqueue(const T & v) {PIVector<T>::push_front(v); return *this;}
T dequeue() {return PIVector<T>::take_back();}
T & head() {return PIVector<T>::back();}
const T & head() const {return PIVector<T>::back();}
PIVector<T> toVector() {PIVector<T> v(PIVector<T>::size()); for (uint i = 0; i < PIVector<T>::size(); ++i) v[i] = PIVector<T>::at(i); return v;}
};
#endif // PIQUEUE_H