Skip to content

Commit

Permalink
added missing getter
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Nov 25, 2023
1 parent cbd4324 commit 5ffd21d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions api/python/src/dlplan/policy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ class Policy:
@overload
def evaluate_effects(self, source_state: State, target_state: State, rules: List[Rule], caches: DenotationsCaches) -> bool: ...
def get_rules(self) -> MutableSet[Rule]: ...
def get_booleans(self) -> MutableSet[Boolean]: ...
def get_numericals(self) -> MutableSet[Numerical]: ...
def get_booleans(self) -> MutableSet[NamedBoolean]: ...
def get_numericals(self) -> MutableSet[NamedNumerical]: ...
def get_concepts(self) -> MutableSet[NamedConcept]: ...


class PolicyFactory:
Expand Down
1 change: 1 addition & 0 deletions api/python/src/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void init_policy(py::module_ &m_policy) {
.def("get_rules", &policy::Policy::get_rules)
.def("get_booleans", &policy::Policy::get_booleans)
.def("get_numericals", &policy::Policy::get_numericals)
.def("get_concepts", &policy::Policy::get_concepts)
;

// py::overload_cast<>(&policy::PolicyFactory::str, py::const_)
Expand Down
2 changes: 2 additions & 0 deletions include/dlplan/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class Policy : public Base<Policy> {
private:
Booleans m_booleans;
Numericals m_numericals;
Concepts m_concepts;
Rules m_rules;

Policy(int identifier, const Rules& rules);
Expand Down Expand Up @@ -230,6 +231,7 @@ class Policy : public Base<Policy> {

const Booleans& get_booleans() const;
const Numericals& get_numericals() const;
const Concepts& get_concepts() const;
const Rules& get_rules() const;
};

Expand Down
11 changes: 7 additions & 4 deletions src/policy/policy_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ struct InsertNamedElementFromEffect : public BaseEffectVisitor {

Policy::Policy(int identifier, const Rules& rules)
: Base<Policy>(identifier), m_rules(rules) {
// Retrieve boolean and numericals from the rules.
Concepts concepts;
InsertNamedElementFromCondition condition_visitor(m_booleans, m_numericals, concepts);
InsertNamedElementFromEffect effect_visitor(m_booleans, m_numericals, concepts);
// Retrieve boolean, numericals, and concepts from the rules.
InsertNamedElementFromCondition condition_visitor(m_booleans, m_numericals, m_concepts);
InsertNamedElementFromEffect effect_visitor(m_booleans, m_numericals, m_concepts);
for (const auto& rule : m_rules) {
for (const auto& condition : rule->get_conditions()) {
condition->accept(condition_visitor);
Expand Down Expand Up @@ -241,6 +240,10 @@ const Numericals& Policy::get_numericals() const {
return m_numericals;
}

const Concepts& Policy::get_concepts() const {
return m_concepts;
}

const Rules& Policy::get_rules() const {
return m_rules;
}
Expand Down

0 comments on commit 5ffd21d

Please sign in to comment.