// ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL // Eric Aubourg // Christophe Magneville // Reza Ansari // $Id: nooppr.cc,v 1.11 2002-05-31 08:10:58 ansari Exp $ #include #include "toimanager.h" #include "nooppr.h" // ---------------------------------------------------------------------- // Classe SimpleFourierFilter : Filtre simple ds le domaine de Fourier // ---------------------------------------------------------------------- NoOpProcessor::NoOpProcessor(int wsz) { if (wsz < 1) wsz = 1; wsize = wsz; delay2 = false; totnscount = 0; } void NoOpProcessor::PrintStatus(::ostream & os) { os << "\n ------------------------------------------------------ \n" << " NoOpProcessor::PrintStatus() - WindowSize=" << WSize(); if (delay2) os << " Delay in2 ---> out2 " << endl; else os << endl; os << " Total number of processed samples= " << ProcessedSampleCount() << endl; TOIProcessor::PrintStatus(os); os << " ------------------------------------------------------ " << endl; } void NoOpProcessor::init() { cout << "NoOpProcessor::init" << endl; declareInput("in"); declareInput("in2"); declareOutput("out"); declareOutput("out2"); name = "NoOpProcessor"; // upExtra = 1; } void NoOpProcessor::run() { // TOIManager* mgr = TOIManager::getManager(); int snb = getMinIn(); int sne = getMaxIn(); if (!checkInputTOIIndex(0) && !checkInputTOIIndex(1) && !checkOutputTOIIndex(0) && !checkOutputTOIIndex(1) ) { cerr << " NoOpProcessor::run() - No TOI connected! " << endl; throw ParmError("NoOpProcessor::run() No TOI connected!"); } if (!acceptnoinput && !checkInputTOIIndex(0)) { cerr << " NoOpProcessor::run() - Input TOI (in) not connected! " << endl; throw ParmError("NoOpProcessor::run() Input TOI (in) not connected!"); } bool fgin = checkInputTOIIndex(0); bool fgin2 = checkInputTOIIndex(1); bool fgout = checkOutputTOIIndex(0); bool fgout2 = checkOutputTOIIndex(1); if (fgout2 && (!fgin2 && !acceptnoinput) ) { cerr << " NoOpProcessor::run() - out2 connected without in2!" << endl; throw ParmError("NoOpProcessor::run() out2 connected without in2!"); } cout << " NoOpProcessor::run() SNRange=" << snb << " - " << sne << endl; double * vin = NULL; double * vin2 = NULL; uint_8 * vfg = NULL; uint_8 * vfg2 = NULL; try { // Le debut int k,i,klast; klast = snb-1; int totnbblock = 0; if (wsize > 1) { vin = new double[wsize]; vfg = new uint_8[wsize]; for(i=0; i 1)) { int kd2o = (delay2) ? (kd2+1)%2 : 0; int nextk2o = (delay2) ? lastk2in-wsize : lastk2in; putData(1, nextk2o, wsize, vin2+kd2o*wsize, vfg2+kd2o*wsize); } klast+=wsize; totnscount+=wsize; totnbblock++; } if (fgout2 && delay2) { int kd2o = (kd2+1)%2; putData(1, lastk2in, wsize, vin2+kd2o*wsize, vfg2+kd2o*wsize); } } // 2eme partie, on traite la fin du bloc d'echantillons si necessaire double inval = defval;; uint_8 inflg = defflag; double inval2 = defval;; uint_8 inflg2 = defflag; if (klast < sne) for(k=klast+1; k<=sne; k++) { if (fgin) getData(0, k, inval, inflg); if (fgout) putData(0, k, inval, inflg); if (fgin2) getData(1, k, inval2, inflg2); if (fgout2) putData(1, k, inval2, inflg2); totnscount++; } totnbblock++; cout << " NoOpProcessor::run() - End of processing " << " TotNbBlocks= " << totnbblock << " ProcSamples=" << totnscount << endl; } // Bloc try catch (PException & exc) { cerr << "NoOpProcessor: Catched Exception " << (string)typeid(exc).name() << "\n .... Msg= " << exc.Msg() << endl; } if (vin) delete[] vin; if (vfg) delete[] vfg; if (vin2) delete[] vin2; if (vfg2) delete[] vfg2; }