File indexing completed on 2024-04-28 04:01:23

0001 /* -*- C++ -*-
0002     This file is part of ThreadWeaver, a KDE framework.
0003 
0004     SPDX-FileCopyrightText: 2013 Mirko Boehm <mirko@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef QUEUESTREAM_H
0010 #define QUEUESTREAM_H
0011 
0012 #include "jobinterface.h"
0013 #include "threadweaver_export.h"
0014 
0015 namespace ThreadWeaver
0016 {
0017 class Queue;
0018 class Job;
0019 
0020 /** @brief QueueStream implements a stream based API to access ThreadWeaver queues. */
0021 class THREADWEAVER_EXPORT QueueStream
0022 {
0023 public:
0024     explicit QueueStream(Queue *queue);
0025     ~QueueStream();
0026     void add(const JobPointer &job);
0027     void flush();
0028 
0029     QueueStream &operator<<(const JobPointer &job);
0030     QueueStream &operator<<(JobInterface *job);
0031     // FIXME try with QObjectDecorator (JobInterface&)
0032     QueueStream &operator<<(Job &job);
0033 
0034 private:
0035     class Private;
0036     Private *const d;
0037 };
0038 
0039 QueueStream THREADWEAVER_EXPORT stream();
0040 
0041 }
0042 
0043 #endif // QUEUESTREAM_H