Changeset 3659 in Sophya for trunk/AddOn/TAcq/brpaqu.h


Ignore:
Timestamp:
Oct 19, 2009, 3:43:12 PM (16 years ago)
Author:
ansari
Message:

amelioration classe BRPaqChecker et ajout methode d'acces en SByte et TwoByteComplex aux donnees de la classe BRPaquet - Reza 19/10/2009

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/brpaqu.h

    r3658 r3659  
    3131  explicit TwoByteComplex(double re, double im) { val_[0] = re; val_[1] = im; }
    3232 
    33   inline Byte& realB() { return  val_[0]; }
    34   inline Byte& imagB() { return  val_[1]; }
    35 
    36   inline SByte realSB() { return  ((SByte*)val_)[0]; }
    37   inline SByte imagSB() { return  ((SByte*)val_)[1]; }
    38 
    39   inline int realI() { return  ((SByte*)val_)[0]; }
    40   inline int imagI() { return  ((SByte*)val_)[1]; }
    41 
    42   inline double realD() { return  ((SByte*)val_)[0]; }
    43   inline double imagD() { return  ((SByte*)val_)[1]; }
    44 
    45   Byte val_[2];
     33  inline SByte& realB() { return  val_[0]; }
     34  inline SByte& imagB() { return  val_[1]; }
     35
     36  inline int realI() { return  (int)(val_)[0]; }
     37  inline int imagI() { return  (int)(val_)[1]; }
     38
     39  inline double realD() { return  (double)(val_)[0]; }
     40      inline double imagD() { return  (double)(val_)[1]; }
     41
     42  SByte val_[2];
    4643};
    4744
     
    127124  inline Byte* Header() { return dst_+OFFSET; }
    128125  inline Byte* Trailer() { return (dst_+sz_-BRTRLSIZE+OFFSET); }
    129  
     126
     127  // Acces aux differentes zone de donnees en signed byte (-127 ... 127), donnees FFT
     128  inline SByte* BeginS() { return (SByte*)(dst_+OFFSET); }
     129  inline SByte* Data1S() { return (SByte*)(dst_+BRHDRSIZE+OFFSET); }
     130  inline SByte* Data2S() { return (SByte*)(dst_+BRHDRSIZE+(DataSize()/2)+OFFSET); }
     131
     132  // Acces aux differentes zone de donnees en TwoByteComplex pour donnees FFT
     133  inline int DataSizeC() { return (sz_-(BRHDRSIZE+BRTRLSIZE))/2; }
     134  inline TwoByteComplex* BeginC() { return (TwoByteComplex*)(dst_+OFFSET); }
     135  inline TwoByteComplex* Data1C() { return (TwoByteComplex*)(dst_+BRHDRSIZE+OFFSET); }
     136  inline TwoByteComplex* Data2C() { return (TwoByteComplex*)(dst_+BRHDRSIZE+(DataSize()/2)+OFFSET); }
     137
    130138  // Valeurs differentes zones HDR/TRL
    131139  inline UInt32 HDRMarker() {return *((UInt32*)(dst_+OFFSET));}
     
    167175
    168176  // fonction appelee par le constructeur pour reordonner les donnees FFT
    169   static void ReorderFFTData(Byte* src, Byte* dst, int sz);
    170   static void ReorderFFTData32(Byte* src, Byte* dst, int sz);
    171   static void ReorderFFTDataNoSwap(Byte* src, Byte* dst, int sz);
     177  static void ReorderFFTData(SByte* src, SByte* dst, int sz);
     178  static void ReorderFFTData32(SByte* src, SByte* dst, int sz);
     179  static void ReorderFFTDataNoSwap(SByte* src, SByte* dst, int sz);
    172180  static const char* FmtConvToString(BRDataFmtConv fgswap);
    173181// protected:
     
    184192class BRPaqChecker {
    185193public:
     194  // if cktrl==true, check header AND trailer, ==false check header only
    186195  BRPaqChecker(bool cktrl=true, int maxprt=0);
    187196  ~BRPaqChecker();
     
    194203
    195204  // Verifie le paquet, renvoie true si OK
    196   bool Check(BRPaquet& paq);
     205  bool Check(BRPaquet& paq, UInt64& numframe);
     206  inline bool Check(BRPaquet& paq)  { UInt64 nf; return Check(paq, nf); }
     207
    197208  // Imprime le compte de paquets ...
    198209  ostream & Print(ostream& os) const;
    199210  inline ostream & Print() const { return Print(cout); }
    200211
    201   unsigned long long totnframes;    // Nombre totale de frames/paquets traites
    202   unsigned long long  nframeok;     // Nombre totale de frames/paquets avec HDR/TRL OK
    203   unsigned long long lostframes;    // Nombre totale de frames/paquets perdus
    204   unsigned int frclst;         // derniere valeur du frame-counter
     212  // Acces aux differents compteurs
     213  inline UInt64 NbPaqTotal() { return totnframes; }
     214  inline UInt64 NbPaqOK() { return nframeok; }
     215  inline UInt64 NbPaqLost() { return lostframes; }
     216  inline UInt64 NbGaps() { return cnt_saut; }
     217  inline UInt64 LastFrameNum() { return lastframenum; }
     218
     219protected:
     220  UInt64 totnframes;    // Nombre totale de frames/paquets traites
     221  UInt64  nframeok;     // Nombre totale de frames/paquets avec HDR/TRL OK
     222  UInt64 lostframes;    // Nombre totale de frames/paquets perdus
     223  UInt16 frclst;         // derniere valeur du frame-counter
     224  UInt64 lastframenum;    // Dernier numero de frame(=frame-counter, sans modulo 65535)
    205225
    206226  bool cktrl_;    // Verifie aussi le trailer si true
    207   unsigned int cnt_saut;          // Nb de fois ou DeltaFrameCounter>1
    208   unsigned int maxprt_;        // Nb maxi de print paquets perdus / probleme
     227  UInt64 cnt_saut;          // Nb de fois ou DeltaFrameCounter>1
     228  UInt32 maxprt_;           // Nb maxi de print paquets perdus / probleme
    209229
    210230  UInt64 hdrtag_;
     
    212232};
    213233
    214 // Definition de l'operator << overloading - Appel de Prin()
     234// Definition de l'operator << overloading - Appel de Print()
    215235inline ostream& operator << (ostream& s, BRPaqChecker const & chk)
    216236  {  return chk.Print(s);  }
Note: See TracChangeset for help on using the changeset viewer.