Skip to content

Commit

Permalink
fix formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Aug 14, 2024
1 parent 9a0c04d commit cc112ca
Show file tree
Hide file tree
Showing 45 changed files with 388 additions and 381 deletions.
1 change: 0 additions & 1 deletion include/loki/details/ast/printer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#define LOKI_INCLUDE_LOKI_AST_PRINTER_HPP_

#include "loki/details/ast/ast.hpp"
#include "loki/details/pddl/formatter.hpp"

namespace loki
{
Expand Down
2 changes: 2 additions & 0 deletions include/loki/details/pddl/action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class ActionImpl
const std::optional<Effect>& get_effect() const;
};

extern std::ostream& operator<<(std::ostream& out, const ActionImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/atom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class AtomImpl
const TermList& get_terms() const;
};

extern std::ostream& operator<<(std::ostream& out, const AtomImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/axiom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class AxiomImpl
size_t get_num_parameters_to_ground_head() const;
};

extern std::ostream& operator<<(std::ostream& out, const AxiomImpl& element);

}

#endif
9 changes: 9 additions & 0 deletions include/loki/details/pddl/conditions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ class ConditionForallImpl
const Condition& get_condition() const;
};

extern std::ostream& operator<<(std::ostream& out, const ConditionLiteralImpl& element);
extern std::ostream& operator<<(std::ostream& out, const ConditionAndImpl& element);
extern std::ostream& operator<<(std::ostream& out, const ConditionOrImpl& element);
extern std::ostream& operator<<(std::ostream& out, const ConditionNotImpl& element);
extern std::ostream& operator<<(std::ostream& out, const ConditionImplyImpl& element);
extern std::ostream& operator<<(std::ostream& out, const ConditionExistsImpl& element);
extern std::ostream& operator<<(std::ostream& out, const ConditionForallImpl& element);
extern std::ostream& operator<<(std::ostream& out, const ConditionImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class DomainImpl
const AxiomList& get_axioms() const;
};

extern std::ostream& operator<<(std::ostream& out, const DomainImpl& element);

}

#endif
7 changes: 7 additions & 0 deletions include/loki/details/pddl/effects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ class EffectConditionalWhenImpl
const Effect& get_effect() const;
};

extern std::ostream& operator<<(std::ostream& out, const EffectLiteralImpl& element);
extern std::ostream& operator<<(std::ostream& out, const EffectAndImpl& element);
extern std::ostream& operator<<(std::ostream& out, const EffectNumericImpl& element);
extern std::ostream& operator<<(std::ostream& out, const EffectConditionalForallImpl& element);
extern std::ostream& operator<<(std::ostream& out, const EffectConditionalWhenImpl& element);
extern std::ostream& operator<<(std::ostream& out, const EffectImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class FunctionImpl
const TermList& get_terms() const;
};

extern std::ostream& operator<<(std::ostream& out, const FunctionImpl& element);

}

#endif
7 changes: 7 additions & 0 deletions include/loki/details/pddl/function_expressions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ class FunctionExpressionFunctionImpl
const Function& get_function() const;
};

extern std::ostream& operator<<(std::ostream& out, const FunctionExpressionNumberImpl& element);
extern std::ostream& operator<<(std::ostream& out, const FunctionExpressionBinaryOperatorImpl& element);
extern std::ostream& operator<<(std::ostream& out, const FunctionExpressionMultiOperatorImpl& element);
extern std::ostream& operator<<(std::ostream& out, const FunctionExpressionMinusImpl& element);
extern std::ostream& operator<<(std::ostream& out, const FunctionExpressionFunctionImpl& element);
extern std::ostream& operator<<(std::ostream& out, const FunctionExpressionImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/function_skeleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class FunctionSkeletonImpl
const Type& get_type() const;
};

extern std::ostream& operator<<(std::ostream& out, const FunctionSkeletonImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/literal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class LiteralImpl
bool is_negated() const;
const Atom& get_atom() const;
};

extern std::ostream& operator<<(std::ostream& out, const LiteralImpl& element);
}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/metric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class OptimizationMetricImpl
OptimizationMetricEnum get_optimization_metric() const;
const FunctionExpression& get_function_expression() const;
};

extern std::ostream& operator<<(std::ostream& out, const OptimizationMetricImpl& element);
}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/numeric_fluent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class NumericFluentImpl
double get_number() const;
};

extern std::ostream& operator<<(std::ostream& out, const NumericFluentImpl& element);

}

#endif
1 change: 1 addition & 0 deletions include/loki/details/pddl/parameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ParameterImpl
/// by checking whether the types are compatible
extern bool is_specialized_parameter(const Parameter& specialized_parameter, const Parameter& generalized_parameter);

extern std::ostream& operator<<(std::ostream& out, const ParameterImpl& element);
}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/predicate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class PredicateImpl
const ParameterList& get_parameters() const;
};

extern std::ostream& operator<<(std::ostream& out, const PredicateImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/problem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class ProblemImpl
const AxiomList& get_axioms() const;
};

extern std::ostream& operator<<(std::ostream& out, const ProblemImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/requirements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class RequirementsImpl
const RequirementEnumSet& get_requirements() const;
};

