array_store_all.h
Go to the documentation of this file.
/********************* */
#include "cvc4_public.h"
#pragma once
namespace CVC4 {
// messy; Expr needs ArrayStoreAll (because it's the payload of a
// CONSTANT-kinded expression), and ArrayStoreAll needs Expr.
class CVC4_PUBLIC ArrayStoreAll;
}/* CVC4 namespace */
#include "expr/expr.h"
#include "expr/type.h"
#include <iostream>
namespace CVC4 {
class CVC4_PUBLIC ArrayStoreAll {
const ArrayType d_type;
const Expr d_expr;
public:
ArrayStoreAll(ArrayType type, Expr expr) throw(IllegalArgumentException) :
d_type(type),
d_expr(expr) {
// this check is stronger than the assertion check in the expr manager that ArrayTypes are actually array types
// because this check is done in production builds too
CheckArgument(type.isArray(), type, "array store-all constants can only be created for array types, not `%s'", type.toString().c_str());
CheckArgument(expr.getType().isSubtypeOf(type.getConstituentType()), expr, "expr type `%s' does not match constituent type of array type `%s'", expr.getType().toString().c_str(), type.toString().c_str());
CheckArgument(expr.isConst(), expr, "ArrayStoreAll requires a constant expression");
}
~ArrayStoreAll() throw() {
}
ArrayType getType() const throw() {
return d_type;
}
Expr getExpr() const throw() {
return d_expr;
}
bool operator==(const ArrayStoreAll& asa) const throw() {
return d_type == asa.d_type && d_expr == asa.d_expr;
}
bool operator!=(const ArrayStoreAll& asa) const throw() {
return !(*this == asa);
}
bool operator<(const ArrayStoreAll& asa) const throw() {
return d_type < asa.d_type ||
(d_type == asa.d_type && d_expr < asa.d_expr);
}
bool operator<=(const ArrayStoreAll& asa) const throw() {
return d_type < asa.d_type ||
(d_type == asa.d_type && d_expr <= asa.d_expr);
}
bool operator>(const ArrayStoreAll& asa) const throw() {
return !(*this <= asa);
}
bool operator>=(const ArrayStoreAll& asa) const throw() {
return !(*this < asa);
}
};/* class ArrayStoreAll */
std::ostream& operator<<(std::ostream& out, const ArrayStoreAll& asa) CVC4_PUBLIC;
struct CVC4_PUBLIC ArrayStoreAllHashFunction {
inline size_t operator()(const ArrayStoreAll& asa) const {
return TypeHashFunction()(asa.getType()) * ExprHashFunction()(asa.getExpr());
}
};/* struct ArrayStoreAllHashFunction */
}/* CVC4 namespace */
CVC4::ArrayStoreAll
Definition array_store_all.h:35
CVC4::ArrayStoreAll::operator<=
bool operator<=(const ArrayStoreAll &asa) const
Definition array_store_all.h:74
CVC4::ArrayStoreAll::ArrayStoreAll
ArrayStoreAll(ArrayType type, Expr expr)
Definition array_store_all.h:41
CVC4::ArrayStoreAll::operator!=
bool operator!=(const ArrayStoreAll &asa) const
Definition array_store_all.h:66
CVC4::ArrayStoreAll::operator==
bool operator==(const ArrayStoreAll &asa) const
Definition array_store_all.h:63
CVC4::ArrayStoreAll::getType
ArrayType getType() const
Definition array_store_all.h:56
CVC4::ArrayStoreAll::~ArrayStoreAll
~ArrayStoreAll()
Definition array_store_all.h:53
CVC4::ArrayStoreAll::operator<
bool operator<(const ArrayStoreAll &asa) const
Definition array_store_all.h:70
CVC4::ArrayStoreAll::operator>
bool operator>(const ArrayStoreAll &asa) const
Definition array_store_all.h:78
CVC4::ArrayStoreAll::operator>=
bool operator>=(const ArrayStoreAll &asa) const
Definition array_store_all.h:81
CVC4::ArrayStoreAll::getExpr
Expr getExpr() const
Definition array_store_all.h:59
CVC4::ArrayType
Class encapsulating an array type.
Definition type.h:484
CVC4::Expr
Class encapsulating CVC4 expressions and methods for constructing new expressions.
Definition expr.h:227
CVC4::IllegalArgumentException
Definition exception.h:79
cvc4_public.h
Macros that should be defined everywhere during the building of the libraries and driver binary,...
CVC4_PUBLIC
#define CVC4_PUBLIC
Definition cvc4_public.h:30
expr.h
CVC4
Definition expr.h:106
CVC4::operator<<
std::ostream & operator<<(std::ostream &out, const TypeCheckingException &e)
CVC4::CheckArgument
void CheckArgument(bool cond, const T &arg, const char *fmt,...)
Definition exception.h:140
CVC4::ArrayStoreAllHashFunction
Hash function for the ArrayStoreAll constants.
Definition array_store_all.h:92
CVC4::ArrayStoreAllHashFunction::operator()
size_t operator()(const ArrayStoreAll &asa) const
Definition array_store_all.h:93
CVC4::ExprHashFunction
Definition expr.h:219
CVC4::TypeHashFunction
Hash function for Types.
Definition type.h:69
type.h
Interface for expression types.