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