More explicit use of "Optional".

This commit is contained in:
2017-10-18 13:00:16 +02:00
parent a151f0f5e3
commit 754874dcf3
4 changed files with 30 additions and 23 deletions

View File

@@ -3,6 +3,7 @@
#include <iostream>
#include <unistd.h>
#include "Options.hpp"
#include "utils.hpp"
using namespace fmri;
using namespace std;
@@ -127,12 +128,20 @@ const string& Options::means() const
return meansPath;
}
const string& Options::labels() const
optional<vector<string>> Options::labels() const
{
return labelsPath;
if (labelsPath.empty()) {
return nullopt;
} else {
return read_vector<string>(labelsPath);
}
}
const string &Options::imageDump() const
std::optional<PNGDumper> Options::imageDumper() const
{
return dumpPath;
if (dumpPath.empty()) {
return nullopt;
} else {
return move(PNGDumper(dumpPath));
}
}