Main Page | Namespace List | Compound List | File List | Compound Members | File Members

consumer.cc

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #include "consumer.h"
00012 #include <iostream>
00013 #include <assert.h>
00014 
00015 using namespace std;
00016 
00017 Consumer::Consumer(const Id& n, In<int>& i) :
00018   Process(n),
00019   in( id("in"), i)
00020 { }
00021 
00022 const char* Consumer::type() const
00023 {
00024   return "Consumer";
00025 }
00026 
00027 void Consumer::main()
00028 {
00029   int n,j;
00030 
00031   cout << "Consumer started" << endl;
00032 
00033   read(in, n);
00034 
00035   for (int i=0; i<n; i++)
00036   {
00037     read(in, j);
00038     assert(i==j);
00039   }
00040 
00041   cout << type() << " " << fullName() << ": "
00042        << n << " values read" << endl;
00043 
00044 }

Generated on Wed Feb 15 14:52:42 2006 for pc by doxygen 1.3.2