PacMaster 2.0(r200)
Controls digital PAC measurements and collects the results

PacEvent.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 PACEVENT_H
00022 #define PACEVENT_H
00023 #include <QtGlobal>
00024 #include <QByteArray>
00025 #include <QList>
00026 #include "pacDataTypes.h"
00027 
00033 class PacEvent
00034 {
00035   public:
00036     PacEvent(unsigned int nodeid, qulonglong time=0, qreal energy=0.0);
00037     PacEvent(unsigned int nodeid, QByteArray data);
00038     ~PacEvent();
00039     inline qreal energy() const { return e; };
00040     inline qulonglong time() const { return t; };
00041     inline unsigned int nodeid() const { return nid; };
00042     inline qulonglong eventid() const {return eid; };
00043     inline void setEventId(qulonglong eventid) { eid = eventid; };
00044     inline void setCorrelated(bool corr) { c=corr; };
00045     inline bool correlated() const { return c; }
00047     const QByteArray toByteArray() const;
00048 
00049     static inline qint32 byteArrayLength() { return 17; };
00050     static QList<Pac::DataFileColumns> getColumnContents();
00051     static QList<Pac::DataFileColumType> getColumnTypes();
00052 
00053     bool operator<=(PacEvent ev) const { return t <= ev.t; }
00054     bool operator>=(PacEvent ev) const { return t >= ev.t; }
00055     bool operator<(PacEvent ev) const { return t < ev.t; }
00056     bool operator>(PacEvent ev) const { return t > ev.t; }
00057     bool operator<(qulonglong time) const { return t < time; }
00058     bool operator<=(qulonglong time) const { return t <= time; }
00059 
00060   private:
00061     quint8 nid;
00062     qulonglong t;
00063     qreal e;
00064     QByteArray e_bytes, t_bytes;
00065     qulonglong eid;
00066     bool c; 
00067 };
00068 
00069 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines