| 1 | /* -*- C++ -*- |
| 2 | This file is part of ThreadWeaver, a KDE framework. |
| 3 | |
| 4 | SPDX-FileCopyrightText: 2013 Mirko Boehm <mirko@kde.org> |
| 5 | |
| 6 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #ifndef QUEUESTREAM_H |
| 10 | #define QUEUESTREAM_H |
| 11 | |
| 12 | #include "jobinterface.h" |
| 13 | #include "threadweaver_export.h" |
| 14 | |
| 15 | namespace ThreadWeaver |
| 16 | { |
| 17 | class Queue; |
| 18 | class Job; |
| 19 | |
| 20 | /*! |
| 21 | * \class ThreadWeaver::QueueStream |
| 22 | * \inheaderfile ThreadWeaver/QueueStream |
| 23 | * \inmodule ThreadWeaver |
| 24 | * |
| 25 | * \brief QueueStream implements a stream based API to access ThreadWeaver queues. |
| 26 | */ |
| 27 | class THREADWEAVER_EXPORT QueueStream |
| 28 | { |
| 29 | public: |
| 30 | /*! |
| 31 | */ |
| 32 | explicit QueueStream(Queue *queue); |
| 33 | /*! |
| 34 | */ |
| 35 | ~QueueStream(); |
| 36 | /*! |
| 37 | */ |
| 38 | void add(const JobPointer &job); |
| 39 | /*! |
| 40 | */ |
| 41 | void flush(); |
| 42 | |
| 43 | /*! |
| 44 | */ |
| 45 | QueueStream &operator<<(const JobPointer &job); |
| 46 | /*! |
| 47 | */ |
| 48 | QueueStream &operator<<(JobInterface *job); |
| 49 | // FIXME try with QObjectDecorator (JobInterface&) |
| 50 | /*! |
| 51 | */ |
| 52 | QueueStream &operator<<(Job &job); |
| 53 | |
| 54 | private: |
| 55 | class Private; |
| 56 | Private *const d; |
| 57 | }; |
| 58 | |
| 59 | QueueStream THREADWEAVER_EXPORT stream(); |
| 60 | |
| 61 | } |
| 62 | |
| 63 | #endif // QUEUESTREAM_H |
| 64 | |