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