Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

BeamSrv.hh

Go to the documentation of this file.
00001 /*
00002 
00003     Beamforming input server
00004     Copyright (C) 2002 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 */
00021 
00022 
00023 #include <sys/types.h>
00024 
00025 #include <Alloc.hh>
00026 #include <Condition.hh>
00027 #include <Mutex.hh>
00028 #include <Semaphore.hh>
00029 
00030 #include <dsp/DSPOp.hh>
00031 #include <dsp/ReBuffer.hh>
00032 #include <dsp/RecDecimator.hh>
00033 
00034 #include "Config.h"
00035 #include "LocalMsg.h"
00036 #include "CfgFile.hh"
00037 #include "FreqBeamDipole.hh"
00038 #include "FreqBeamLine.hh"
00039 #include "LogFile.hh"
00040 #include "Messages.hh"
00041 #include "SockClie.hh"
00042 #include "SockOp.hh"
00043 #include "SockServ.hh"
00044 
00045 #include "BeamCommon.hh"
00046 
00047 
00048 #ifndef BEAMSRV_HH
00049 #define BEAMSRV_HH
00050 
00051 #   define BS_PROCINFOV_T       std::vector<stBeamProcInfo>
00052 
00053 
00054     typedef struct _stBeamProcInfo
00055     {
00056         pid_t pidProc;
00057         int iSockH;
00058     } stBeamProcInfo, *stpBeamProcInfo;
00059 
00060 
00068     class clBeamSrvMaster
00069     {
00070             int iFilterType;
00071             int iDecimate;
00072             int iDecFact;
00073             int iChOffset;
00074             int iOutDataCount;
00075             volatile int iBlockCntr;
00076             char cpLogBuf[BS_LOGBUFSIZE];
00077             stRawDataFirst sInHdr;
00078             stBeamNodeParams sNodeParams;
00079             clAlloc FiltWork;
00080             clCfgFile Cfg;
00081             clDSPOp DSP;
00082             clLogFile Log;
00083             clRecDecimator *FilterBank;
00084             clSockOp SOpIn;
00085             clSockServ SServ;
00086             /* Input data, thread shared */
00087             clReBuffer InBuf;
00088             clSemaphore SemIn;
00089             clMutex MtxIn;
00090             /* Output data, thread shared */
00091             clAlloc OutData;
00092             clCondition CndOut;
00093             clMutex MtxOut;
00094             /* - */
00095             bool ReadConfig ();
00096             bool InitFilterBank ();
00097             bool InitProcessing ();
00098             void ProcessLoop ();
00099             bool SendNodeParams ();
00100             bool WaitReady ();
00101             bool SendInData (const GDT *, int);
00102             void CompactData (GDT *, const GDT *, long, long, long, long);
00103             bool FilterData (GDT *, const GDT *, long, long, long, long);
00104         public:
00105             clBeamSrvMaster ();
00106             ~clBeamSrvMaster ();
00107             int Main (int *, char ***);
00108             static void Abort ();
00109             void *InDataThread (void *);
00110             void *ServerThread (void *);
00111             void *ServeClientThread (void *);
00112     };
00113 
00114 
00120     class clBeamSrvSlave
00121     {
00122             int iProcess;
00123             int iSockH;
00124             stBeamNodeParams sNodeParams;
00125             clFreqBeamDipole FBDipole;
00126             clFreqBeamLine FBLine;
00127             bool RecvParams ();
00128             bool RecvInData (GDT *, int);
00129             bool SendReady ();
00130             bool SendRes (const GDT *, int);
00131         public:
00132             clBeamSrvSlave (int, int);
00133             ~clBeamSrvSlave ();
00134             int Main (int *, char ***);
00135     };
00136 
00137 #endif

Generated on Sun Oct 26 19:11:19 2003 for HASAS by doxygen 1.3.3