more work to get rid of raw pointers.

This commit is contained in:
2023-10-17 16:35:54 +02:00
parent ff9245fd28
commit ca742a064f
8 changed files with 89 additions and 239 deletions

View File

@ -555,12 +555,7 @@ int main(int argc, char *argv[])
run_list += arg[i] + " ";
}
// parse run_list string
std::unique_ptr<PStringNumberList> nl = std::unique_ptr<PStringNumberList>(new PStringNumberList(run_list));
if (nl == nullptr) { // couldn't invoke object
std::cerr << std::endl;
std::cerr << ">> msr2data: **ERROR** Couldn't invoke run_list parser object! Quitting now." << std::endl;
return 0;
}
std::unique_ptr<PStringNumberList> nl = std::make_unique<PStringNumberList>(run_list);
std::string errorMsg("");
if (!nl->Parse(errorMsg)) {
std::cerr << std::endl;
@ -662,12 +657,7 @@ int main(int argc, char *argv[])
realOutput = false;
// create the msr2data-object and set the run numbers according to the runTAG above
std::unique_ptr<PMsr2Data> msr2dataHandler = std::unique_ptr<PMsr2Data>(new PMsr2Data(msrExtension));
if (msr2dataHandler == nullptr) {
std::cerr << std::endl;
std::cerr << ">> msr2data: **ERROR** couldn't invoke msr2dataHandler." << std::endl;
return -1;
}
std::unique_ptr<PMsr2Data> msr2dataHandler = std::make_unique<PMsr2Data>(msrExtension);
int status;
@ -801,7 +791,7 @@ int main(int argc, char *argv[])
// delete old db/data file if the "new" option is given
if (!msr2data_useOption(arg, "new")) {
fileOutput = std::unique_ptr<std::fstream>(new std::fstream);
fileOutput = std::make_unique<std::fstream>();
fileOutput->open(outputFile.c_str(), std::ios::in);
if (fileOutput->is_open()) {
std::cout << std::endl << ">> msr2data: **INFO** Deleting output file " << outputFile << std::endl;
@ -980,7 +970,7 @@ int main(int argc, char *argv[])
// Unfortunately, there are also problems with boost::filesystem::exists(outputFile)
// Therefore, first try to open the file for reading and if this works, write to it - not clean but it works
if (realOutput) {
fileOutput = std::unique_ptr<std::fstream>(new std::fstream);
fileOutput = std::make_unique<std::fstream>();
fileOutput->open(outputFile.c_str(), std::ios::in);
if (fileOutput->is_open()) {
fileOutput->close();