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