| 1 | //#define TOISEQBUFFERED
|
|---|
| 2 |
|
|---|
| 3 | #include <unistd.h>
|
|---|
| 4 | #include "toi.h"
|
|---|
| 5 | #include "cgt.h"
|
|---|
| 6 | #include "toiprocessor.h"
|
|---|
| 7 | #include "fitsringrdr.h"
|
|---|
| 8 | #include "toimanager.h"
|
|---|
| 9 | #ifdef TOISEQBUFFERED
|
|---|
| 10 | #include "toiseqbuff.h"
|
|---|
| 11 | #else
|
|---|
| 12 | #include "toisegment.h"
|
|---|
| 13 | #endif
|
|---|
| 14 |
|
|---|
| 15 | #include "sambainit.h"
|
|---|
| 16 | #include "ring2cout.h"
|
|---|
| 17 | #include "timing.h"
|
|---|
| 18 |
|
|---|
| 19 | #include <stdexcept>
|
|---|
| 20 |
|
|---|
| 21 | void usage(void);
|
|---|
| 22 | void usage(void) {
|
|---|
| 23 | cout<<"tsttoi2ring fitsin_ring Nrings"<<endl;
|
|---|
| 24 | return;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | ////////////////////////////////////////////////////////////////
|
|---|
| 28 | int main(int narg, char** arg) {
|
|---|
| 29 |
|
|---|
| 30 | TOIManager* mgr = TOIManager::getManager();
|
|---|
| 31 |
|
|---|
| 32 | //-- Decodage arguments
|
|---|
| 33 | bool fgsegmented = true;
|
|---|
| 34 | int wsize = 512;
|
|---|
| 35 | bool snimplicit = false;
|
|---|
| 36 |
|
|---|
| 37 | if(narg != 3) {usage(); exit(2);}
|
|---|
| 38 | char * fitsin_ring = arg[1];
|
|---|
| 39 | long nr=atoi(arg[2]);
|
|---|
| 40 |
|
|---|
| 41 | cout<<">>>> tsttoi2ring:"<<endl;
|
|---|
| 42 | cout<<"Fits Infile Value "<<fitsin_ring<<endl;
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | SophyaInit();
|
|---|
| 46 | InitTim();
|
|---|
| 47 |
|
|---|
| 48 | //--------------------------------------------------------------------
|
|---|
| 49 | try {
|
|---|
| 50 | //--------------------------------------------------------------------
|
|---|
| 51 |
|
|---|
| 52 | CGT plombier(fgsegmented,wsize);
|
|---|
| 53 | plombier.SetDebugLevel(99);
|
|---|
| 54 |
|
|---|
| 55 | // FITS reader et writer
|
|---|
| 56 | FITSRingReader rfitsr(fitsin_ring);
|
|---|
| 57 | rfitsr.setNRings(nr);
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 | // TOI Processor
|
|---|
| 61 | Ring2cout ring2p(1024,nr);
|
|---|
| 62 | cout<<"RING2cout created"<<endl;
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | // Definition des tuyaux
|
|---|
| 66 |
|
|---|
| 67 | plombier.Connect(rfitsr,"signal",ring2p,"Phase");
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | // Run
|
|---|
| 71 | cout<<"----- FITSReaderTOI::PrintStatus() : -----"<<endl;
|
|---|
| 72 |
|
|---|
| 73 | plombier.Start();
|
|---|
| 74 | plombier.ListTOIs(cout, 1);
|
|---|
| 75 | cout << "Joining ..." << endl;
|
|---|
| 76 |
|
|---|
| 77 | mgr->joinAll();
|
|---|
| 78 | PrtTim("End threads");
|
|---|
| 79 |
|
|---|
| 80 | //--------------------------------------------------------------------
|
|---|
| 81 | } catch (PThrowable & exc) {
|
|---|
| 82 | cout<<"\ntsttoi2ring: Catched Exception \n"<<(string)typeid(exc).name()
|
|---|
| 83 | <<" - Msg= "<<exc.Msg()<<endl;
|
|---|
| 84 | } catch (const std::exception & sex) {
|
|---|
| 85 | cout<<"\ntsttoi2ring: Catched std::exception \n"
|
|---|
| 86 | <<(string)typeid(sex).name()<<endl;
|
|---|
| 87 | } catch (...) {
|
|---|
| 88 | cout<<"\ntsttoi2ring: some other exception was caught ! "<<endl;
|
|---|
| 89 | }
|
|---|
| 90 | //--------------------------------------------------------------------
|
|---|
| 91 |
|
|---|
| 92 | exit(0);
|
|---|
| 93 | }
|
|---|