/************************************************************** >>>>>>>> usage: tstdemo [snum1,snum2] Test et demonstration du Pipe. "demo1.fits": fits table avec sampleNum,boloMuV_10,fg_boloMuV_10,boloMuV_20 samplenum=[100001,105000] "demo2.fits": fits table avec sampleNum,boloMuV_30,fg_boloMuV_30 samplenum=[100101,105100] Operation: sortir un fichier "demo.fits" ou on ecrit: Toutes les donnees des 2 fichiers d'entree ET : boloSum = boloMuV_10 + boloMuV_20 + boloMuV_30 fg_boloSum = fg_boloMuV_10 | fg_boloMuV_20 | fg_boloMuV_30 boloMul = boloMuV_10 * boloMuV_20 * boloMuV_30 fg_boloMul = fg_boloMuV_10 | fg_boloMuV_20 | fg_boloMuV_30 Structure: demo1.fits demo2.fits | | ---------- ---------- | Reader | | Reader | | rfits1 | | rfits2 | ---------- ---------- "boloMuV_10" "boloMuV_20" "boloMuV_30" | | | t| t| t| u| u| u| y| y| y| a| a| a| u| u| u| | | | b| b| b| o| o| o| l| l| l| o| o| o| | | | 1| 2| 3| 0| 0| 0| | | | | | | /| /| /| / | / | / | / | / | / | / | / | / | / | / | / | _____/ | / | / | |_________ | ____/ | / / |||_______ | __________ | ___________________/ / ||| | | / ||| | | / ||| | | / ||| | / / ||| | / / ||| | _______/ / ||| / / ___________________/ ||| / / ________/ ||| / / /_________________________________ ||| / / / | DemoPipe Processor: | ||| / / / | =================== | ||| / / |---| entree_bolo_3 | ||| | | | sortie_bolo_sum |_______ ||| | |-------| entree_bolo_2 | | ||| | | sortie_bolo_mul | ___ | ||| |---------| entree_bolo_1 | | | ||| |_______________________________| | | ||| | | ||| | | ||| --------------- | | ||| | | | | |||--------"boloMuv_30" | Writter | "boloMul" -- | ||---------"boloMuv_20" | rfitsw | "boloSum" ------ |----------"boloMuV_10" | | --------------- | demo.fits **************************************************************/ #include #include "toi.h" #include "toiprocessor.h" #include "fitstoirdr.h" #include "fitstoiwtr.h" #include "toimanager.h" #include "toisegment.h" #include "sophyainit.h" void crefits(void); // Juste pour le test, rien a voir avec TOI //////////////////////////////////////////////////////////////// // Le INCLUDE de la classe du processeur (peut etre mis a part) class DemoPipe : public TOIProcessor { public: DemoPipe(void); virtual ~DemoPipe(); virtual void init(void); virtual void run(void); void PrintStatus(ostream & os); inline int_8 ProcessedSampleCount() const {return totnscount;} protected: int_8 nread,nwrite,totnscount; }; //////////////////////////////////////////////////////////////// // Le code de la classe du processeur (peut etre mis a part) DemoPipe::DemoPipe(void) : nread(0), nwrite(0),totnscount(0) { } DemoPipe::~DemoPipe() { } void DemoPipe::PrintStatus(ostream & os) { os<<"DemoPipe::Print -- nread = "<1) sscanf(arg[1],"%ld,%ld",&sdeb,&sfin); if(sfin>=sdeb) mgr->setRequestedSample(sdeb,sfin); //-------------------------------------------------------------------- try { // On met tous ca dans un bloc "try" pour recuperer les exceptions //-------------------------------------------------------------------- //////////////////////////////////////////////////////// //////// Creation des lecteurs de fichiers fits //////// //////////////////////////////////////////////////////// // FITS reader du premier fichier FITSTOIReader rfits1("demo1.fits"); int ncol1 = rfits1.getNOut(); cout<<"Lecteur_1: Number of columns in fits : "<PrintStatus(cout); bolo20->PrintStatus(cout); bolo30->PrintStatus(cout); cout<<"----- DemoPipe::PrintStatus() : -----"< statr(rfits1); // statr.InfoMessage() = "tstdemopipe/Info rfits1"; // statr.PrintStats(); // ProcSampleCounter statw(wfits); // statw.InfoMessage() = "tstdemopipe/Info wfits"; // statw.PrintStats(); // ProcSampleCounter statp(demo); // statp.InfoMessage() = "tstdemopipe/Info DemoPipe"; // statp.PrintStats(); // Gestion de la re-connection des threads mgr->joinAll(); cout<<"End threads"<