PacMan 2.0(r200)
Runs on digital PAC measurement computers

PacMan.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008-2010 by Matthias Nagl                              *
00003  *   mnagl@uni-goettingen.de                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef PACMAN_H
00022 #define PACMAN_H
00023 
00024 #include <QObject>
00025 #include <QTimer>
00026 #include <QMutex>
00027 #include <QQueue>
00028 #include "PacQueue.h"
00029 #include "PropertyBranch.h"
00030 #include "TransmittableProperty.h"
00031 
00032 class PacStats;
00033 class PacDigitizerThread;
00034 class PacAnalyzerThread;
00035 class PacNetThread;
00036 class WaveformDataInterface;
00037 class PacWaveformChunk;
00038 class PacResultChunk;
00039 class WaveformProcessingInterface;
00040 
00046 class PacMan : public QObject, PropertyBranch
00047 {
00048     Q_OBJECT
00049   public:
00050     PacMan(QObject *parent = 0);
00051     ~PacMan();
00052 
00053     static PacQueue<PacWaveformChunk> *pacdataqueue;
00054     static QList<PacAnalyzerThread*> analyzerthreads;
00055     static PacQueue<const long long> droppedChunks;
00056     static PacQueue<PacWaveformChunk> *wfrecyclingqueue;
00057     static PacStats *pacstats;
00059     void forwardConfirmationData(const TransmittablePropertyData *d) const;
00061     void forwardNewProperty(const TransmittableProperty *p) const;
00062     void childPropertyChanged(TransmittableProperty *);
00063     static const WaveformProcessingInterface * getAnalyzer() { return procif; };
00064 
00065   public slots:
00066     void startRecording();
00067     void stopRecording();
00068     void recordingFinished();
00069     void getThreadStatus(QString s);
00070     void sendAllProperties();
00071     void changedPropertyReceived(QByteArray data);
00072 
00073   private slots:
00074     void sendAnalyzerStats();
00075     void sendConfirmationProperties();
00076 
00077   signals:
00078     void start_recording();
00079     void stop_recording();
00080     void allThreadsReady();
00081     void analyzerStats(int dataqueuewfin, int dataqueuewfdrop, int resultqueuein, int resultqueuedrop);
00082     void lastSeqNum(qlonglong l);
00083     void numAnalyzerThreads(unsigned int newnum);
00084     void forwardWaveformTeaser(WaveformDataInterface *w);
00085     void waitingForOffsetSignal();
00086     void foundOffsetSignal();
00087     void startSynchronization();
00088     void setAnalyzerPlugin(QObject * waveformtemplate);
00089     void sendPropertyToNode(QByteArray data) const;
00090     void sendConfirmationToNode(QByteArray data);
00091 
00092   private:
00093     virtual void propertyChanged(TransmittableProperty *);
00094     void updatePerformanceProperties();
00095     void updatePluginProperty();
00096     void initializePluginList();
00097     QMutex mutex;
00098     PacDigitizerThread* digithread;
00099     int numanalyzerthreads;
00100     PacNetThread *netthread;
00101     bool netthreadready, digithreadready;
00102     int analyzerthreadsready;
00103     QTimer *stattimer;
00104     QTimer *confirmationtimer;
00105     mutable QQueue<const TransmittablePropertyData*> confirmationqueue;
00106     mutable QMutex confirmationmutex;
00107     PropertyBranch b_performance;
00108     TransmittableProperty p_analyzerthreads, p_wfqueuelength, p_wfrecyclingqueuelength, p_resultqueuelength, p_plugin;
00109     bool recording;
00110     static WaveformProcessingInterface *procif;
00111     QMap<int, QString> pluginIdToName;
00112     QMap<int, WaveformProcessingInterface*> pluginIdToObject;
00113 };
00114 
00115 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends