Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 1 | /** |
Jon Medhurst | b1d0744 | 2015-05-08 12:04:18 +0100 | [diff] [blame] | 2 | * Copyright (C) ARM Limited 2010-2015. All rights reserved. |
Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #ifndef SOURCE_H |
| 10 | #define SOURCE_H |
| 11 | |
| 12 | #include <pthread.h> |
| 13 | |
| 14 | class Sender; |
| 15 | |
| 16 | class Source { |
| 17 | public: |
| 18 | Source(); |
| 19 | virtual ~Source(); |
| 20 | |
| 21 | virtual bool prepare() = 0; |
| 22 | void start(); |
| 23 | virtual void run() = 0; |
| 24 | virtual void interrupt() = 0; |
| 25 | void join(); |
| 26 | |
| 27 | virtual bool isDone() = 0; |
| 28 | virtual void write(Sender *sender) = 0; |
| 29 | |
| 30 | private: |
| 31 | static void *runStatic(void *arg); |
| 32 | |
| 33 | pthread_t mThreadID; |
| 34 | |
| 35 | // Intentionally undefined |
| 36 | Source(const Source &); |
| 37 | Source &operator=(const Source &); |
| 38 | }; |
| 39 | |
| 40 | #endif // SOURCE_H |