extern std::ostream& operator<<(std::ostream& out, const RequirementsImpl& element);

}

#endif
4 changes: 4 additions & 0 deletions include/loki/details/pddl/term.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class TermVariableImpl
const Variable& get_variable() const;
};

extern std::ostream& operator<<(std::ostream& out, const TermObjectImpl& element);
extern std::ostream& operator<<(std::ostream& out, const TermVariableImpl& element);
extern std::ostream& operator<<(std::ostream& out, const TermImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ extern TypeSet collect_types_from_hierarchy(const TypeList& types);
/// @brief Return true iff type is a subtype of or equal to one of the types in parent_types
extern bool is_subtype_or_equal(const Type& type, const TypeList& parent_types);

extern std::ostream& operator<<(std::ostream& out, const TypeImpl& element);

}

#endif
2 changes: 2 additions & 0 deletions include/loki/details/pddl/variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class VariableImpl

extern VariableSet collect_free_variables(const loki::ConditionImpl& condition);

extern std::ostream& operator<<(std::ostream& out, const VariableImpl& element);

}

#endif
1 change: 0 additions & 1 deletion include/loki/loki.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "loki/details/pddl/error_reporting.hpp"
#include "loki/details/pddl/exceptions.hpp"
#include "loki/details/pddl/factories.hpp"
#include "loki/details/pddl/formatter.hpp"
#include "loki/details/pddl/function.hpp"
#include "loki/details/pddl/function_expressions.hpp"
#include "loki/details/pddl/function_skeleton.hpp"
Expand Down
8 changes: 8 additions & 0 deletions src/pddl/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "loki/details/pddl/action.hpp"

#include "formatter.hpp"
#include "loki/details/pddl/conditions.hpp"
#include "loki/details/pddl/effects.hpp"
#include "loki/details/pddl/parameter.hpp"
Expand Down Expand Up @@ -50,4 +51,11 @@ const std::optional<Condition>& ActionImpl::get_condition() const { return m_con

const std::optional<Effect>& ActionImpl::get_effect() const { return m_effect; }

std::ostream& operator<<(std::ostream& out, const ActionImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

}
8 changes: 8 additions & 0 deletions src/pddl/atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "loki/details/pddl/atom.hpp"

#include "formatter.hpp"
#include "loki/details/pddl/predicate.hpp"
#include "loki/details/pddl/term.hpp"

Expand All @@ -30,4 +31,11 @@ const Predicate& AtomImpl::get_predicate() const { return m_predicate; }

const TermList& AtomImpl::get_terms() const { return m_terms; }

std::ostream& operator<<(std::ostream& out, const AtomImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

}
8 changes: 8 additions & 0 deletions src/pddl/axiom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "loki/details/pddl/axiom.hpp"

#include "formatter.hpp"
#include "loki/details/pddl/conditions.hpp"
#include "loki/details/pddl/effects.hpp"
#include "loki/details/pddl/literal.hpp"
Expand Down Expand Up @@ -44,4 +45,11 @@ const ParameterList& AxiomImpl::get_parameters() const { return m_parameters; }

size_t AxiomImpl::get_num_parameters_to_ground_head() const { return m_num_parameters_to_ground_head; }

std::ostream& operator<<(std::ostream& out, const AxiomImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

}
56 changes: 56 additions & 0 deletions src/pddl/conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "loki/details/pddl/conditions.hpp"

#include "formatter.hpp"
#include "loki/details/pddl/literal.hpp"
#include "loki/details/pddl/parameter.hpp"

Expand Down Expand Up @@ -93,4 +94,59 @@ const ParameterList& ConditionForallImpl::get_parameters() const { return m_para

const Condition& ConditionForallImpl::get_condition() const { return m_condition; }

std::ostream& operator<<(std::ostream& out, const ConditionLiteralImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

std::ostream& operator<<(std::ostream& out, const ConditionAndImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

std::ostream& operator<<(std::ostream& out, const ConditionOrImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

std::ostream& operator<<(std::ostream& out, const ConditionNotImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

std::ostream& operator<<(std::ostream& out, const ConditionImplyImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

std::ostream& operator<<(std::ostream& out, const ConditionExistsImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

std::ostream& operator<<(std::ostream& out, const ConditionForallImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

std::ostream& operator<<(std::ostream& out, const ConditionImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}
}
8 changes: 8 additions & 0 deletions src/pddl/domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "loki/details/pddl/domain.hpp"

#include "formatter.hpp"
#include "loki/details/pddl/action.hpp"
#include "loki/details/pddl/axiom.hpp"
#include "loki/details/pddl/function_skeleton.hpp"
Expand Down Expand Up @@ -76,4 +77,11 @@ const ActionList& DomainImpl::get_actions() const { return m_actions; }

const AxiomList& DomainImpl::get_axioms() const { return m_axioms; }

std::ostream& operator<<(std::ostream& out, const DomainImpl& element)
{
auto formatter = PDDLFormatter();
formatter.write(element, out);
return out;
}

}
Loading

0 comments on commit cc112ca

Please sign in to comment.