Move Tristate class to separate header

The Tristate class (representing truth values that are either true,
false, or unknown) is used at multiple ends. This moves it to a separate
header for reusing it properly.
This commit is contained in:
Patrick Lühne 2018-04-19 14:41:49 +02:00
parent 2372eb24c4
commit d2b48f9679
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
4 changed files with 27 additions and 11 deletions

View File

@ -2,6 +2,7 @@
#define __ANTHEM__AST_H #define __ANTHEM__AST_H
#include <anthem/ASTForward.h> #include <anthem/ASTForward.h>
#include <anthem/Tristate.h>
namespace anthem namespace anthem
{ {

View File

@ -3,6 +3,7 @@
#include <anthem/AST.h> #include <anthem/AST.h>
#include <anthem/ASTUtils.h> #include <anthem/ASTUtils.h>
#include <anthem/Tristate.h>
namespace anthem namespace anthem
{ {
@ -15,16 +16,6 @@ namespace ast
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: move to separate class
enum class Tristate
{
True,
False,
Unknown,
};
////////////////////////////////////////////////////////////////////////////////////////////////////
Tristate equal(const Formula &lhs, const Formula &rhs); Tristate equal(const Formula &lhs, const Formula &rhs);
Tristate equal(const Term &lhs, const Term &rhs); Tristate equal(const Term &lhs, const Term &rhs);

24
include/anthem/Tristate.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef __ANTHEM__TRISTATE_H
#define __ANTHEM__TRISTATE_H
namespace anthem
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Tristate
//
////////////////////////////////////////////////////////////////////////////////////////////////////
enum class Tristate
{
True,
False,
Unknown,
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endif

View File

@ -363,7 +363,7 @@ struct SimplificationRuleSubsumptionInBiconditionals
std::find_if(and_.arguments.cbegin(), and_.arguments.cend(), std::find_if(and_.arguments.cbegin(), and_.arguments.cend(),
[&](const auto &argument) [&](const auto &argument)
{ {
return (ast::equal(predicateSide, argument) == ast::Tristate::True); return (ast::equal(predicateSide, argument) == Tristate::True);
}); });
if (matchingPredicate == and_.arguments.cend()) if (matchingPredicate == and_.arguments.cend())