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 : 2003-11-10 00022 ** Authors : 00023 ** Marc Wathelet 00024 ** Marc Wathelet (ULg, Liège, Belgium) 00025 ** Marc Wathelet (LGIT, Grenoble, France) 00026 ** 00027 ***************************************************************************/ 00028 00029 #ifndef SIGNALFILEPOOL_H 00030 #define SIGNALFILEPOOL_H 00031 00032 #include <QGpCoreTools.h> 00033 #include "GeopsyCoreDLLExport.h" 00034 #include "SignalFile.h" 00035 #include "SignalFileFormat.h" 00036 00037 namespace GeopsyCore { 00038 00039 class SignalDB; 00040 00041 class GEOPSYCORE_EXPORT SignalFilePool : private QList<SignalFile *> 00042 { 00043 TRANSLATIONS("SignalFilePool") 00044 public: 00045 SignalFilePool(SignalDB * db) {_db=db;} 00046 ~SignalFilePool(); 00047 00048 typedef QList<SignalFile *>::iterator iterator; 00049 typedef QList<SignalFile *>::const_iterator const_iterator; 00050 SignalFile * last() const {return QList<SignalFile *>::last();} 00051 SignalFile * at(int index) const {return QList<SignalFile *>::at(index);} 00052 int indexOf(SignalFile * f) const {return QList<SignalFile *>::indexOf(f);} 00053 int count() const {return QList<SignalFile *>::count();} 00054 const_iterator begin() const {return QList<SignalFile *>::begin();} 00055 const_iterator end() const {return QList<SignalFile *>::end();} 00056 iterator begin() {return QList<SignalFile *>::begin();} 00057 iterator end() {return QList<SignalFile *>::end();} 00058 void add(const SignalFilePool& files); 00059 00060 SignalFile * find(QString fileName) const; 00061 bool load(QString name, SignalFileFormat format=SignalFileFormat::Unknown); 00062 private: 00063 friend class SignalDB; 00064 void clear(); 00065 void remove (SignalFile * f); 00066 void insert(int before, SignalFile * f) {QList<SignalFile *>::insert(before, f);} 00067 void move(int from, int to) {QList<SignalFile *>::move(from, to);} 00068 void append(SignalFile * f) {QList<SignalFile *>::append(f);} 00069 SignalDB * _db; 00070 }; 00071 00072 } // namespace GeopsyCore 00073 00074 #endif // SIGNALFILEPOOL_H