summaryrefslogtreecommitdiff
path: root/src/expr/array_store_all.h
diff options
context:
space:
mode:
authorTim King <taking@google.com>2015-12-24 05:38:43 -0500
committerTim King <taking@google.com>2015-12-24 05:38:43 -0500
commita39ad6584c1d61e22e72b53c3838f4f675ed2e19 (patch)
treeed40cb371c41ac285ca2bf41a82254a36134e132 /src/expr/array_store_all.h
parent87b0fe9ce10d1e5e9ed5a3e7db77f46bf3f68922 (diff)
Miscellaneous fixes
- Splitting the two instances of CheckArgument. The template version is now always defined in base/exception.h and is available in a cvc4_public header. This version has lost its variadic version (due to swig not supporting va_list's). The CPP macro version has been renamed PrettyCheckArgument. (Taking suggestions for a better name.) This is now only defined in base/cvc4_assert.h. Only use this in cvc4_private headers and in .cpp files that can use cvc4_private headers. To use a variadic version of CheckArguments, outside of this scope, you need to duplicate this macro locally. See cvc3_compat.cpp for an example. - Making fitsSignedInt() and fitsUnsignedInt() work more robustly for CLN on 32 bit systems. - Refactoring ArrayStoreAll to avoid potential problems with circular header inclusions. - Changing some headers to use iosfwd when possible.
Diffstat (limited to 'src/expr/array_store_all.h')
-rw-r--r--src/expr/array_store_all.h59
1 files changed, 21 insertions, 38 deletions
diff --git a/src/expr/array_store_all.h b/src/expr/array_store_all.h
index b1d624266..293b785a9 100644
--- a/src/expr/array_store_all.h
+++ b/src/expr/array_store_all.h
@@ -20,61 +20,43 @@
#pragma once
+#include <iosfwd>
+
+#include "base/exception.h"
+
namespace CVC4 {
// messy; Expr needs ArrayStoreAll (because it's the payload of a
// CONSTANT-kinded expression), and ArrayStoreAll needs Expr.
- class CVC4_PUBLIC ArrayStoreAll;
+ class Expr;
+ class ArrayType;
}/* 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(const ArrayStoreAll& other);
- ArrayStoreAll(ArrayType type, Expr expr) throw(IllegalArgumentException) :
- d_type(type),
- d_expr(expr) {
+ ArrayStoreAll& operator=(const ArrayStoreAll& other);
- // 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());
+ ArrayStoreAll(const ArrayType& type, const Expr& expr)
+ throw(IllegalArgumentException);
- CheckArgument(expr.getType().isComparableTo(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();
- ~ArrayStoreAll() throw() {
- }
+ const ArrayType& getType() const throw();
- ArrayType getType() const throw() {
- return d_type;
- }
- Expr getExpr() const throw() {
- return d_expr;
- }
+ const Expr& getExpr() const throw();
+
+ bool operator==(const ArrayStoreAll& asa) const throw();
- 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();
+ bool operator<=(const ArrayStoreAll& asa) const throw();
bool operator>(const ArrayStoreAll& asa) const throw() {
return !(*this <= asa);
}
@@ -82,6 +64,9 @@ public:
return !(*this < asa);
}
+private:
+ ArrayType* d_type;
+ Expr* d_expr;
};/* class ArrayStoreAll */
std::ostream& operator<<(std::ostream& out, const ArrayStoreAll& asa) CVC4_PUBLIC;
@@ -90,9 +75,7 @@ std::ostream& operator<<(std::ostream& out, const ArrayStoreAll& asa) CVC4_PUBLI
* Hash function for the ArrayStoreAll constants.
*/
struct CVC4_PUBLIC ArrayStoreAllHashFunction {
- inline size_t operator()(const ArrayStoreAll& asa) const {
- return TypeHashFunction()(asa.getType()) * ExprHashFunction()(asa.getExpr());
- }
+ size_t operator()(const ArrayStoreAll& asa) const;
};/* struct ArrayStoreAllHashFunction */
}/* CVC4 namespace */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback