source: Sophya/trunk/ArchTOIPipe/ProcWSophya/genwproc.h@ 1730

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

Correction decl. interface GenWTOIPr::PrintStatus() - Reza 18/6/2001

File size: 4.0 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2
3#ifndef GENWPROC_H
4#define GENWPROC_H
5
6#include "toiprocessor.h"
7#include "tvector.h"
8
9#include <vector>
10
11
12class GenWindowTOIProcessor : public TOIProcessor {
13public:
14 GenWindowTOIProcessor(int_4 nbinput,int_4 nboutput,int_4 wsz, int_4 wstep=1, int_4 wsztot=-1);
15 virtual ~GenWindowTOIProcessor();
16
17 inline int_4 GetWSize() const { return WSize; }
18 inline int_4 GetWStep() const { return WStep; }
19 inline int_4 ProcessedSampleCount() const { return TotNsCount; }
20
21 // DbgLevel = 0 : No debug
22 // DbgLevel = 1 : Print fenetre WSize
23 // DbgLevel = 2 : 1 + Print logique remplissage/decalage
24 // DbgLevel = 3 : 2 + Print fenetre WSizeTot et WSizeL,C,R
25 inline void SetDbgLevel(int_2 lp=0) {DbgLevel = (lp>0) ? lp : 0;}
26
27 void SetWSizeLCR(int_4 wszl=0,int_4 wszc=0,int_4 wszr=0);
28 inline int_4 GetWSize(char cw)
29 {if (cw=='l') return WSizeLeft;
30 else if(cw=='c') return WSizeCenter;
31 else if(cw=='r') return WSizeRight;
32 return WSize;}
33
34 inline int_8 GetWStartSample() {return StartSample;}
35 inline int_8 GetWCenterSample() {return StartSample + WSize/2;}
36 inline int_8 GetWCenterIndex() {return WSize/2;}
37 inline int_8 StartSampleNum() {return SNbegin;}
38 inline int_8 EndSampleNum() {return SNend;}
39
40 inline void SetDefaultValue(r_8 r8dval=0., int_8 i8dval=0)
41 {R8DefVal = r8dval; I8DefVal = i8dval;}
42
43 TVector<r_8> GetWData(int_4 numtoi=0);
44 TVector<uint_8> GetWFlag(int_4 numtoi=0);
45 r_8 * GetWDataPointer(int_4 numtoi=0);
46 uint_8 * GetWFlagPointer(int_4 numtoi=0);
47 void GetData(int_4 numtoi, int_8 numsample, r_8 & data, uint_8 & flag);
48 inline void GetData(int_8 numsample, r_8 & data, uint_8 & flag)
49 { GetData(0, numsample, data, flag); }
50
51 TVector<r_8> GetWData(char cw,int_4 numtoi=0);
52 TVector<uint_8> GetWFlag(char cw,int_4 numtoi=0);
53 r_8 * GetWDataPointer(char cw,int_4 numtoi,int_4& n);
54 uint_8 * GetWFlagPointer(char cw,int_4 numtoi,int_4& n);
55 inline r_8 * GetWDataPointer(char cw,int_4& n)
56 {return GetWDataPointer(cw,0,n);}
57 inline uint_8 * GetWFlagPointer(char cw,int_4& n)
58 {return GetWFlagPointer(cw,0,n);}
59
60 void PutWData(int_4 numtoi,int_8 numsample,TVector<r_8>& data,TVector<uint_8>& flag);
61 void PutWData(int_4 numtoi,int_8 numsample,r_8 data,uint_8 flag);
62 inline void PutWData(int_8 numsample,TVector<r_8>& data,TVector<uint_8>& flag)
63 {PutWData(0,numsample,data,flag);}
64 inline void PutWData(int_8 numsample,r_8 data,uint_8 flag)
65 {PutWData(0,numsample,data,flag);}
66
67 virtual void PrintStatus(ostream & os);
68
69 virtual void UserInit(int_8 kstart);
70 virtual void UserProc(int_8 ks);
71 virtual void UserEnd(int_8 kend);
72
73 virtual void init();
74 virtual void run();
75
76protected:
77 void Remplissage(int_8 ks);
78 void Ecriture();
79 void test_avec_print(int_8 ks);
80 inline int_4 StartWtIndex() {return CurWtIndex-WSize;}
81 inline int_4 CenterWtIndex() {return CurWtIndex-(WSize+1)/2;}
82 inline int_4 StartWtIndex(char cw)
83 {if (cw=='l') return StartWtIndex()+W0Left;
84 else if(cw=='c') return StartWtIndex()+W0Center;
85 else if(cw=='r') return StartWtIndex()+W0Right;
86 return StartWtIndex();}
87
88 int_2 DbgLevel;
89 int_4 NbInput,NbOutput;
90 int_4 WSizeTot,WSize,WStep;
91 int_4 WSizeLeft,WSizeCenter,WSizeRight, W0Left,W0Center,W0Right;
92 int_8 SNbegin,SNend;
93 int_8 TotNsCount,TotDecalCount;
94 r_8 R8DefVal;
95 int_8 I8DefVal;
96
97 int_4 CurWtIndex; // Prochain index a remplir dans le buffer WSizeTot
98 int_8 LastFilledSn; // Numero du dernier sample remplie
99 int_8 StartSample; // Numero de sample du 1er element du buffer WSize
100
101 vector< TVector<r_8> > WDataIn;
102 vector< TVector<uint_8> > WFlagIn;
103 vector< bool > WInFlg;
104 vector< TVector<r_8> > WDataOut;
105 vector< TVector<uint_8> > WFlagOut;
106 vector< bool > WOutFlg;
107 vector< bool > WPutOutFlg;
108 vector< bool > WPutOutOwnVector;
109 vector< int_8 > OutSample;
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.