GeopsyCore/SignalFileFormat.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 : 2009-10-20
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef SIGNALFILEFORMAT_H
00029 #define SIGNALFILEFORMAT_H
00030 
00031 #include <QGpCoreTools.h>
00032 
00033 #include "GeopsyCoreDLLExport.h"
00034 
00035 namespace GeopsyCore {
00036 
00037 class AbstractFileFormat;
00038 
00039 class GEOPSYCORE_EXPORT SignalFileFormat
00040 {
00041 public:
00042   // Be careful, for the sake of compatibility with older databases, never
00043   // change the order of the following enumeration. Only append. This is not valid for new db.
00044   enum Format {
00045     Unknown=0,
00046     Seg2,
00047     SuLittleEndian,
00048     SuBigEndian,
00049     Tomo,
00050     RD3,
00051     NiSismo,
00052     SacLittleEndian,
00053     SacBigEndian,
00054     Radan,
00055     Gse2,
00056     City2,
00057     Ascii,
00058     GeopsySignal,
00059     Saf,
00060     MultiGse2,
00061     Sismalp,
00062     Wav,
00063     SegYLittleEndian,
00064     SegYBigEndian,
00065     Temporary,
00066     SyscomXmr,
00067     SyscomSmr,
00068     SyscomVmrx,
00069     GuralpGcf,
00070     AsciiGeoSig,
00071     MiniSeed,
00072     AsciiOneColumn,
00073     PasscalSegYBigEndian,
00074     PasscalSegYLittleEndian,
00075     SegD,
00076     Custom,
00077     Fourier,
00078     FormatCount  // Must be the last one, used to count the available file formats
00079   };
00080   enum Storage {Single, Multi};
00081 
00082   SignalFileFormat(Format f=Unknown, AbstractFileFormat * customFormat=0);
00083   SignalFileFormat(const SignalFileFormat& o);
00084   ~SignalFileFormat();
00085 
00086   void operator=(const SignalFileFormat& o);
00087   bool operator==(const SignalFileFormat& o) const;
00088   bool operator<(const SignalFileFormat& o) const;
00089 
00090   Format id() const {return _id;}
00091   const AbstractFileFormat * customFormat() const {return _customFormat;}
00092   bool isReadOnly() const;
00093   Storage storage() const;
00094 
00095   QString toString() const;
00096   QString caption() const;
00097   QString captionFilter() const;
00098   QString filter() const;
00099   QString suffix() const;
00100 
00101   static SignalFileFormat fromContent(QString fileName);
00102   static SignalFileFormat fromSuffix(QString fileName, bool defaultEndianess=true);
00103   static SignalFileFormat fromString(QString f);
00104   static QList< QPair<QString, SignalFileFormat> > importList();
00105 private:
00106   Format _id;
00107   AbstractFileFormat * _customFormat;
00108 };
00109 
00110 #define SIGNALFILEFORMAT_READONLY \
00111   case SignalFileFormat::RD3: \
00112   case SignalFileFormat::NiSismo: \
00113   case SignalFileFormat::Radan: \
00114   case SignalFileFormat::City2: \
00115   case SignalFileFormat::Sismalp: \
00116   case SignalFileFormat::PasscalSegYLittleEndian: \
00117   case SignalFileFormat::PasscalSegYBigEndian: \
00118   case SignalFileFormat::Temporary: \
00119   case SignalFileFormat::SyscomXmr: \
00120   case SignalFileFormat::SyscomSmr: \
00121   case SignalFileFormat::SyscomVmrx: \
00122   case SignalFileFormat::GuralpGcf: \
00123   case SignalFileFormat::AsciiGeoSig: \
00124   case SignalFileFormat::SegD: \
00125   case SignalFileFormat::Fourier: \
00126   case SignalFileFormat::FormatCount: \
00127   case SignalFileFormat::Unknown:
00128 
00129 } // namespace GeopsyCore
00130 
00131 #endif // SIGNALFILEFORMAT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines