GeopsyCore/MiniSeedTrace.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyCore.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2007-10-19
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef MINISEEDTRACE_H
00029 #define MINISEEDTRACE_H
00030 
00031 #include "GeopsyCoreDLLExport.h"
00032 #include "MiniSeedRecords.h"
00033 
00034 namespace GeopsyCore {
00035 
00036 class MiniSeedTrace
00037 {
00038   MiniSeedTrace(const MiniSeedTrace& t);
00039 public:
00040   MiniSeedTrace(LibMSeed::MSRecord * msr);
00041   ~MiniSeedTrace();
00042 
00043   void addRecord(LibMSeed::MSRecord * msr, off_t pos);
00044   bool belongsTo(LibMSeed::MSRecord * msr);
00045   MiniSeedTrace * split();
00046 
00047   double samplingFrequency() const {return _samplingFrequency;}
00048   QString channel() const {return _channel;}
00049   QString network() const {return _network;}
00050   QString station() const {return _station;}
00051   QString location() const {return _location;}
00052 
00053   QDateTime startTime() const {return _records.first()->_startTime;}
00054   double t0() const {return _records.first()->_t0;}
00055   int nSamples() const;
00056   MiniSeedRecords records() const;
00057 private:
00058   double _samplingFrequency, _deltaT;
00059   QString _network, _station, _location, _channel;
00060 
00061   void splitOverlapping(int firstRecord, MiniSeedTrace * sig);
00062   class Record
00063   {
00064   public:
00065     static bool lessThan(const Record * r1, const Record * r2) {
00066       return r1->_startTime < r2->_startTime || (r1->_startTime==r2->_startTime && r1->_t0 < r2->_t0);
00067     }
00068 
00069     int _nSamples;
00070     QDateTime _startTime;
00071     double _t0;
00072     off_t _pos;
00073     quint32 _byteLength;
00074   };
00075   QList<Record *> _records;
00076   bool _sorted;
00077 };
00078 
00079 } // namespace GeopsyCore
00080 
00081 #endif // MINISEEDTRACE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines