void OutputTableBase::openFile(QString appendix) {
    QString fileNameApp = insertAppendix(fileName, appendix);
    QString useFileName = (runNumber() == 1 || hasSummary()) ?
                          fileNameApp : insertNumber(fileNameApp, runNumber());

    QString path = FileLocations::location(FileLocationInfo::Output).absolutePath();
    QString filePath = path + "/" + useFileName;
    outputFilePaths << filePath;

    file.setFileName(filePath);
    if (!file.open(QIODevice::Text | QIODevice::WriteOnly))
        throw Exception("Could not open output file to write table:\n'" + filePath + "'");

    // If more than one file then give the first file a number too
    if (runNumber() == 2 && !hasSummary()) {
        QString filePath = path + "/" + fileNameApp;
        QFile prevFile(filePath);

        QString newName = path + "/" + insertNumber(fileNameApp, 1);
        outputFilePaths[0] = newName;

        // Delete any existing file named newName
        QFile toDelete(newName);
        toDelete.remove();
        prevFile.rename(newName);
    }
}
Beispiel #2
0
void OutputTable::debrief() {
    if (hasSummary()) {
        openFile();
        writeLabels();
        writeTraces();
        closeFile();
    }
}
Beispiel #3
0
void OutputTable::cleanup() {
    if (!hasSummary()) {
        openFile();
        writeLabels();
        writeTraces();
        closeFile();
    }
}
Beispiel #4
0
void OutputCrosstab::debrief() {
    if (hasSummary())
        writeFiles();
}
Beispiel #5
0
void OutputCrosstab::cleanup() {
    if (!hasSummary())
        writeFiles();
}