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); } }
void OutputTable::debrief() { if (hasSummary()) { openFile(); writeLabels(); writeTraces(); closeFile(); } }
void OutputTable::cleanup() { if (!hasSummary()) { openFile(); writeLabels(); writeTraces(); closeFile(); } }
void OutputCrosstab::debrief() { if (hasSummary()) writeFiles(); }
void OutputCrosstab::cleanup() { if (!hasSummary()) writeFiles(); }