source: Sophya/trunk/ArchTOIPipe/Processors/nooppr.cc@ 1487

Last change on this file since 1487 was 1487, checked in by ansari, 24 years ago

Ajout NoOpProcessor (processeur qui ne fait rien) pour mesure perfo systeme - Reza 6/5/2001

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