Commit 510e8fdc authored by Alejandro Suarez Hernandez's avatar Alejandro Suarez Hernandez
Browse files

Merge branch 'master' of github.com:IMAGINE-H2020/csic_imagine_planner

parents 66343065 ece3853e
......@@ -117,6 +117,42 @@ void Domain::set_ades_db(const std::string& ades_db, std::size_t version_db)
load_ades();
}
void Domain::clear()
{
name_ = "";
ades_db_ = "";
version_db_ = 0;
ops_.clear();
}
bool Domain::add_operator(const Operator& op)
{
bool exists = false;
for (const auto& other : ops_)
{
if (other.get_name() == op.get_name())
{
exists = true;
break;
}
}
if (not exists) ops_.emplace_back(op);
return not exists;
}
bool Domain::delete_operator(const std::string& name)
{
auto it = ops_.begin();
bool deleted = false;
while (it != ops_.end() and it->get_name() != name) ++it;
if (it != ops_.end())
{
ops_.erase(it);
deleted = true;
}
return deleted;
}
std::vector<Operator> Domain::instantiate_all(const PlanState::Ptr& state) const
{
std::vector<Operator> all;
......
......@@ -72,12 +72,28 @@ class Domain : public Stringifiable
virtual std::string to_str() const override;
const std::string& get_name() const { return name_; }
const std::string& get_ades_db() const { return ades_db_; }
std::size_t get_version_db() const { return version_db_; }
void set_name(const std::string& name) { name_ = name; }
void set_ades_db(const std::string& ades_db, std::size_t version_db=0);
void clear();
bool add_operator(const Operator& op);
bool delete_operator(const std::string& name);
bool add_operator(const std::string& name, const std::string& pre,
const std::string& eff)
{
return add_operator(Operator(name, pre, eff));
}
const std::vector<Operator>& get_operators() const
{
return ops_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment