patrick
/
plasp
Archived
1
0
Fork 0
This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
plasp/include/plasp/pddl/expressions/Either.h

56 lines
1.3 KiB
C++

#ifndef __PLASP__PDDL__EXPRESSION__EITHER_H
#define __PLASP__PDDL__EXPRESSION__EITHER_H
#include <plasp/pddl/expressions/NAry.h>
namespace plasp
{
namespace pddl
{
namespace expressions
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Either
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class Either: public NAry
{
public:
template<typename ExpressionParser>
static EitherPointer parse(Context &context, const Variables &parameters,
ExpressionParser parseExpression);
public:
void accept(ExpressionVisitor &expressionVisitor) const override;
private:
Either() = default;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename ExpressionParser>
EitherPointer Either::parse(Context &context, const Variables &parameters,
ExpressionParser parseExpression)
{
auto expression = std::make_unique<Either>(Either());
expression->NAry::parse(context, parameters, parseExpression);
if (expression->arguments().empty())
throw ConsistencyException("\"and\" expressions should not be empty");
return expression;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}
#endif