| 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
| 2 |  | 
|---|
| 3 | // ArchTOIPipe           (C)     CEA/DAPNIA/SPP IN2P3/LAL | 
|---|
| 4 | //                               Eric Aubourg | 
|---|
| 5 | //                               Christophe Magneville | 
|---|
| 6 | //                               Reza Ansari | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef CGT_H | 
|---|
| 9 | #define CGT_H | 
|---|
| 10 |  | 
|---|
| 11 | #include "toi.h" | 
|---|
| 12 | #include "toiprocessor.h" | 
|---|
| 13 | #include <vector> | 
|---|
| 14 |  | 
|---|
| 15 | // ------------------------------------------------------------------------- | 
|---|
| 16 | // classe CGT : Compagnie Generale des Tuyaux | 
|---|
| 17 | // Gestionnaire de tuyaux (toi) et d'unites de traitements (TOIProcessor) | 
|---|
| 18 | //                                         R. Ansari / Mai 2002 | 
|---|
| 19 | // ------------------------------------------------------------------------- | 
|---|
| 20 |  | 
|---|
| 21 | class CGT { | 
|---|
| 22 | public: | 
|---|
| 23 | CGT(bool fgsegmented = true, int bufsz=1024, int maxseg=20); | 
|---|
| 24 | virtual ~CGT(); | 
|---|
| 25 |  | 
|---|
| 26 | void    SelectTOISegmented(int bufsz=1024, int maxseg=20); | 
|---|
| 27 | void    SelectTOISeqBuffered(int wsz=8192); | 
|---|
| 28 |  | 
|---|
| 29 | inline void  SetDebugLevel(int lev=0) {dbgLevel = lev; } | 
|---|
| 30 |  | 
|---|
| 31 | virtual TOI& Connect(TOIProcessor& prout, string& out, | 
|---|
| 32 | TOIProcessor& prin, string& in, string nom="", | 
|---|
| 33 | int wbsz=0, bool withFlag=false); | 
|---|
| 34 | virtual TOI& Connect(TOIProcessor& prout, const char* out, | 
|---|
| 35 | TOIProcessor& prin, const char* in, string nom="", | 
|---|
| 36 | int wbsz=0, bool withFlag=false); | 
|---|
| 37 |  | 
|---|
| 38 | virtual void ListProcs(::ostream& os, bool prstat=false); // const plus tard | 
|---|
| 39 | virtual void ListTOIs(::ostream& os, bool prstat=false);  // const plus tard | 
|---|
| 40 | virtual void PrintStatus(::ostream & os, bool prstat=false); // const plus tard | 
|---|
| 41 |  | 
|---|
| 42 | virtual void DeleteProcs(); | 
|---|
| 43 | virtual void Start(); | 
|---|
| 44 |  | 
|---|
| 45 | protected: | 
|---|
| 46 | int findProcId(TOIProcessor* pr); | 
|---|
| 47 |  | 
|---|
| 48 | struct tuyau { int pr1id; int pr2id; TOI* toi; }; | 
|---|
| 49 | vector< tuyau > lesTuyaux; | 
|---|
| 50 | vector< TOIProcessor* > lesProcs; | 
|---|
| 51 | bool fgSegmented; | 
|---|
| 52 | int segBuffsz, segMaxseg; | 
|---|
| 53 | bool fgSeqbuff; | 
|---|
| 54 | int seqWsz; | 
|---|
| 55 |  | 
|---|
| 56 | int dbgLevel; | 
|---|
| 57 | }; | 
|---|
| 58 |  | 
|---|
| 59 | inline ostream& operator << (ostream& os, CGT& cgt) | 
|---|
| 60 | { cgt.PrintStatus(os); return os; } | 
|---|
| 61 |  | 
|---|
| 62 | #endif | 
|---|