Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

VrTestCountSource.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- 00002 * 00003 * Copyright 1997 Massachusetts Institute of Technology 00004 * 00005 * Permission to use, copy, modify, distribute, and sell this software and its 00006 * documentation for any purpose is hereby granted without fee, provided that 00007 * the above copyright notice appear in all copies and that both that 00008 * copyright notice and this permission notice appear in supporting 00009 * documentation, and that the name of M.I.T. not be used in advertising or 00010 * publicity pertaining to distribution of the software without specific, 00011 * written prior permission. M.I.T. makes no representations about the 00012 * suitability of this software for any purpose. It is provided "as is" 00013 * without express or implied warranty. 00014 * 00015 */ 00016 00017 00018 #ifndef _VRTESTCOUNTSOURCE_H_ 00019 #define _VRTESTCOUNTSOURCE_H_ 00020 00021 #include <VrSource.h> 00022 00023 template<class oType> 00024 class VrTestCountSource : public VrSource<oType> { 00025 public: 00026 virtual const char *name() { return "VrTestCountSource"; } 00027 virtual void work(timestamp ts, unsigned int size, oType *o[]); 00028 virtual void initialize(); 00029 }; 00030 00031 template<class oType> void 00032 VrTestCountSource<oType>::initialize() 00033 { 00034 setOutputSize (1); 00035 } 00036 00037 template<class oType> void 00038 VrTestCountSource<oType>::work(timestamp ts, unsigned int size, oType *o[]) 00039 { 00040 00041 sync(ts); //simulate sequential Source 00042 00043 while(size-- > 0) { 00044 //waste some time 00045 int n=ts; 00046 for(int i=0; i<25;i++) 00047 n += n % 13; 00048 00049 *o[0]++= (oType) ts++; 00050 } 00051 // fprintf ("%ld complete[%d]\n", ts, pthread_self()); 00052 } 00053 00054 #endif

Generated on Wed Aug 4 02:22:06 2004 for GNU Radio by doxygen 1.3.8