make Action::ActionX constructible from variables
also make it default constructible, add accessors and equality operator
This commit is contained in:
@@ -63,9 +63,19 @@ namespace Action {
|
||||
|
||||
class ActionX {
|
||||
public:
|
||||
ActionX();
|
||||
ActionX(const std::string& name, size_t max_run, double max_wait, std::time_t start_time);
|
||||
ActionX(const DeckKeyword& kw, std::time_t start_time);
|
||||
ActionX(const DeckRecord& record, std::time_t start_time);
|
||||
ActionX(const std::string& nam,
|
||||
size_t maxRun,
|
||||
double minWait,
|
||||
std::time_t startTime,
|
||||
const std::vector<DeckKeyword>& keyword,
|
||||
const AST& cond,
|
||||
const std::vector<Condition>& conditions,
|
||||
size_t runCount,
|
||||
std::time_t lastRun);
|
||||
|
||||
void addKeyword(const DeckKeyword& kw);
|
||||
bool ready(std::time_t sim_time) const;
|
||||
@@ -84,8 +94,15 @@ public:
|
||||
The conditions() and keyword_strings() methods, and their underlying data
|
||||
members are only present to support writing formatted restart files.
|
||||
*/
|
||||
const std::vector<DeckKeyword>& getKeywords() const;
|
||||
const std::vector<Condition>& conditions() const;
|
||||
const Action::AST& getCondition() const;
|
||||
std::vector<std::string> keyword_strings() const;
|
||||
size_t getRunCount() const;
|
||||
std::time_t getLastRun() const;
|
||||
|
||||
bool operator==(const ActionX& data) const;
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
size_t m_max_run = 0;
|
||||
|
||||
@@ -36,6 +36,12 @@ bool ActionX::valid_keyword(const std::string& keyword) {
|
||||
}
|
||||
|
||||
|
||||
ActionX::ActionX() :
|
||||
m_start_time(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ActionX::ActionX(const std::string& name, size_t max_run, double min_wait, std::time_t start_time) :
|
||||
m_name(name),
|
||||
m_max_run(max_run),
|
||||
@@ -70,6 +76,29 @@ ActionX::ActionX(const DeckKeyword& kw, std::time_t start_time) :
|
||||
}
|
||||
|
||||
|
||||
ActionX::ActionX(const std::string& nam,
|
||||
size_t maxRun,
|
||||
double minWait,
|
||||
std::time_t startTime,
|
||||
const std::vector<DeckKeyword>& keyword,
|
||||
const AST& cond,
|
||||
const std::vector<Condition>& conditions,
|
||||
size_t runCount,
|
||||
std::time_t lastRun) :
|
||||
m_name(nam),
|
||||
m_max_run(maxRun),
|
||||
m_min_wait(minWait),
|
||||
m_start_time(startTime),
|
||||
keywords(keyword),
|
||||
condition(cond),
|
||||
m_conditions(conditions),
|
||||
run_count(runCount),
|
||||
last_run(lastRun)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ActionX::addKeyword(const DeckKeyword& kw) {
|
||||
this->keywords.push_back(kw);
|
||||
}
|
||||
@@ -150,5 +179,36 @@ const std::vector<Condition>& ActionX::conditions() const {
|
||||
return this->m_conditions;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<DeckKeyword>& ActionX::getKeywords() const {
|
||||
return this->keywords;
|
||||
}
|
||||
|
||||
|
||||
size_t ActionX::getRunCount() const {
|
||||
return run_count;
|
||||
}
|
||||
|
||||
std::time_t ActionX::getLastRun() const {
|
||||
return last_run;
|
||||
}
|
||||
|
||||
const AST& ActionX::getCondition() const {
|
||||
return condition;
|
||||
}
|
||||
|
||||
|
||||
bool ActionX::operator==(const ActionX& data) const {
|
||||
return this->name() == data.name() &&
|
||||
this->max_run() == data.max_run() &&
|
||||
this->min_wait() == data.min_wait() &&
|
||||
this->start_time() == data.start_time() &&
|
||||
this->getKeywords() == data.getKeywords() &&
|
||||
this->getCondition() == data.getCondition() &&
|
||||
this->conditions() == data.conditions() &&
|
||||
this->getRunCount() == data.getRunCount() &&
|
||||
this->getLastRun() == data.getLastRun();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user