File indexing completed on 2024-04-21 04:21:08

0001 /* SPDX-FileCopyrightText: 2012 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #ifndef BACKGROUNDTASKMANAGER_PRIORITYQUEUE_H
0007 #define BACKGROUNDTASKMANAGER_PRIORITYQUEUE_H
0008 
0009 #include "Priority.h"
0010 
0011 #include <QQueue>
0012 #include <QVector>
0013 
0014 namespace BackgroundTaskManager
0015 {
0016 
0017 class JobInterface;
0018 
0019 class PriorityQueue
0020 {
0021 public:
0022     PriorityQueue();
0023     bool isEmpty() const;
0024     int count() const;
0025     void enqueue(JobInterface *job, Priority priority);
0026     JobInterface *dequeue();
0027     JobInterface *peek(int index) const;
0028     bool hasForegroundTasks() const;
0029 
0030 private:
0031     typedef QQueue<JobInterface *> QueueType;
0032     QVector<QueueType> m_jobs;
0033 };
0034 
0035 } // namespace BackgroundTaskManager
0036 
0037 #endif // BACKGROUNDTASKMANAGER_PRIORITYQUEUE_H
0038 // vi:expandtab:tabstop=4 shiftwidth=4: