00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _AggregateOutput_
00022 #define _AggregateOutput_
00023
00024 #include "Mutex.h"
00025 #include "OutputControl.h"
00026 #include "OutputTask.h"
00027
00028 #include <algorithm>
00029 #include <vector>
00030
00031 namespace qpid {
00032 namespace sys {
00033
00034 class AggregateOutput : public OutputTask, public OutputControl
00035 {
00036 typedef std::vector<OutputTask*> TaskList;
00037
00038 TaskList tasks;
00039 size_t next;
00040 OutputControl& control;
00041
00042 public:
00043 AggregateOutput(OutputControl& c) : next(0), control(c) {};
00044
00045 void activateOutput();
00046
00047 bool doOutput();
00048 bool hasOutput();
00049 void addOutputTask(OutputTask* t);
00050 void removeOutputTask(OutputTask* t);
00051
00053 template <class F> void eachOutput(F f) {
00054 std::for_each(tasks.begin(), tasks.end(), f);
00055 }
00056 };
00057
00058 }
00059 }
00060
00061
00062 #endif