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