Clean up interdace of Mission class

This commit is contained in:
Alexander Bock
2017-05-09 11:17:14 +01:00
parent ab192959c5
commit 701b3afb2c
2 changed files with 13 additions and 11 deletions

View File

@@ -62,26 +62,25 @@ public:
* Returns the name of the MissionPhase.
* \return The name of the MissionPhase
*/
const std::string& name() const;
std::string name() const;
/**
* Returns the TimeRange of the MissionPhase.
* \return The TimeRange of the MissionPhase
*/
const TimeRange& timeRange() const;
TimeRange timeRange() const;
/**
* Returns the description of the MissionPhase.
* \return The description of the MissionPhase
*/
const std::string& description() const;
std::string description() const;
/**
* Returns all subphases sorted by start time.
* \return All subphases sorted by start time
*/
const std::vector<MissionPhase>& phases() const;
std::vector<MissionPhase> phases() const;
using Trace = std::vector<std::reference_wrapper<const MissionPhase>>;
@@ -111,6 +110,7 @@ protected:
* \param time The time which the subphases have to cover to be added to the \p trace
* \param trace The list of MissionPhase%s that are active during the time \p time
* \param maxDepth The maximum depth of levels that will be considered
* \pre maxDepth must not be negative
*/
void phaseTrace(double time, Trace& trace, int maxDepth) const;
@@ -139,7 +139,7 @@ using Mission = MissionPhase;
* \pre \p filename must not contain tokens
* \pre \p filename must exist
*/
Mission missionFromFile(std::string filename);
Mission missionFromFile(const std::string& filename);
} // namespace openspace

View File

@@ -137,19 +137,19 @@ MissionPhase::MissionPhase(const ghoul::Dictionary& dict) {
}
}
const std::string & MissionPhase::name() const {
std::string MissionPhase::name() const {
return _name;
}
const TimeRange & MissionPhase::timeRange() const {
TimeRange MissionPhase::timeRange() const {
return _timeRange;
}
const std::string & MissionPhase::description() const {
std::string MissionPhase::description() const {
return _description;
}
const std::vector<MissionPhase>& MissionPhase::phases() const {
std::vector<MissionPhase> MissionPhase::phases() const {
return _subphases;
}
@@ -163,6 +163,8 @@ MissionPhase::Trace MissionPhase::phaseTrace(double time, int maxDepth) const {
}
void MissionPhase::phaseTrace(double time, Trace& trace, int maxDepth) const {
ghoul_assert(maxDepth >= 0, "maxDepth must not be negative");
if (maxDepth == 0) {
return;
}
@@ -180,7 +182,7 @@ void MissionPhase::phaseTrace(double time, Trace& trace, int maxDepth) const {
}
}
Mission missionFromFile(std::string filename) {
Mission missionFromFile(const std::string& filename) {
ghoul_assert(!filename.empty(), "filename must not be empty");
ghoul_assert(!FileSys.containsToken(filename), "filename must not contain tokens");
ghoul_assert(FileSys.fileExists(filename), "filename must exist");