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

Last change on this file since 2068 was 1766, checked in by aubourg, 24 years ago

back

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