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

VrFakeGuppiSource.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- */
00002 /*
00003  * Copyright 2001 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 /*
00023  *  Copyright 1997 Massachusetts Institute of Technology
00024  * 
00025  *  Permission to use, copy, modify, distribute, and sell this software and its
00026  *  documentation for any purpose is hereby granted without fee, provided that
00027  *  the above copyright notice appear in all copies and that both that
00028  *  copyright notice and this permission notice appear in supporting
00029  *  documentation, and that the name of M.I.T. not be used in advertising or
00030  *  publicity pertaining to distribution of the software without specific,
00031  *  written prior permission.  M.I.T. makes no representations about the
00032  *  suitability of this software for any purpose.  It is provided "as is"
00033  *  without express or implied warranty.
00034  * 
00035  */
00036 
00037 
00038 #ifndef _VRFakeGuppiSOURCE_H_
00039 #define _VRFakeGuppiSOURCE_H_
00040 
00041 extern "C" {
00042 #include <sys/ioctl.h>
00043 #include <fcntl.h>
00044 #include <errno.h>
00045 #include <unistd.h>
00046 }
00047 
00048 #include <VrSource.h>
00049 
00050 template<class oType> 
00051 class VrFakeGuppiSource: public VrSource<oType> {
00052 protected:
00053   int bufferSize;
00054   int gupfd;
00055 public: 
00056   virtual const char *name() { return "VrFakeGuppiSource"; }
00057 
00058   virtual float memoryTouched() {
00059     return 0; //no outputs are cached
00060   }
00061   virtual int work2(VrSampleRange output, void *o[]);
00062   VrFakeGuppiSource(double sampling_freq);
00063 };
00064 
00065 template<class oType> int
00066 VrFakeGuppiSource<oType>::work2(VrSampleRange output, void *o[])
00067 {
00068   sync(output.index);
00069   return output.size;
00070 }
00071 
00072 template<class oType>
00073 VrFakeGuppiSource<oType>::VrFakeGuppiSource(double sampling_freq)
00074   :gupfd(-1)
00075 {
00076   // add a query here to find out what data type(s) the FakeGuppi supports
00077   // Defaults to char for now
00078   bufferSize = 20;
00079   setOutputSize (bufferSize*getpagesize()/sizeof(oType));
00080 } 
00081 #endif 

Generated on Tue Mar 30 21:31:52 2004 for GNU Radio by doxygen 1.3.2