00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <Alloc.hh>
00023 #include <Condition.hh>
00024 #include <Mutex.hh>
00025 #include <Semaphore.hh>
00026
00027 #include <dsp/DSPOp.hh>
00028 #include <dsp/RecDecimator.hh>
00029
00030 #include "Config.h"
00031 #include "LocalMsg.h"
00032 #include "CfgFile.hh"
00033 #include "FreqBeamDipole.hh"
00034 #include "FreqBeamLine.hh"
00035 #include "LogFile.hh"
00036 #include "Messages.hh"
00037 #include "SockClie.hh"
00038 #include "SockOp.hh"
00039 #include "SockServ.hh"
00040
00041 #include "BeamCommon.hh"
00042
00043
00044 #ifndef BEAMSRV2_HH
00045 #define BEAMSRV2_HH
00046
00047 # define BS_TAG_READY 1
00048 # define BS_TAG_RES 2
00049
00050
00052 bool BeamCommNodeParams (stBeamNodeParams &);
00053 bool BeamCommInData (GDT *, int);
00054
00055
00063 class clBeamSrv2Master
00064 {
00065 int iFilterType;
00066 int iDecimate;
00067 int iDecFact;
00068 int iChOffset;
00069 int iOutDataCount;
00070 char cpLogBuf[BS_LOGBUFSIZE];
00071 stRawDataFirst sInHdr;
00072 stBeamNodeParams sNodeParams;
00073 clAlloc FiltWork;
00074 clCfgFile Cfg;
00075 clDSPOp DSP;
00076 clLogFile Log;
00077 clRecDecimator *FilterBank;
00078 clSockOp SOpIn;
00079 clSockServ SServ;
00080
00081 clReBuffer InBuf;
00082 clSemaphore SemIn;
00083 clMutex MtxIn;
00084
00085 clAlloc OutData;
00086 clCondition CndOut;
00087 clMutex MtxOut;
00088
00089 bool ReadConfig ();
00090 bool InitFilterBank ();
00091 bool InitProcessing ();
00092 bool WaitReady ();
00093 void ProcessLoop ();
00094 void CompactData (GDT *, const GDT *, long, long, long, long);
00095 bool FilterData (GDT *, const GDT *, long, long, long, long);
00096 public:
00097 clBeamSrv2Master ();
00098 ~clBeamSrv2Master ();
00099 int Main (int *, char ***);
00100 static void Abort (int = 0);
00101 void *InDataThread (void *);
00102 void *ServerThread (void *);
00103 void *ServeClientThread (void *);
00104 };
00105
00106
00112 class clBeamSrv2Slave
00113 {
00114 int iRank;
00115 stBeamNodeParams sNodeParams;
00116 clFreqBeamDipole FBDipole;
00117 clFreqBeamLine FBLine;
00118 bool SendReady ();
00119 bool SendRes (GDT *, int);
00120 public:
00121 clBeamSrv2Slave (int);
00122 ~clBeamSrv2Slave ();
00123 int Main (int *, char ***);
00124 };
00125
00126 #endif