mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Add result of parsing/importing to PRS1 chunk and session YAML.
This commit is contained in:
parent
330bdb6fb3
commit
7a00009a56
@ -100,12 +100,12 @@ void parseAndEmitSessionYaml(const QString & path)
|
||||
|
||||
// Run the parser
|
||||
PRS1Import* import = dynamic_cast<PRS1Import*>(task);
|
||||
import->ParseSession();
|
||||
bool ok = import->ParseSession();
|
||||
|
||||
// Emit the parsed session data to compare against our regression benchmarks
|
||||
Session* session = import->session;
|
||||
QString outpath = prs1OutputPath(path, m->serial(), session->session(), "-session.yml");
|
||||
SessionToYaml(outpath, session);
|
||||
SessionToYaml(outpath, session, ok);
|
||||
|
||||
delete session;
|
||||
delete task;
|
||||
@ -150,13 +150,14 @@ static QString byteList(QByteArray data, int limit=-1)
|
||||
return s;
|
||||
}
|
||||
|
||||
void ChunkToYaml(QFile & file, PRS1DataChunk* chunk)
|
||||
void ChunkToYaml(QFile & file, PRS1DataChunk* chunk, bool ok)
|
||||
{
|
||||
QTextStream out(&file);
|
||||
|
||||
// chunk header
|
||||
out << "chunk:" << endl;
|
||||
out << " at: " << hex << chunk->m_filepos << endl;
|
||||
out << " parsed: " << ok << endl;
|
||||
out << " version: " << dec << chunk->fileVersion << endl;
|
||||
out << " size: " << chunk->blockSize << endl;
|
||||
out << " htype: " << chunk->htype << endl;
|
||||
@ -302,17 +303,18 @@ void parseAndEmitChunkYaml(const QString & path)
|
||||
QList<PRS1DataChunk *> chunks = s_loader->ParseFile(inpath);
|
||||
for (int i=0; i < chunks.size(); i++) {
|
||||
PRS1DataChunk * chunk = chunks.at(i);
|
||||
bool ok = true;
|
||||
|
||||
// Parse the inner data.
|
||||
switch (chunk->ext) {
|
||||
case 0: chunk->ParseCompliance(); break;
|
||||
case 1: chunk->ParseSummary(); break;
|
||||
case 2: chunk->ParseEvents(MODE_UNKNOWN); break;
|
||||
case 0: ok = chunk->ParseCompliance(); break;
|
||||
case 1: ok = chunk->ParseSummary(); break;
|
||||
case 2: ok = chunk->ParseEvents(MODE_UNKNOWN); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
// Emit the YAML.
|
||||
ChunkToYaml(file, chunk);
|
||||
ChunkToYaml(file, chunk, ok);
|
||||
delete chunk;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ static QString intList(quint32* data, int count, int limit=-1)
|
||||
return s;
|
||||
}
|
||||
|
||||
void SessionToYaml(QString filepath, Session* session)
|
||||
void SessionToYaml(QString filepath, Session* session, bool ok)
|
||||
{
|
||||
QFile file(filepath);
|
||||
if (!file.open(QFile::WriteOnly | QFile::Truncate)) {
|
||||
@ -182,6 +182,7 @@ void SessionToYaml(QString filepath, Session* session)
|
||||
out << " id: " << session->session() << endl;
|
||||
out << " start: " << ts(session->first()) << endl;
|
||||
out << " end: " << ts(session->last()) << endl;
|
||||
out << " valid: " << ok << endl;
|
||||
|
||||
if (!session->m_slices.isEmpty()) {
|
||||
out << " slices:" << endl;
|
||||
|
@ -11,6 +11,6 @@
|
||||
|
||||
#include "../SleepLib/session.h"
|
||||
|
||||
void SessionToYaml(QString filepath, Session* session);
|
||||
void SessionToYaml(QString filepath, Session* session, bool ok);
|
||||
|
||||
#endif // SESSIONTESTS_H
|
||||
|
Loading…
Reference in New Issue
Block a user