19 #include <QTextStream> 54 int mid = (max + min) / 2;
61 while ((max + 1 < len) && (arr[max + 1] == val)) {
64 return (min + max) / 2;
74 m_error = QFile::tr(
"File \"%1\" does not exist").arg(path);
75 }
else if (!
m_file->open(QIODevice::ReadOnly | QIODevice::Text)) {
76 m_error = QFile::tr(
"Failed to open file \"%1\"").arg(path);
90 SVDEBUG <<
"MatchFileReader::MatchFileReader: Closing file" << endl;
113 if (!
m_file)
return alignment;
137 while (!in.atEnd()) {
139 QString line = in.readLine().trimmed();
140 if (line.startsWith(
"File: ")) {
144 if (fileCount != 2)
continue;
145 if (line.startsWith(
"Marks:") || line.startsWith(
"FixedPoints:")) {
157 count = line.toInt();
160 alignment.
thisIndex.push_back(line.toInt());
163 alignment.
refIndex.push_back(line.toInt());
169 }
else if (state == 3 &&
int(alignment.
thisIndex.size()) == count) {
175 cerr <<
"ERROR in Match file: this hop time == 0, using 0.01 instead" << endl;
180 cerr <<
"ERROR in Match file: ref hop time == 0, using 0.01 instead" << endl;
184 cerr <<
"MatchFileReader: this hop = " << alignment.
thisHopTime <<
", ref hop = " << alignment.
refHopTime <<
", this index count = " << alignment.
thisIndex.size() <<
", ref index count = " << alignment.
refIndex.size() << endl;
double fromReference(double) const
double toReference(double) const
int search(const FrameArray &arr, int val) const
virtual QString getError() const
virtual bool isOK() const
std::vector< int > FrameArray
virtual ~MatchFileReader()
virtual Alignment load() const
MatchFileReader(QString path)