00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "producer.h"
00012 #include <iostream>
00013 using namespace std;
00014
00015 Producer::Producer(const Id& n, Out<int>& o) :
00016 Process(n),
00017 out( id("out"), o)
00018 { }
00019
00020 const char* Producer::type() const
00021 {
00022 return "Producer";
00023 }
00024
00025 void Producer::main()
00026 {
00027 cout << "Producer started" << endl;
00028
00029 const int n = 1000;
00030
00031 write(out, n);
00032
00033 for (int i=0; i<n; i++)
00034 {
00035 write(out, i);
00036 }
00037
00038 cout << type() << " " << fullName() << ": "
00039 << n << " values written" << endl;
00040 }