00001 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef TDSPBLOCKFIFO_H 00019 #define TDSPBLOCKFIFO_H 00020 00021 #include <TDSPFifo.h> 00022 #include <TDSPOutput1.h> 00023 00032 class TDSPBlockFifo : public TDSPOutput1, public TDSPFifo { 00033 00034 friend class TDSPFifoFilter; 00035 00036 protected: 00037 00038 Int_t fWidth; // 00039 00040 public: 00041 00042 TDSPBlockFifo(char *name = NULL); 00043 ~TDSPBlockFifo(); 00044 00045 TComplex *GetBlock(Int_t i=0) { return &fBlock[i*fWidth];}; 00046 00047 void SetDepth(Int_t depth); 00048 void SetSize(Int_t width, Int_t depth); 00049 Int_t GetWidth() { return fWidth;}; 00050 00051 TDSPSignal *Shift(TDSPSignal *input = NULL, TDSPSignal *output = NULL); 00052 00053 // Slots 00054 00055 TDSPSignal *Update(TDSPSignal *input) { 00056 TDSPSignal *output=Shift(input,GetSignal()); 00057 Emit("Update(TDSPSignal*)",output); 00058 return output; 00059 } 00060 00061 ClassDef(TDSPBlockFifo,1) 00062 00063 }; 00064 00065 inline TDSPSignal *TDSPBlockFifo::Shift(TDSPSignal *input, TDSPSignal *output) { 00066 00067 register Int_t i; 00068 00069 Int_t iLen = 0; 00070 TComplex *ivec = NULL; 00071 00072 if (input) { 00073 iLen = input->GetLen(); 00074 ivec = input->GetVec(); 00075 00076 // Use only fWidth values of the input Signal 00077 // 00078 if (iLen>fWidth) iLen = fWidth; 00079 00080 } 00081 00083 // 00084 // Copy 00085 // 00086 TComplex *ovec = GetBlock(fIndex); 00087 00088 00089 for(i=0; i<iLen; i++) ovec[i] = ivec[i]; 00090 for( ;i<fWidth;i++) ovec[i] = 0; 00091 00092 // Increase the Index cyclic 00093 // 00094 Next(); 00095 00096 // Update the Fill Status 00097 // 00098 Fill(); 00099 00100 // Checking Fill Status of the Fifo 00101 // 00102 if (WasFull()) { 00103 00104 // Set the Output Signal (if given) 00105 // 00106 if (output) output->SetVec(GetBlock(fIndex),fWidth); 00107 00108 } else 00109 output = NULL; 00110 00111 00112 return output; 00113 00114 } 00115 00116 00117 #endif
1.3.2