SpectrumAdder.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _SPECTRUM_ADDER_
00023 #define _SPECTRUM_ADDER_
00024
00025 #include "Processing.hxx"
00026 #include "DynamicType.hxx"
00027 #include "InPort.hxx"
00028 #include "OutPort.hxx"
00029
00030 #include "Spectrum.hxx"
00031
00032 namespace CLAM {
00033
00034
00035 class SpecAdderConfig: public ProcessingConfig
00036 {
00037 public:
00038 DYNAMIC_TYPE_USING_INTERFACE (SpecAdderConfig, 1,ProcessingConfig);
00039 DYN_ATTRIBUTE (0, public, int, NInputs);
00040 protected:
00041 void DefaultInit();
00042
00043 };
00044
00076 class SpectrumAdder: public Processing {
00077 SpecAdderConfig mConfig;
00078
00080 int mSize;
00081
00083 int mNInputs;
00084
00088 InPort<Spectrum> **mInputs;
00089
00092 Complex **complex_bufs;
00093 Polar **polar_bufs;
00094 TData **mag_bufs;
00095 TData **phase_bufs;
00096 bool *remove;
00097
00098 OutPort<Spectrum> mOut;
00099
00101 typedef enum {
00102
00103
00104
00105
00106 SMagPhase, SComplex, SPolar,
00107
00108
00109 ShasBPF,
00110
00111
00112 SOther
00113 } PrototypeState;
00114
00116 typedef enum { Slin, Slog} ScaleState;
00117
00119 PrototypeState mProtoState;
00121 ScaleState mScaleState;
00122
00124 std::string NewUniqueName();
00125
00126 const char *GetClassName() const {return "SpectrumAdder";}
00127
00131 bool ConcreteConfigure(const ProcessingConfig&);
00132
00133 public:
00134 SpectrumAdder();
00135
00136 SpectrumAdder(const SpecAdderConfig &c);
00137
00138 ~SpectrumAdder();
00139
00140 const ProcessingConfig &GetConfig() const { return mConfig;}
00141
00142 bool Do(void);
00143
00144 bool Do(Spectrum **inputs, Spectrum& out);
00145
00146
00147
00154 bool SetPrototypes(Spectrum **inputs,const Spectrum& out);
00155
00156 bool SetPrototypes();
00157
00158 bool UnsetPrototypes();
00159
00160 bool MayDisableExecution() const {return true;}
00161
00162 private:
00163
00167 inline void Add(Spectrum **inputs, Spectrum& out);
00168
00169
00170
00171
00172 inline void AddMagPhase(Spectrum **inputs, Spectrum& out);
00173 inline void AddMagPhaseLin(Spectrum **inputs, Spectrum& out);
00174 inline void AddMagPhaseLog(Spectrum **inputs, Spectrum& out);
00175 inline void AddComplex(Spectrum **inputs, Spectrum& out);
00176 inline void AddComplexLin(Spectrum **inputs, Spectrum& out);
00177 inline void AddComplexLog(Spectrum **inputs, Spectrum& out);
00178 inline void AddPolar(Spectrum **inputs, Spectrum& out);
00179 inline void AddPolarLin(Spectrum **inputs, Spectrum& out);
00180 inline void AddPolarLog(Spectrum **inputs, Spectrum& out);
00181 };
00182
00183 }
00184
00185 #endif // _SPECTRUM_ADDER_
00186