[3683] | 1 | #ifndef BRBASEPROC_H_SEEN
|
---|
| 2 | #define BRBASEPROC_H_SEEN
|
---|
| 3 |
|
---|
| 4 | //----------------------------------------------------------------
|
---|
[3939] | 5 | // Projet BAORadio - (C) LAL/IRFU 2008-2011
|
---|
[3683] | 6 | // Classes de threads de traitememt donnees BAORadio
|
---|
| 7 | //----------------------------------------------------------------
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | #include "racqumem.h"
|
---|
| 11 | #include <string>
|
---|
| 12 | #include <vector>
|
---|
| 13 | #include <iostream>
|
---|
| 14 |
|
---|
| 15 | #include "brpaqu.h"
|
---|
[3909] | 16 | #include "timestamp.h" // include SOPHYA
|
---|
[3683] | 17 |
|
---|
| 18 | using namespace std;
|
---|
| 19 |
|
---|
| 20 | //---------------------------------------------------------------------
|
---|
| 21 | // Classe de base pour l'analyse donnees (paquets acquisition) BAORadio
|
---|
| 22 | // Les classes de traitement des paquets BAORadio peuvent heriter de
|
---|
| 23 | // cette classe de base BRBaseProcessor en redefinissant la methode Process()
|
---|
| 24 | //---------------------------------------------------------------------
|
---|
| 25 | class BRBaseProcessor : public SOPHYA::ZThread {
|
---|
| 26 | public:
|
---|
[3774] | 27 | BRBaseProcessor(RAcqMemZoneMgr& memgr, MemZaction mmact=MemZA_ProcA);
|
---|
| 28 |
|
---|
| 29 | MemZStatus SetMemZAction(MemZaction mmact=MemZA_ProcA);
|
---|
[3703] | 30 |
|
---|
[3683] | 31 | virtual void run();
|
---|
[3938] | 32 |
|
---|
| 33 | inline void Stop() { stop_ = true; }
|
---|
[3683] | 34 | inline void STOP() { stop_ = true; }
|
---|
[3703] | 35 |
|
---|
[3778] | 36 | inline void setNameId(const char* nom, int id)
|
---|
| 37 | { bpnom_=nom; bpid_=id; }
|
---|
[3955] | 38 | inline void setNameId(string const& nom, int id)
|
---|
[3778] | 39 | { bpnom_=nom; bpid_=id; }
|
---|
| 40 |
|
---|
[3938] | 41 | // get Observation Time ( obtained from MemZoneMgr )
|
---|
| 42 | inline SOPHYA::TimeStamp& getObsTime() { return cts_; }
|
---|
[3939] | 43 | // Attention : les methodes suivantes ne sont pas protegees pour le numero de fibre
|
---|
[3938] | 44 | // Renvoie le numero de frame-counter courant - si fgz=true, soustrait le FC du premier paquet
|
---|
| 45 | inline uint_8 getCurFrameCounter(size_t fib=0, bool fgz=true)
|
---|
| 46 | { if (fgz) return (curfc_[fib]-fcfirst_[fib]) ; else return curfc_[fib]; }
|
---|
| 47 | // Renvoie le TimeTag courant (unite coups d'horloge) - si fgz=true, soustrait le TT du premier paquet
|
---|
| 48 | inline uint_8 getCurTimeTag(size_t fib=0, bool fgz=true)
|
---|
| 49 | { if (fgz) return (vpaq_[fib].TimeTag()-ttfirst_[fib]) ; else return vpaq_[fib].TimeTag(); }
|
---|
| 50 | // Renvoie le TimeTag courant converti en secondes - si fgz=true, soustrait le TT du premier paquet
|
---|
| 51 | inline double getCurTimeTagSeconds(size_t fib=0, bool fgz=true)
|
---|
| 52 | {
|
---|
| 53 | if (fgz) return ((double)(vpaq_[fib].TimeTag()-ttfirst_[fib])/1.25e8) ;
|
---|
| 54 | else return ((double)vpaq_[fib].TimeTag()/1.25e8);
|
---|
| 55 | }
|
---|
| 56 | //---- niveau d'impression
|
---|
| 57 | inline void SetPrintLevel(int lev=0, uint_8 prtmodulo=10)
|
---|
| 58 | { prtlev_=lev; prtmodulo_=prtmodulo;}
|
---|
| 59 |
|
---|
[3683] | 60 | protected:
|
---|
[3703] | 61 | // Methode devant etre redefinie pour effectuer le traitement - appele pour chaque trigger
|
---|
| 62 | virtual int Process(); // renvoie 0 si OK, sinon, arret traitement
|
---|
| 63 |
|
---|
[3683] | 64 | RAcqMemZoneMgr& memgr_;
|
---|
[3774] | 65 | MemZaction mmact_; // Definition de l'action sur les paquets (defaut=MemZA_ProcA)
|
---|
| 66 | MemZStatus mmsta_; // Statut associe a mmact_ (defaut=MemZS_ProcA)
|
---|
[3696] | 67 | bool stop_;
|
---|
| 68 | vector<Byte*> fbuff_; // Vecteur de pointeur de zone memoire pour chaque fibre
|
---|
[3872] | 69 | vector<Byte*> fprocbuff_; // Vecteur de pointeur de proc_zone_mem pour chaque fibre
|
---|
[3683] | 70 | vector<BRPaquet> vpaq_; // Vecteur de BRPaquet pour chaque fibre
|
---|
[3872] | 71 | vector<Byte*> vprocpaq_; // Vecteur de pointeur de zone memoire pour donnees traitees de chaque paquet/fibre
|
---|
[3694] | 72 | vector<BRPaqChecker> vpchk_;
|
---|
[3683] | 73 | vector<uint_8> vfgok_; // Vecteur de flag si paquet OK pour chaque fibre
|
---|
| 74 | vector<uint_8> curfc_; // Vecteur de numero de FrameCounter pour chaque fibre
|
---|
[3938] | 75 | vector<uint_8> fcfirst_; // numero du FrameCounter pour le premier paquet
|
---|
| 76 | vector<uint_8> ttfirst_; // TimeTag pour le premier paquet
|
---|
[3683] | 77 | bool fgokallfibers_; // true -> paquets for all fibers OK
|
---|
[3938] | 78 |
|
---|
[3683] | 79 | uint_8 totprocnpaq_;
|
---|
[3909] | 80 | SOPHYA::TimeStamp cts_; // current time stamp, get from MemZoneMgr
|
---|
[3778] | 81 |
|
---|
| 82 | string bpnom_; // nom du processeur
|
---|
| 83 | int bpid_; // numero d'identificateur
|
---|
[3938] | 84 |
|
---|
| 85 | int prtlev_; // print level
|
---|
| 86 | uint_8 prtmodulo_; // print periodicity (modulo)
|
---|
[3683] | 87 | };
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | #endif
|
---|