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

VrHistoryProc.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 _VRHISTORYPROC_H_ 00019 #define _VRHISTORYPROC_H_ 00020 00021 #include <VrSigProc.h> 00022 00023 // VrSigProc with history. Set the history variable in initialize() 00024 // to the maximum history that will ever be needed. 00025 template<class iType, class oType> 00026 class VrHistoryProc : public VrSigProc { 00027 protected: 00028 unsigned int history; 00029 00030 public: 00031 VrHistoryProc(int outputs) : VrSigProc(outputs, sizeof(iType), sizeof(oType)), history(1) {} 00032 virtual int forecast(VrSampleRange output, 00033 VrSampleRange inputs[]); 00034 virtual unsigned int mapSizeUp(int i, unsigned int size); 00035 virtual ~VrHistoryProc() {} 00036 }; 00037 00038 template<class iType,class oType> int 00039 VrHistoryProc<iType,oType>::forecast(VrSampleRange output, 00040 VrSampleRange inputs[]) { 00041 /* 1:1 ratio with history */ 00042 for(unsigned int i=0;i<numberInputs;i++) { 00043 inputs[i].index=output.index; /* ! do not subtract history ! */ 00044 inputs[i].size=output.size + history-1; 00045 } 00046 return 0; 00047 } 00048 00049 template<class iType,class oType> unsigned int 00050 VrHistoryProc<iType,oType>::mapSizeUp(int i, unsigned int size) { 00051 return (unsigned int) (size * 00052 (getUpstreamModuleN(i)->getSamplingFrequency() 00053 /getSamplingFrequency())+history-1); 00054 } 00055 #endif

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