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