Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ASCIISIGNALFORMAT_H
00029 #define ASCIISIGNALFORMAT_H
00030
00031 #include "AbstractFileFormat.h"
00032 #include "AsciiSignalFormatRule.h"
00033 #include "AsciiSignalFormatComponent.h"
00034 #include "GeopsyCoreDLLExport.h"
00035
00036 namespace GeopsyCore {
00037
00038 class GEOPSYCORE_EXPORT AsciiSignalFormat : public AbstractFileFormat
00039 {
00040 TRANSLATIONS("AsciiSignalFormat")
00041 public:
00042 AsciiSignalFormat();
00043 AsciiSignalFormat(const AsciiSignalFormat& o);
00044
00045 void operator=(const AsciiSignalFormat& o);
00046
00047 virtual const QString& xml_tagName() const {return xmlAsciiSignalFormatTag;}
00048 static const QString xmlAsciiSignalFormatTag;
00049
00050 enum HeaderType {NoHeader, FixedHeader, HeaderPattern, EndHeaderPattern};
00051
00052 void setHeaderType(HeaderType t) {_headerType=t;}
00053 void setHeaderType(const QString& t);
00054 HeaderType headerType() const {return _headerType;}
00055 QString headerTypeString() const;
00056
00057 const QString& headerPattern() const {return _headerPattern;}
00058 void setHeaderPattern(const QString& h) {_headerPattern=h;}
00059
00060 int headerLineCount() const {return _headerLineCount;}
00061 void setHeaderLineCount(int h) {_headerLineCount=h;}
00062
00063 const QString& timeFormat() const {return _timeFormat;}
00064 void setTimeFormat(const QString& t) {_timeFormat=t;}
00065
00066 void insertComponent(int index, const AsciiSignalFormatComponent& c) {_components.insert(index, c);}
00067 void removeComponent(int index) {_components.remove(index);}
00068 int componentCount() const {return _components.count();}
00069 const AsciiSignalFormatComponent& component(int index) const {return _components.at(index);}
00070 AsciiSignalFormatComponent& component(int index) {return _components[index];}
00071
00072 void insertRule(int index, const AsciiSignalFormatRule& r) {_rules.insert(index, r);}
00073 void removeRule(int index) {_rules.remove(index);}
00074 int ruleCount() const {return _rules.count();}
00075 const AsciiSignalFormatRule& rule(int index) const {return _rules.at(index);}
00076 AsciiSignalFormatRule& rule(int index) {return _rules[index];}
00077
00078 QString header(QTextStream& s, int& lineNumber, QAtomicInt * terminate=0);
00079 bool parseHeader(const QString& headerText, QAtomicInt * terminate=0);
00080 double t0() const;
00081 QDateTime timeReference() const;
00082 void assign(Signal * sig);
00083
00084 virtual SignalFileFormat::Format format() const {return SignalFileFormat::Ascii;}
00085 virtual int complexity() const;
00086 virtual bool isValid(const QString& fileName) const;
00087 protected:
00088 virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00089 virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00090 virtual XMLMember xml_member(XML_MEMBER_ARGS);
00091 virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00092 private:
00093 HeaderType _headerType;
00094 QString _headerPattern;
00095 int _headerLineCount;
00096
00097 QString _timeFormat;
00098 QVector<AsciiSignalFormatComponent> _components;
00099 QVector<AsciiSignalFormatRule> _rules;
00100 };
00101
00102 }
00103
00104 #endif // ASCIISIGNALFORMAT_H