[1738] | 1 | // ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
|
---|
| 2 | // Eric Aubourg
|
---|
| 3 | // Christophe Magneville
|
---|
| 4 | // Reza Ansari
|
---|
[1761] | 5 | // $Id: nooppr.cc,v 1.8 2001-11-13 16:14:43 aubourg Exp $
|
---|
[1738] | 6 |
|
---|
[1732] | 7 | #include <typeinfo>
|
---|
[1487] | 8 | #include "toimanager.h"
|
---|
| 9 | #include "nooppr.h"
|
---|
| 10 | // ----------------------------------------------------------------------
|
---|
| 11 | // Classe SimpleFourierFilter : Filtre simple ds le domaine de Fourier
|
---|
| 12 | // ----------------------------------------------------------------------
|
---|
| 13 |
|
---|
| 14 | NoOpProcessor::NoOpProcessor(int wsz)
|
---|
| 15 | {
|
---|
| 16 | wsize = wsz;
|
---|
| 17 | totnscount = 0;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 |
|
---|
[1761] | 22 | void NoOpProcessor::PrintStatus(std::ostream & os)
|
---|
[1487] | 23 | {
|
---|
| 24 | os << "\n ------------------------------------------------------ \n"
|
---|
| 25 | << " NoOpProcessor::PrintStatus() - WindowSize="
|
---|
| 26 | << WSize() << endl;
|
---|
[1488] | 27 | os << " Total number of processed samples= " << ProcessedSampleCount()
|
---|
| 28 | << endl;
|
---|
[1487] | 29 | TOIProcessor::PrintStatus(os);
|
---|
| 30 | os << " ------------------------------------------------------ " << endl;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | void NoOpProcessor::init() {
|
---|
| 34 | cout << "NoOpProcessor::init" << endl;
|
---|
| 35 | declareInput("in");
|
---|
[1488] | 36 | declareInput("in2");
|
---|
[1487] | 37 | declareOutput("out");
|
---|
[1488] | 38 | declareOutput("out2");
|
---|
[1487] | 39 | name = "NoOpProcessor";
|
---|
| 40 | // upExtra = 1;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | void NoOpProcessor::run() {
|
---|
| 45 | // TOIManager* mgr = TOIManager::getManager();
|
---|
| 46 | int snb = getMinIn();
|
---|
| 47 | int sne = getMaxIn();
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | if (!checkInputTOIIndex(0)) {
|
---|
| 51 | cerr << " NoOpProcessor::run() - Input TOI (in) not connected! "
|
---|
| 52 | << endl;
|
---|
| 53 | throw ParmError("NoOpProcessor::run() Input TOI (in) not connected!");
|
---|
| 54 | }
|
---|
[1488] | 55 | bool fgin2 = checkInputTOIIndex(1);
|
---|
[1487] | 56 |
|
---|
[1488] | 57 | bool fgout = checkOutputTOIIndex(0);
|
---|
| 58 | bool fgout2 = checkOutputTOIIndex(1);
|
---|
[1487] | 59 |
|
---|
[1488] | 60 | if (fgout2 && !fgin2) {
|
---|
| 61 | cerr << " NoOpProcessor::run() - out2 connected without in2!"
|
---|
| 62 | << endl;
|
---|
| 63 | throw ParmError("NoOpProcessor::run() out2 connected without in2!");
|
---|
| 64 | }
|
---|
[1487] | 65 | cout << " NoOpProcessor::run() SNRange=" << snb << " - " << sne << endl;
|
---|
| 66 |
|
---|
| 67 | double * vin = NULL;
|
---|
[1488] | 68 | double * vin2 = NULL;
|
---|
[1532] | 69 | uint_8 * vfg = NULL;
|
---|
| 70 | uint_8 * vfg2 = NULL;
|
---|
[1487] | 71 | try {
|
---|
| 72 | // Le debut
|
---|
| 73 | int k,i,klast;
|
---|
| 74 | klast = snb-1;
|
---|
| 75 | int totnbblock = 0;
|
---|
| 76 |
|
---|
| 77 | if (wsize > 1) {
|
---|
| 78 | vin = new double[wsize];
|
---|
[1532] | 79 | vfg = new uint_8[wsize];
|
---|
[1488] | 80 | if (fgin2) {
|
---|
| 81 | vin2 = new double[wsize];
|
---|
[1532] | 82 | vfg2 = new uint_8[wsize];
|
---|
[1488] | 83 | }
|
---|
[1487] | 84 |
|
---|
| 85 | // Boucle sur les sampleNum
|
---|
| 86 | // 1er partie, on traite par paquets de wsize
|
---|
| 87 | for(k=snb;k<=sne-wsize+1;k+=wsize) {
|
---|
[1488] | 88 | for(i=0; i<wsize; i++) {
|
---|
[1487] | 89 | getData(0, k+i, vin[i], vfg[i]);
|
---|
[1488] | 90 | if (fgin2)
|
---|
| 91 | getData(1, k+i, vin2[i], vfg2[i]);
|
---|
| 92 | }
|
---|
[1487] | 93 | totnbblock++;
|
---|
| 94 | for(i=0; i<wsize; i++) {
|
---|
| 95 | if (fgout)
|
---|
[1488] | 96 | putData(0,k+i,vin[i],vfg[i]);
|
---|
| 97 | if (fgout2)
|
---|
| 98 | putData(1, k+i, vin2[i], vfg2[i]);
|
---|
[1487] | 99 | }
|
---|
[1488] | 100 | klast+=wsize;
|
---|
[1489] | 101 | totnscount+=wsize;
|
---|
[1487] | 102 | }
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | // 2eme partie, on traite la fin du bloc d'echantillons si necessaire
|
---|
| 106 | double inval;
|
---|
[1532] | 107 | uint_8 inflg;
|
---|
[1487] | 108 | if (klast < sne)
|
---|
| 109 | for(k=klast+1; k<=sne; k++) {
|
---|
| 110 | getData(0, k, inval, inflg);
|
---|
| 111 | if (fgout) putData(0, k, inval, inflg);
|
---|
[1488] | 112 | if (fgin2) {
|
---|
| 113 | getData(1, k, inval, inflg);
|
---|
| 114 | if (fgout2)
|
---|
| 115 | putData(1, k, inval, inflg);
|
---|
| 116 | }
|
---|
[1487] | 117 | totnscount++;
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | totnbblock++;
|
---|
| 121 |
|
---|
| 122 | cout << " NoOpProcessor::run() - End of processing "
|
---|
[1501] | 123 | << " TotNbBlocks= " << totnbblock << endl;
|
---|
[1487] | 124 | } // Bloc try
|
---|
| 125 |
|
---|
| 126 | catch (PException & exc) {
|
---|
| 127 | cerr << "NoOpProcessor: Catched Exception " << (string)typeid(exc).name()
|
---|
| 128 | << "\n .... Msg= " << exc.Msg() << endl;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | if (vin) delete[] vin;
|
---|
| 132 | if (vfg) delete[] vfg;
|
---|
[1488] | 133 | if (vin2) delete[] vin2;
|
---|
| 134 | if (vfg2) delete[] vfg2;
|
---|
[1487] | 135 |
|
---|
| 136 | }
|
---|