00001 /*************************************************************************** 00002 ** 00003 ** This file is part of warand. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created : 2008-07-13 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef REALTIMEARRAYMANAGER_H 00028 #define REALTIMEARRAYMANAGER_H 00029 00030 #include <GeopsyCore.h> 00031 00032 #include "ArrayTask.h" 00033 #include "RealTimeArrayProcess.h" 00034 #include "RealTimeHistogram.h" 00035 00036 class RealTimeArrayManager : public QObject 00037 { 00038 Q_OBJECT 00039 public: 00040 RealTimeArrayManager(ArrayStations * array); 00041 ~RealTimeArrayManager(); 00042 00043 void setSamplingParameters(const SamplingParameters& p); 00044 void setFrequencyBandWidth(double fbw); 00045 void setWindowLenght(double l); 00046 void setMaximumSlowness(double s); 00047 void setWavenumberRange(double kmin, double kmax); 00048 00049 void setMaximumTime(double t); 00050 double maximumTime() const {return _globalRange.end();} 00051 00052 void start(); 00053 void stop(); 00054 bool isActive() const {return _active;} 00055 void createTasks(); 00056 00057 IrregularGrid2D fkDispersion() const {return _fkDispersion;} 00058 IrregularGrid2D hrfkDispersion() const {return _hrfkDispersion;} 00059 IrregularGrid2D spacDispersion() const {return _spacDispersion;} 00060 signals: 00061 void queueChanged(int size); 00062 private: 00063 friend class RealTimeArrayProcess; 00064 void addTask(ArrayTask * t); 00065 ArrayTask * takeTask(); 00066 void clearTasks(); 00067 00068 ArrayStations * _array; 00069 TimeRange _globalRange; 00070 QVector<double> _lastFrequencyTimes; 00071 00072 double _frequencyBandWidth; 00073 SamplingParameters _samplingParameters; 00074 WindowingParameters _windowingParameters; 00075 QVector<GaussianFrequencyBand> _bands; 00076 00077 QMutex _mutex; 00078 QWaitCondition _event; 00079 bool _active; 00080 QQueue<ArrayTask *> _tasks; 00081 QList<RealTimeArrayProcess *> _threads; 00082 00083 RealTimeHistogram _fkDispersion, _hrfkDispersion, _spacDispersion; 00084 }; 00085 00086 #endif // REALTIMEARRAYMANAGER_H