Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

GrCircularSink.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2002 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 #ifndef _GRCIRCULARSINK_H_
00023 #define _GRCIRCULARSINK_H_
00024 
00025 /*
00026  * diagnostic helper to track down problem in MC4020 driver
00027  * writes input samples into a circular buffer.
00028  */
00029 
00030 #include <VrSink.h>
00031 #include <gr_circular_file.h>
00032 
00033 
00034 template <class iType>
00035 class GrCircularSink : public VrSink<iType>
00036 {
00037 private:
00038   gr_circular_file      *d_circ_file;
00039   
00040 public:
00041   GrCircularSink (const char *filename, int buffersize_in_bytes){
00042     d_circ_file = new gr_circular_file (filename, true, buffersize_in_bytes);
00043   }
00044 
00045   ~GrCircularSink () {
00046     delete d_circ_file;
00047   }
00048 
00049   const char *name () { return "GrCircularSink.h"; }
00050 
00051   virtual int work3 (VrSampleRange output, 
00052                      VrSampleRange inputs[], void *ai[]){
00053 
00054     iType *in = ((iType **) ai)[0];
00055 
00056     d_circ_file->write (in, output.size * sizeof (iType));
00057     return output.size;
00058   }
00059 };
00060 
00061 
00062 
00063 #endif /* _GRCIRCULARSINK_H_ */

Generated on Fri Sep 16 00:17:54 2005 for GNU Radio 2.x by  doxygen 1.4.4