rapclass/Event.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of rapclass.
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: 2013-04-02
00021 **  Authors:
00022 **    Marc Wathelet (ISTerre, Grenoble, France)
00023 **
00024 ***************************************************************************/
00025 
00026 #ifndef EVENT_H
00027 #define EVENT_H
00028 
00029 #include <QtCore>
00030 
00031 #include "Station.h"
00032 
00033 #define COMPARE_ITEMS \
00034   if(v1<v2) { \
00035     return trueValue; \
00036   } else if(v1>v2) { \
00037     return !trueValue; \
00038   } else { \
00039     return false; \
00040   }
00041 
00042 class Event
00043 {
00044 public:
00045   Event();
00046   ~Event();
00047 
00048   void setId(QDir d, const QString& id);
00049   QString id() const {return _id;}
00050 
00051   double magnitude(bool& ok) const;
00052   Station::Status status() const;
00053 
00054   int stationCount() const {return _stations.count();}
00055   Station * station(const QString& name) const;
00056   Station * station(int index) const {return _stations.at(index);}
00057   void sortStations();
00058   void save(QTextStream& s, const QString& eventId);
00059 
00060   static void setSortIndex(int index) {_sortIndex=index;}
00061   static bool lessThan(const Event * e1, const Event * e2);
00062 private:
00063   QString _id;
00064   QList<Station *> _stations;
00065   static int _sortIndex;
00066 };
00067 
00068 #endif // EVENT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines