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