ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

queue.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef COMMON_QUEUE_H
00024 #define COMMON_QUEUE_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/list.h"
00028 
00029 namespace Common {
00030 
00034 template<class T>
00035 class Queue {
00036 //public:
00037 //  typedef T value_type;
00038 
00039 public:
00040     Queue<T>() : _impl() {}
00041     Queue<T>(const Queue<T> &queue) : _impl(queue._impl) {}
00042 
00043     bool empty() const {
00044         return _impl.empty();
00045     }
00046 
00047     void clear() {
00048         _impl.clear();
00049     }
00050 
00051     void push(const T &x) {
00052         _impl.push_back(x);
00053     }
00054 
00055     T &front() {
00056         return _impl.front();
00057     }
00058 
00059     const T &front() const {
00060         return _impl.front();
00061     }
00062 
00063     T &back() {
00064         return _impl.back();
00065     }
00066 
00067     const T &back() const {
00068         return _impl.back();
00069     }
00070 
00071     T pop() {
00072         T tmp = front();
00073         _impl.pop_front();
00074         return tmp;
00075     }
00076 
00077     int size() const {
00078         return _impl.size();
00079     }
00080 
00081 private:
00082     List<T> _impl;
00083 };
00084 
00085 } // End of namespace Common
00086 
00087 #endif


Generated on Sat Mar 23 2019 05:01:59 for ResidualVM by doxygen 1.7.1
curved edge   curved edge