1 | #include <typeinfo>
|
---|
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;
|
---|
21 | os << " Total number of processed samples= " << ProcessedSampleCount()
|
---|
22 | << endl;
|
---|
23 | TOIProcessor::PrintStatus(os);
|
---|
24 | os << " ------------------------------------------------------ " << endl;
|
---|
25 | }
|
---|
26 |
|
---|
27 | void NoOpProcessor::init() {
|
---|
28 | cout << "NoOpProcessor::init" << endl;
|
---|
29 | declareInput("in");
|
---|
30 | declareInput("in2");
|
---|
31 | declareOutput("out");
|
---|
32 | declareOutput("out2");
|
---|
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 | }
|
---|
49 | bool fgin2 = checkInputTOIIndex(1);
|
---|
50 |
|
---|
51 | bool fgout = checkOutputTOIIndex(0);
|
---|
52 | bool fgout2 = checkOutputTOIIndex(1);
|
---|
53 |
|
---|
54 | if (fgout2 && !fgin2) {
|
---|
55 | cerr << " NoOpProcessor::run() - out2 connected without in2!"
|
---|
56 | << endl;
|
---|
57 | throw ParmError("NoOpProcessor::run() out2 connected without in2!");
|
---|
58 | }
|
---|
59 | cout << " NoOpProcessor::run() SNRange=" << snb << " - " << sne << endl;
|
---|
60 |
|
---|
61 | double * vin = NULL;
|
---|
62 | double * vin2 = NULL;
|
---|
63 | uint_8 * vfg = NULL;
|
---|
64 | uint_8 * vfg2 = NULL;
|
---|
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];
|
---|
73 | vfg = new uint_8[wsize];
|
---|
74 | if (fgin2) {
|
---|
75 | vin2 = new double[wsize];
|
---|
76 | vfg2 = new uint_8[wsize];
|
---|
77 | }
|
---|
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) {
|
---|
82 | for(i=0; i<wsize; i++) {
|
---|
83 | getData(0, k+i, vin[i], vfg[i]);
|
---|
84 | if (fgin2)
|
---|
85 | getData(1, k+i, vin2[i], vfg2[i]);
|
---|
86 | }
|
---|
87 | totnbblock++;
|
---|
88 | for(i=0; i<wsize; i++) {
|
---|
89 | if (fgout)
|
---|
90 | putData(0,k+i,vin[i],vfg[i]);
|
---|
91 | if (fgout2)
|
---|
92 | putData(1, k+i, vin2[i], vfg2[i]);
|
---|
93 | }
|
---|
94 | klast+=wsize;
|
---|
95 | totnscount+=wsize;
|
---|
96 | }
|
---|
97 | }
|
---|
98 |
|
---|
99 | // 2eme partie, on traite la fin du bloc d'echantillons si necessaire
|
---|
100 | double inval;
|
---|
101 | uint_8 inflg;
|
---|
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);
|
---|
106 | if (fgin2) {
|
---|
107 | getData(1, k, inval, inflg);
|
---|
108 | if (fgout2)
|
---|
109 | putData(1, k, inval, inflg);
|
---|
110 | }
|
---|
111 | totnscount++;
|
---|
112 | }
|
---|
113 |
|
---|
114 | totnbblock++;
|
---|
115 |
|
---|
116 | cout << " NoOpProcessor::run() - End of processing "
|
---|
117 | << " TotNbBlocks= " << totnbblock << endl;
|
---|
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;
|
---|
127 | if (vin2) delete[] vin2;
|
---|
128 | if (vfg2) delete[] vfg2;
|
---|
129 |
|
---|
130 | }
|
---|